Skip to content

Commit 5e50c8a

Browse files
committed
cool beans
1 parent 2f320a2 commit 5e50c8a

File tree

60 files changed

+452
-651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+452
-651
lines changed

compiler/rustc_middle/src/query/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,10 @@ rustc_queries! {
14121412
separate_provide_extern
14131413
}
14141414

1415+
query is_general_impl(def_id: DefId) -> bool {
1416+
desc { |tcx| "looking up whether `{}` is a general impl", tcx.def_path_str(def_id) }
1417+
}
1418+
14151419
query check_well_formed(key: LocalDefId) -> () {
14161420
desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key.to_def_id()) }
14171421
}

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,23 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
135135
// candidate which assumes $0 == int, one that assumes `$0 ==
136136
// usize`, etc. This spells an ambiguity.
137137

138-
let mut candidates = self.filter_impls(candidates, stack.obligation);
139-
138+
let candidates = self.filter_impls(candidates, stack.obligation);
139+
let mut candidates = candidates
140+
.into_iter()
141+
.map(|c| match c {
142+
ImplCandidate(impl_def) if self.tcx().is_general_impl(impl_def) => {
143+
match self.evaluate_candidate(stack, &c) {
144+
Ok(eval) if eval.may_apply() => Ok(Some(c)),
145+
Ok(_) => Ok(None),
146+
Err(OverflowError::Canonical) => Err(Overflow(OverflowError::Canonical)),
147+
Err(OverflowError::ErrorReporting) => Err(ErrorReporting),
148+
Err(OverflowError::Error(e)) => Err(Overflow(OverflowError::Error(e))),
149+
}
150+
}
151+
_ => Ok(Some(c)),
152+
})
153+
.flat_map(Result::transpose)
154+
.collect::<Result<Vec<_>, _>>()?;
140155
// If there is more than one candidate, first winnow them down
141156
// by considering extra conditions (nested obligations and so
142157
// forth). We don't winnow if there is exactly one

compiler/rustc_ty_utils/src/ty.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use rustc_data_structures::fx::FxIndexSet;
22
use rustc_hir as hir;
33
use rustc_hir::def_id::DefId;
44
use rustc_middle::ty::subst::Subst;
5+
use rustc_middle::ty::util::IgnoreRegions;
56
use rustc_middle::ty::{
67
self, Binder, EarlyBinder, Predicate, PredicateKind, ToPredicate, Ty, TyCtxt,
78
};
@@ -460,6 +461,13 @@ pub fn conservative_is_privately_uninhabited_raw<'tcx>(
460461
}
461462
}
462463

