You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#98863 - compiler-errors:projection-msg, r=estebank
Implement special-cased projection error message for some common traits
Not sure what the best phrasing is, but I feel like these are more clear than the plain `<Type as Iterator>::Output == Type` messages.
If this is actually a good idea, are there any other traits this could benefit?
Copy file name to clipboardExpand all lines: src/test/ui/issues/issue-31173.stderr
+9-9
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
-
error[E0271]: type mismatch resolving `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]> as Iterator>::Item == &_`
2
-
--> $DIR/issue-31173.rs:10:10
1
+
error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>` to be an iterator that yields `&_`, but it yields `u8`
2
+
--> $DIR/issue-31173.rs:11:10
3
3
|
4
4
LL | .cloned()
5
5
| ^^^^^^ expected reference, found `u8`
@@ -12,11 +12,11 @@ note: required by a bound in `cloned`
12
12
LL | Self: Sized + Iterator<Item = &'a T>,
13
13
| ^^^^^^^^^^^^ required by this bound in `cloned`
14
14
15
-
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>`, but its trait bounds were not satisfied
16
-
--> $DIR/issue-31173.rs:12:10
15
+
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>`, but its trait bounds were not satisfied
16
+
--> $DIR/issue-31173.rs:13:10
17
17
|
18
18
LL | .collect();
19
-
| ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>` due to unsatisfied trait bounds
19
+
| ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>` due to unsatisfied trait bounds
Copy file name to clipboardExpand all lines: src/test/ui/issues/issue-33941.rs
+3-3
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
use std::collections::HashMap;
4
4
5
5
fnmain(){
6
-
for _ inHashMap::new().iter().cloned(){}//~ ERROR type mismatch
7
-
//~^ ERROR type mismatch
8
-
//~| ERROR type mismatch
6
+
for _ inHashMap::new().iter().cloned(){}//~ ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
7
+
//~^ ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
8
+
//~| ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
0 commit comments