Skip to content

Commit 10ed7f5

Browse files
committed
Auto merge of rust-lang#141396 - matthiaskrgr:rollup-feg050g, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#135562 (Add ignore value suggestion in closure body) - rust-lang#139635 (Finalize repeat expr inference behaviour with inferred repeat counts) - rust-lang#139668 (Handle regions equivalent to 'static in non_local_bounds) - rust-lang#140218 (HIR ty lowering: Clean up & refactor the lowering of type-relative paths) - rust-lang#140435 (use uX::from instead of _ as uX in non - const contexts) - rust-lang#141130 (rustc_on_unimplemented cleanups) - rust-lang#141286 (Querify `coroutine_hidden_types`) Failed merges: - rust-lang#140247 (Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents afb6519 + 03098d2 commit 10ed7f5

File tree

11 files changed

+67
-70
lines changed

11 files changed

+67
-70
lines changed

core/src/convert/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ pub trait Into<T>: Sized {
575575
#[rustc_diagnostic_item = "From"]
576576
#[stable(feature = "rust1", since = "1.0.0")]
577577
#[rustc_on_unimplemented(on(
578-
all(_Self = "&str", T = "alloc::string::String"),
578+
all(Self = "&str", T = "alloc::string::String"),
579579
note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix",
580580
))]
581581
#[doc(search_unbox)]

core/src/fmt/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,10 @@ impl Display for Arguments<'_> {
856856
on(
857857
crate_local,
858858
label = "`{Self}` cannot be formatted using `{{:?}}`",
859-
note = "add `#[derive(Debug)]` to `{Self}` or manually `impl {Debug} for {Self}`"
859+
note = "add `#[derive(Debug)]` to `{Self}` or manually `impl {This} for {Self}`"
860860
),
861-
message = "`{Self}` doesn't implement `{Debug}`",
862-
label = "`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{Debug}`"
861+
message = "`{Self}` doesn't implement `{This}`",
862+
label = "`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{This}`"
863863
)]
864864
#[doc(alias = "{:?}")]
865865
#[rustc_diagnostic_item = "Debug"]
@@ -969,12 +969,12 @@ pub use macros::Debug;
969969
/// ```
970970
#[rustc_on_unimplemented(
971971
on(
972-
any(_Self = "std::path::Path", _Self = "std::path::PathBuf"),
972+
any(Self = "std::path::Path", Self = "std::path::PathBuf"),
973973
label = "`{Self}` cannot be formatted with the default formatter; call `.display()` on it",
974974
note = "call `.display()` or `.to_string_lossy()` to safely print paths, \
975975
as they may contain non-Unicode data"
976976
),
977-
message = "`{Self}` doesn't implement `{Display}`",
977+
message = "`{Self}` doesn't implement `{This}`",
978978
label = "`{Self}` cannot be formatted with the default formatter",
979979
note = "in format strings you may be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead"
980980
)]