464+
fn is_general_impl(tcx: TyCtxt<'_>, id: DefId) -> bool {
465+
let Some(trait_ref) = tcx.impl_trait_ref(id) else {
466+
span_bug!(tcx.def_span(id), "expected impl, found `{:?} for `{:?}`", tcx.def_kind(id), id);
467+
};
468+
tcx.uses_unique_generic_params(trait_ref.substs, IgnoreRegions::No).is_ok()
469+
}
470+
463471
pub fn provide(providers: &mut ty::query::Providers) {
464472
*providers = ty::query::Providers {
465473
asyncness,
@@ -469,6 +477,7 @@ pub fn provide(providers: &mut ty::query::Providers) {
469477
instance_def_size_estimate,
470478
issue33140_self_ty,
471479
impl_defaultness,
480+
is_general_impl,
472481
conservative_is_privately_uninhabited: conservative_is_privately_uninhabited_raw,
473482
..*providers
474483
};

library/core/src/future/into_future.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ use crate::future::Future;
9999
/// }
100100
/// ```
101101
#[stable(feature = "into_future", since = "1.64.0")]
102+
#[rustc_on_unimplemented(
103+
label = "`{Self}` cannot be converted to a future",
104+
message = "`{Self}` cannot be converted to a future",
105+
note = "{Self} must be a future or must implement `IntoFuture` to be awaited"
106+
)]
102107
pub trait IntoFuture {
103108
/// The output that the future will produce on completion.
104109
#[stable(feature = "into_future", since = "1.64.0")]

library/core/src/iter/traits/collect.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,35 @@ pub trait FromIterator<A>: Sized {
227227
/// ```
228228
#[rustc_diagnostic_item = "IntoIterator"]
229229
#[rustc_skip_array_during_method_dispatch]
230+
#[rustc_on_unimplemented(
231+
on(
232+
_Self = "std::ops::RangeTo<Idx>",
233+
label = "if you meant to iterate until a value, add a starting value",
234+
note = "`..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a \
235+
bounded `Range`: `0..end`"
236+
),
237+
on(
238+
_Self = "std::ops::RangeToInclusive<Idx>",
239+
label = "if you meant to iterate until a value (including it), add a starting value",
240+
note = "`..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant \
241+
to have a bounded `RangeInclusive`: `0..=end`"
242+
),
243+
on(
244+
_Self = "&str",
245+
label = "cannot implicitly convert `{Self}` to an iterator; try calling `.chars()` or `.bytes()`"
246+
),
247+
on(
248+
_Self = "std::string::String",
249+
label = "cannot implicitly convert `{Self}` to an iterator; try calling `.chars()` or `.bytes()`"
250+
),
251+
on(
252+
_Self = "{integral}",
253+
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
254+
syntax `start..end` or the inclusive range syntax `start..=end`"
255+
),
256+
label = "`{Self}` cannot be converted to an iterator",
257+
message = "`{Self}` cannot be converted to an iterator"
258+
)]
230259
#[stable(feature = "rust1", since = "1.0.0")]
231260
pub trait IntoIterator {
232261
/// The type of the elements being iterated over.

src/test/ui/associated-types/substs-ppaux.normal.stderr

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,11 @@ help: use parentheses to call this function
7070
LL | let x: () = foo::<'static>();
7171
| ++
7272

73-
error[E0277]: the size for values of type `str` cannot be known at compilation time
73+
error[E0277]: the trait bound `str: Foo<'_, '_, u8>` is not satisfied
7474
--> $DIR/substs-ppaux.rs:49:5
7575
|
7676
LL | <str as Foo<u8>>::bar;
77-
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
78-
|
79-
= help: the trait `Sized` is not implemented for `str`
80-
note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str`
81-
--> $DIR/substs-ppaux.rs:11:17
82-
|
83-
LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
84-
| ^^^^^^^^^^^^^^ ^
77+
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<'_, '_, u8>` is not implemented for `str`
8578

8679
error: aborting due to 5 previous errors
8780

src/test/ui/associated-types/substs-ppaux.verbose.stderr

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,11 @@ help: use parentheses to call this function
7070
LL | let x: () = foo::<'static>();
7171
| ++
7272

73-
error[E0277]: the size for values of type `str` cannot be known at compilation time
73+
error[E0277]: the trait bound `str: Foo<'_#0r, '_#1r, u8>` is not satisfied
7474
--> $DIR/substs-ppaux.rs:49:5
7575
|
7676
LL | <str as Foo<u8>>::bar;
77-
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
78-
|
79-
= help: the trait `Sized` is not implemented for `str`
80-
note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str`
81-
--> $DIR/substs-ppaux.rs:11:17
82-
|
83-
LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
84-
| ^^^^^^^^^^^^^^ ^
77+
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<'_#0r, '_#1r, u8>` is not implemented for `str`
8578

8679
error: aborting due to 5 previous errors
8780

src/test/ui/async-await/issue-70594.stderr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ error[E0744]: `.await` is not allowed in a `const`
1818
LL | [1; ().await];
1919
| ^^^^^^
2020

21-
error[E0277]: `()` is not a future
21+
error[E0277]: `()` cannot be converted to a future
2222
--> $DIR/issue-70594.rs:4:11
2323
|
2424
LL | [1; ().await];
25-
| ^^^^^^ `()` is not a future
25+
| ^^^^^^ `()` cannot be converted to a future
2626
|
27-
= help: the trait `Future` is not implemented for `()`
27+
= help: the trait `IntoFuture` is not implemented for `()`
2828
= note: () must be a future or must implement `IntoFuture` to be awaited
29-
= note: required because of the requirements on the impl of `IntoFuture` for `()`
3029
help: remove the `.await`
3130
|
3231
LL - [1; ().await];

src/test/ui/async-await/issues/issue-62009-1.stderr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ LL | fn main() {
2424
LL | (|_| 2333).await;
2525
| ^^^^^^ only allowed inside `async` functions and blocks
2626

27-
error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
27+
error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` cannot be converted to a future
2828
--> $DIR/issue-62009-1.rs:12:15
2929
|
3030
LL | (|_| 2333).await;
31-
| ^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
31+
| ^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` cannot be converted to a future
3232
|
33-
= help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
33+
= help: the trait `IntoFuture` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
3434
= note: [closure@$DIR/issue-62009-1.rs:12:6: 12:9] must be a future or must implement `IntoFuture` to be awaited
35-
= note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
3635
help: remove the `.await`
3736
|
3837
LL - (|_| 2333).await;

src/test/ui/async-await/unnecessary-await.stderr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
error[E0277]: `()` is not a future
1+
error[E0277]: `()` cannot be converted to a future
22
--> $DIR/unnecessary-await.rs:9:10
33
|
44
LL | boo().await;
5-
| -----^^^^^^ `()` is not a future
5+
| -----^^^^^^ `()` cannot be converted to a future
66
| |
77
| this call returns `()`
88
|
9-
= help: the trait `Future` is not implemented for `()`
9+
= help: the trait `IntoFuture` is not implemented for `()`
1010
= note: () must be a future or must implement `IntoFuture` to be awaited
11-
= note: required because of the requirements on the impl of `IntoFuture` for `()`
1211
help: remove the `.await`
1312
|
1413
LL - boo().await;
Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,18 @@
1-
error[E0277]: the trait bound `(): _Contains<&C>` is not satisfied
1+
error[E0277]: the trait bound `&C: Delegates<()>` is not satisfied
22
--> $DIR/issue-85848.rs:24:29
33
|
44
LL | writes_to_specific_path(&cap);
5-
| ----------------------- ^^^^ the trait `_Contains<&C>` is not implemented for `()`
5+
| ----------------------- ^^^^ the trait `Delegates<()>` is not implemented for `&C`
66
| |
77
| required by a bound introduced by this call
88
|
99
= help: the trait `Delegates<U>` is implemented for `T`
10-
note: required because of the requirements on the impl of `Contains<(), true>` for `&C`
11-
--> $DIR/issue-85848.rs:21:12
12-
|
13-
LL | impl<T, U> Contains<T, { contains::<T, U>() }> for U where T: _Contains<U> {}
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^
15-
note: required because of the requirements on the impl of `Delegates<()>` for `&C`
16-
--> $DIR/issue-85848.rs:12:12
17-
|
18-
LL | impl<T, U> Delegates<U> for T where T: Contains<U, true> {}
19-
| ^^^^^^^^^^^^ ^
20-
note: required by a bound in `writes_to_specific_path`
21-
--> $DIR/issue-85848.rs:30:31
22-
|
23-
LL | fn writes_to_specific_path<C: Delegates<()>>(cap: &C) {}
24-
| ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path`
25-
26-
error: unconstrained generic constant
27-
--> $DIR/issue-85848.rs:24:29
28-
|
29-
LL | writes_to_specific_path(&cap);
30-
| ----------------------- ^^^^
31-
| |
32-
| required by a bound introduced by this call
33-
|
34-
= help: try adding a `where` bound using this expression: `where [(); { contains::<T, U>() }]:`
35-
note: required because of the requirements on the impl of `Contains<(), true>` for `&C`
36-
--> $DIR/issue-85848.rs:21:12
37-
|
38-
LL | impl<T, U> Contains<T, { contains::<T, U>() }> for U where T: _Contains<U> {}
39-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^
40-
note: required because of the requirements on the impl of `Delegates<()>` for `&C`
41-
--> $DIR/issue-85848.rs:12:12
42-
|
43-
LL | impl<T, U> Delegates<U> for T where T: Contains<U, true> {}
44-
| ^^^^^^^^^^^^ ^
4510
note: required by a bound in `writes_to_specific_path`
4611
--> $DIR/issue-85848.rs:30:31
4712
|
4813
LL | fn writes_to_specific_path<C: Delegates<()>>(cap: &C) {}
4914
| ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path`
5015

51-
error[E0308]: mismatched types
52-
--> $DIR/issue-85848.rs:24:5
53-
|
54-
LL | writes_to_specific_path(&cap);
55-
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `true`, found `{ contains::<T, U>() }`
56-
|
57-
= note: expected type `true`
58-
found type `{ contains::<T, U>() }`
59-
60-
error: aborting due to 3 previous errors
16+
error: aborting due to previous error
6117

62-
Some errors have detailed explanations: E0277, E0308.
63-
For more information about an error, try `rustc --explain E0277`.
18+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/error-codes/E0275.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo`
2-
--> $DIR/E0275.rs:5:33
1+
error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo`
2+
--> $DIR/E0275.rs:5:9
33
|
44
LL | impl<T> Foo for T where Bar<T>: Foo {}
5-
| ^^^
5+
| ^^^
66
|
77
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`)
8-
note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
8+
note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
99
--> $DIR/E0275.rs:5:9
1010
|
1111
LL | impl<T> Foo for T where Bar<T>: Foo {}
1212
| ^^^ ^
1313
= note: 127 redundant requirements hidden
14-
= note: required because of the requirements on the impl of `Foo` for `Bar<T>`
14+
= note: required because of the requirements on the impl of `Foo` for `T`
1515

1616
error: aborting due to previous error
1717

src/test/ui/for/for-c-in-str.stderr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
error[E0277]: `&str` is not an iterator
1+
error[E0277]: `&str` cannot be converted to an iterator
22
--> $DIR/for-c-in-str.rs:4:14
33
|
44
LL | for c in "asdf" {
5-
| ^^^^^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()`
5+
| ^^^^^^ cannot implicitly convert `&str` to an iterator; try calling `.chars()` or `.bytes()`
66
|
7-
= help: the trait `Iterator` is not implemented for `&str`
8-
= note: required because of the requirements on the impl of `IntoIterator` for `&str`
7+
= help: the trait `IntoIterator` is not implemented for `&str`
98

109
error: aborting due to previous error
1110

src/test/ui/for/for-loop-bogosity.stderr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
error[E0277]: `MyStruct` is not an iterator
1+
error[E0277]: `MyStruct` cannot be converted to an iterator
22
--> $DIR/for-loop-bogosity.rs:17:14
33
|
44
LL | for x in bogus {
5-
| ^^^^^ `MyStruct` is not an iterator
5+
| ^^^^^ `MyStruct` cannot be converted to an iterator
66
|
7-
= help: the trait `Iterator` is not implemented for `MyStruct`
8-
= note: required because of the requirements on the impl of `IntoIterator` for `MyStruct`
7+
= help: the trait `IntoIterator` is not implemented for `MyStruct`
98

109
error: aborting due to previous error
1110

src/test/ui/generator/yield-outside-generator-issue-78653.stderr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ error[E0627]: yield expression outside of generator literal
44
LL | yield || for i in 0 { }
55
| ^^^^^^^^^^^^^^^^^^^^^^^
66

7-
error[E0277]: `{integer}` is not an iterator
7+
error[E0277]: `{integer}` cannot be converted to an iterator
88
--> $DIR/yield-outside-generator-issue-78653.rs:4:23
99
|
1010
LL | yield || for i in 0 { }
11-
| ^ `{integer}` is not an iterator
11+
| ^ `{integer}` cannot be converted to an iterator
1212
|
13-
= help: the trait `Iterator` is not implemented for `{integer}`
13+
= help: the trait `IntoIterator` is not implemented for `{integer}`
1414
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
15-
= note: required because of the requirements on the impl of `IntoIterator` for `{integer}`
1615

1716
error: aborting due to 2 previous errors
1817

src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied
1+
error[E0599]: no method named `f` found for struct `S` in the current scope
22
--> $DIR/method-unsatified-assoc-type-predicate.rs:30:7
33
|
44
LL | struct S;
5-
| --------
6-
| |
7-
| method `f` not found for this struct
8-
| doesn't satisfy `<S as X>::Y<i32> = i32`
9-
| doesn't satisfy `S: M`
5+
| -------- method `f` not found for this struct
106
...
117
LL | a.f();
12-
| ^ method cannot be called on `S` due to unsatisfied trait bounds
8+
| ^ method not found in `S`
139
|
14-
note: trait bound `<S as X>::Y<i32> = i32` was not satisfied
15-
--> $DIR/method-unsatified-assoc-type-predicate.rs:14:11
10+
= help: items from traits can only be used if the trait is implemented and in scope
11+
note: `M` defines an item `f`, perhaps you need to implement it
12+
--> $DIR/method-unsatified-assoc-type-predicate.rs:10:1
1613
|
17-
LL | impl<T: X<Y<i32> = i32>> M for T {}
18-
| ^^^^^^^^^^^^ - -
19-
| |
20-
| unsatisfied trait bound introduced here
14+
LL | trait M {
15+
| ^^^^^^^
2116

2217
error: aborting due to previous error
2318

0 commit comments

Comments
 (0)