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
Rollup merge of rust-lang#48834 - ysiraichi:suggest-remove-ref, r=estebank
Suggest removing `&`s
This implements the error message discussed in rust-lang#47744.
We check whether removing each `&` yields a type that satisfies the requested obligation.
Also, it was created a new `NodeId` field in `ObligationCause` in order to iterate through the `&`s. The way it's implemented now, it iterates through the obligation snippet and counts the number of `&`.
r? @estebank
error[E0277]: the trait bound `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>: std::iter::Iterator` is not satisfied
2
+
--> $DIR/suggest-remove-refs-3.rs:14:19
3
+
|
4
+
LL | for (i, n) in & & &
5
+
| ___________________^
6
+
| |___________________|
7
+
| ||
8
+
LL | || & &v
9
+
| ||___________- help: consider removing 5 leading `&`-references
10
+
LL | | .iter()
11
+
LL | | .enumerate() {
12
+
| |_____________________^ `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator; maybe try calling `.iter()` or a similar method
13
+
|
14
+
= help: the trait `std::iter::Iterator` is not implemented for `&&&&&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>`
15
+
= note: required by `std::iter::IntoIterator::into_iter`
16
+
17
+
error: aborting due to previous error
18
+
19
+
For more information about this error, try `rustc --explain E0277`.
0 commit comments