core/src/iter/traits/collect.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,32 +97,32 @@ use super::TrustedLen;
9797
#[stable(feature = "rust1", since = "1.0.0")]
9898
#[rustc_on_unimplemented(
9999
on(
100-
_Self = "&[{A}]",
100+
Self = "&[{A}]",
101101
message = "a slice of type `{Self}` cannot be built since we need to store the elements somewhere",
102102
label = "try explicitly collecting into a `Vec<{A}>`",
103103
),
104104
on(
105-
all(A = "{integer}", any(_Self = "&[{integral}]",)),
105+
all(A = "{integer}", any(Self = "&[{integral}]",)),
106106
message = "a slice of type `{Self}` cannot be built since we need to store the elements somewhere",
107107
label = "try explicitly collecting into a `Vec<{A}>`",
108108
),
109109
on(
110-
_Self = "[{A}]",
110+
Self = "[{A}]",
111111
message = "a slice of type `{Self}` cannot be built since `{Self}` has no definite size",
112112
label = "try explicitly collecting into a `Vec<{A}>`",
113113
),
114114
on(
115-
all(A = "{integer}", any(_Self = "[{integral}]",)),
115+
all(A = "{integer}", any(Self = "[{integral}]",)),
116116
message = "a slice of type `{Self}` cannot be built since `{Self}` has no definite size",
117117
label = "try explicitly collecting into a `Vec<{A}>`",
118118
),
119119
on(
120-
_Self = "[{A}; _]",
120+
Self = "[{A}; _]",
121121
message = "an array of type `{Self}` cannot be built directly from an iterator",
122122
label = "try collecting into a `Vec<{A}>`, then using `.try_into()`",
123123
),
124124
on(
125-
all(A = "{integer}", any(_Self = "[{integral}; _]",)),
125+
all(A = "{integer}", any(Self = "[{integral}; _]",)),
126126
message = "an array of type `{Self}` cannot be built directly from an iterator",
127127
label = "try collecting into a `Vec<{A}>`, then using `.try_into()`",
128128
),
@@ -239,41 +239,38 @@ pub trait FromIterator<A>: Sized {
239239
#[rustc_diagnostic_item = "IntoIterator"]
240240
#[rustc_on_unimplemented(
241241
on(
242-
_Self = "core::ops::range::RangeTo<Idx>",
242+
Self = "core::ops::range::RangeTo<Idx>",
243243
label = "if you meant to iterate until a value, add a starting value",
244244
note = "`..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a \
245245
bounded `Range`: `0..end`"
246246
),
247247
on(
248-
_Self = "core::ops::range::RangeToInclusive<Idx>",
248+
Self = "core::ops::range::RangeToInclusive<Idx>",
249249
label = "if you meant to iterate until a value (including it), add a starting value",
250250
note = "`..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant \
251251
to have a bounded `RangeInclusive`: `0..=end`"
252252
),
253253
on(
254-
_Self = "[]",
254+
Self = "[]",
255255
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
256256
),
257-
on(_Self = "&[]", label = "`{Self}` is not an iterator; try calling `.iter()`"),
257+
on(Self = "&[]", label = "`{Self}` is not an iterator; try calling `.iter()`"),
258258
on(
259-
_Self = "alloc::vec::Vec<T, A>",
259+
Self = "alloc::vec::Vec<T, A>",
260260
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
261261
),
262+
on(Self = "&str", label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"),
262263
on(
263-
_Self = "&str",
264+
Self = "alloc::string::String",
264265
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
265266
),
266267
on(
267-
_Self = "alloc::string::String",
268-
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
269-
),
270-
on(
271-
_Self = "{integral}",
268+
Self = "{integral}",
272269
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
273270
syntax `start..end` or the inclusive range syntax `start..=end`"
274271
),
275272
on(
276-
_Self = "{float}",
273+
Self = "{float}",
277274
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
278275
syntax `start..end` or the inclusive range syntax `start..=end`"
279276
),

core/src/iter/traits/iterator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ fn _assert_is_dyn_compatible(_: &dyn Iterator<Item = ()>) {}
2222
#[stable(feature = "rust1", since = "1.0.0")]
2323
#[rustc_on_unimplemented(
2424
on(
25-
_Self = "core::ops::range::RangeTo<Idx>",
25+
Self = "core::ops::range::RangeTo<Idx>",
2626
note = "you might have meant to use a bounded `Range`"
2727
),
2828
on(
29-
_Self = "core::ops::range::RangeToInclusive<Idx>",
29+
Self = "core::ops::range::RangeToInclusive<Idx>",
3030
note = "you might have meant to use a bounded `RangeInclusive`"
3131
),
3232
label = "`{Self}` is not an iterator",

core/src/marker.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -550,72 +550,72 @@ pub trait BikeshedGuaranteedNoDrop {}
550550
#[lang = "sync"]
551551
#[rustc_on_unimplemented(
552552
on(
553-
_Self = "core::cell::once::OnceCell<T>",
553+
Self = "core::cell::once::OnceCell<T>",
554554
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::OnceLock` instead"
555555
),
556556
on(
557-
_Self = "core::cell::Cell<u8>",
557+
Self = "core::cell::Cell<u8>",
558558
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU8` instead",
559559
),
560560
on(
561-
_Self = "core::cell::Cell<u16>",
561+
Self = "core::cell::Cell<u16>",
562562
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU16` instead",
563563
),
564564
on(
565-
_Self = "core::cell::Cell<u32>",
565+
Self = "core::cell::Cell<u32>",
566566
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU32` instead",
567567
),
568568
on(
569-
_Self = "core::cell::Cell<u64>",
569+
Self = "core::cell::Cell<u64>",
570570
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU64` instead",
571571
),
572572
on(
573-
_Self = "core::cell::Cell<usize>",
573+
Self = "core::cell::Cell<usize>",
574574
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicUsize` instead",
575575
),
576576
on(
577-
_Self = "core::cell::Cell<i8>",
577+
Self = "core::cell::Cell<i8>",
578578
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI8` instead",
579579
),
580580
on(
581-
_Self = "core::cell::Cell<i16>",
581+
Self = "core::cell::Cell<i16>",
582582
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI16` instead",
583583
),
584584
on(
585-
_Self = "core::cell::Cell<i32>",
585+
Self = "core::cell::Cell<i32>",
586586
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead",
587587
),
588588
on(
589-
_Self = "core::cell::Cell<i64>",
589+
Self = "core::cell::Cell<i64>",
590590
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI64` instead",
591591
),
592592
on(
593-
_Self = "core::cell::Cell<isize>",
593+
Self = "core::cell::Cell<isize>",
594594
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicIsize` instead",
595595
),
596596
on(
597-
_Self = "core::cell::Cell<bool>",
597+
Self = "core::cell::Cell<bool>",
598598
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicBool` instead",
599599
),
600600
on(
601601
all(
602-
_Self = "core::cell::Cell<T>",
603-
not(_Self = "core::cell::Cell<u8>"),
604-
not(_Self = "core::cell::Cell<u16>"),
605-
not(_Self = "core::cell::Cell<u32>"),
606-
not(_Self = "core::cell::Cell<u64>"),
607-
not(_Self = "core::cell::Cell<usize>"),
608-
not(_Self = "core::cell::Cell<i8>"),
609-
not(_Self = "core::cell::Cell<i16>"),
610-
not(_Self = "core::cell::Cell<i32>"),
611-
not(_Self = "core::cell::Cell<i64>"),
612-
not(_Self = "core::cell::Cell<isize>"),
613-
not(_Self = "core::cell::Cell<bool>")
602+
Self = "core::cell::Cell<T>",
603+
not(Self = "core::cell::Cell<u8>"),
604+
not(Self = "core::cell::Cell<u16>"),
605+
not(Self = "core::cell::Cell<u32>"),
606+
not(Self = "core::cell::Cell<u64>"),
607+
not(Self = "core::cell::Cell<usize>"),
608+
not(Self = "core::cell::Cell<i8>"),
609+
not(Self = "core::cell::Cell<i16>"),
610+
not(Self = "core::cell::Cell<i32>"),
611+
not(Self = "core::cell::Cell<i64>"),
612+
not(Self = "core::cell::Cell<isize>"),
613+
not(Self = "core::cell::Cell<bool>")
614614
),
615615
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`",
616616
),
617617
on(
618-
_Self = "core::cell::RefCell<T>",
618+
Self = "core::cell::RefCell<T>",
619619
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead",
620620
),
621621
message = "`{Self}` cannot be shared between threads safely",

core/src/ops/arith.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
#[stable(feature = "rust1", since = "1.0.0")]
6868
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
6969
#[rustc_on_unimplemented(
70-
on(all(_Self = "{integer}", Rhs = "{float}"), message = "cannot add a float to an integer",),
71-
on(all(_Self = "{float}", Rhs = "{integer}"), message = "cannot add an integer to a float",),
70+
on(all(Self = "{integer}", Rhs = "{float}"), message = "cannot add a float to an integer",),
71+
on(all(Self = "{float}", Rhs = "{integer}"), message = "cannot add an integer to a float",),
7272
message = "cannot add `{Rhs}` to `{Self}`",
7373
label = "no implementation for `{Self} + {Rhs}`",
7474
append_const_msg

core/src/ops/function.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use crate::marker::Tuple;
6262
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
6363
),
6464
on(
65-
_Self = "unsafe fn",
65+
Self = "unsafe fn",
6666
note = "unsafe function cannot be called generically without an unsafe block",
6767
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
6868
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
@@ -149,7 +149,7 @@ pub trait Fn<Args: Tuple>: FnMut<Args> {
149149
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
150150
),
151151
on(
152-
_Self = "unsafe fn",
152+
Self = "unsafe fn",
153153
note = "unsafe function cannot be called generically without an unsafe block",
154154
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
155155
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
@@ -228,7 +228,7 @@ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
228228
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
229229
),
230230
on(
231-
_Self = "unsafe fn",
231+
Self = "unsafe fn",
232232
note = "unsafe function cannot be called generically without an unsafe block",
233233
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
234234
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"

core/src/ops/index.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,17 @@ pub trait Index<Idx: ?Sized> {
144144
#[lang = "index_mut"]
145145
#[rustc_on_unimplemented(
146146
on(
147-
_Self = "&str",
147+
Self = "&str",
148148
note = "you can use `.chars().nth()` or `.bytes().nth()`
149149
see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
150150
),
151151
on(
152-
_Self = "str",
152+
Self = "str",
153153
note = "you can use `.chars().nth()` or `.bytes().nth()`
154154
see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
155155
),
156156
on(
157-
_Self = "alloc::string::String",
157+
Self = "alloc::string::String",
158158
note = "you can use `.chars().nth()` or `.bytes().nth()`
159159
see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
160160
),

core/src/ops/try_trait.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ use crate::ops::ControlFlow;
117117
on(
118118
all(from_desugaring = "TryBlock"),
119119
message = "a `try` block must return `Result` or `Option` \
120-
(or another type that implements `{Try}`)",
120+
(or another type that implements `{This}`)",
121121
label = "could not wrap the final value of the block as `{Self}` doesn't implement `Try`",
122122
),
123123
on(
124124
all(from_desugaring = "QuestionMark"),
125-
message = "the `?` operator can only be applied to values that implement `{Try}`",
125+
message = "the `?` operator can only be applied to values that implement `{This}`",
126126
label = "the `?` operator cannot be applied to type `{Self}`"
127127
)
128128
)]
@@ -226,7 +226,7 @@ pub trait Try: FromResidual {
226226
on(
227227
all(
228228
from_desugaring = "QuestionMark",
229-
_Self = "core::result::Result<T, E>",
229+
Self = "core::result::Result<T, E>",
230230
R = "core::option::Option<core::convert::Infallible>",
231231
),
232232
message = "the `?` operator can only be used on `Result`s, not `Option`s, \
@@ -237,7 +237,7 @@ pub trait Try: FromResidual {
237237
on(
238238
all(
239239
from_desugaring = "QuestionMark",
240-
_Self = "core::result::Result<T, E>",
240+
Self = "core::result::Result<T, E>",
241241
),
242242
// There's a special error message in the trait selection code for
243243
// `From` in `?`, so this is not shown for result-in-result errors,
@@ -250,7 +250,7 @@ pub trait Try: FromResidual {
250250
on(
251251
all(
252252
from_desugaring = "QuestionMark",
253-
_Self = "core::option::Option<T>",
253+
Self = "core::option::Option<T>",
254254
R = "core::result::Result<T, E>",
255255
),
256256
message = "the `?` operator can only be used on `Option`s, not `Result`s, \
@@ -261,7 +261,7 @@ pub trait Try: FromResidual {
261261
on(
262262
all(
263263
from_desugaring = "QuestionMark",
264-
_Self = "core::option::Option<T>",
264+
Self = "core::option::Option<T>",
265265
),
266266
// `Option`-in-`Option` always works, as there's only one possible
267267
// residual, so this can also be phrased strongly.
@@ -273,7 +273,7 @@ pub trait Try: FromResidual {
273273
on(
274274
all(
275275
from_desugaring = "QuestionMark",
276-
_Self = "core::ops::control_flow::ControlFlow<B, C>",
276+
Self = "core::ops::control_flow::ControlFlow<B, C>",
277277
R = "core::ops::control_flow::ControlFlow<B, C>",
278278
),
279279
message = "the `?` operator in {ItemContext} that returns `ControlFlow<B, _>` \
@@ -285,7 +285,7 @@ pub trait Try: FromResidual {
285285
on(
286286
all(
287287
from_desugaring = "QuestionMark",
288-
_Self = "core::ops::control_flow::ControlFlow<B, C>",
288+
Self = "core::ops::control_flow::ControlFlow<B, C>",
289289
// `R` is not a `ControlFlow`, as that case was matched previously
290290
),
291291
message = "the `?` operator can only be used on `ControlFlow`s \
@@ -297,7 +297,7 @@ pub trait Try: FromResidual {
297297
all(from_desugaring = "QuestionMark"),
298298
message = "the `?` operator can only be used in {ItemContext} \
299299
that returns `Result` or `Option` \
300-
(or another type that implements `{FromResidual}`)",
300+
(or another type that implements `{This}`)",
301301
label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
302302
parent_label = "this function should return `Result` or `Option` to accept `?`"
303303
),

core/src/slice/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ mod private_slice_index {
161161
#[rustc_on_unimplemented(
162162
on(T = "str", label = "string indices are ranges of `usize`",),
163163
on(
164-
all(any(T = "str", T = "&str", T = "alloc::string::String"), _Self = "{integer}"),
164+
all(any(T = "str", T = "&str", T = "alloc::string::String"), Self = "{integer}"),
165165
note = "you can use `.chars().nth()` or `.bytes().nth()`\n\
166166
for more information, see chapter 8 in The Book: \
167167
<https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"

std/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ pub fn id() -> u32 {
25322532
#[rustc_on_unimplemented(on(
25332533
cause = "MainFunctionType",
25342534
message = "`main` has invalid return type `{Self}`",
2535-
label = "`main` can only return types that implement `{Termination}`"
2535+
label = "`main` can only return types that implement `{This}`"
25362536
))]
25372537
pub trait Termination {
25382538
/// Is called to get the representation of the value as status code.

0 commit comments

Comments
 (0)