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#96372 - compiler-errors:field-method-suggest, r=oli-obk
Suggest calling method on nested field when struct is missing method
Similar to the suggestion to change `x.field` to `x.nested.field`, implement a similar suggestion for when `x.method()` should be replaced with `x.nested.method()`.
Copy file name to clipboardExpand all lines: src/test/ui/hrtb/issue-30786.migrate.stderr
+8
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,10 @@ note: the following trait bounds were not satisfied:
18
18
|
19
19
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
20
20
| --------- - ^^^^^^ unsatisfied trait bound introduced here
21
+
help: one of the expressions' fields has a method of the same name
22
+
|
23
+
LL | let filter = map.stream.filterx(|x: &_| true);
24
+
| +++++++
21
25
22
26
error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>`, but its trait bounds were not satisfied
23
27
--> $DIR/issue-30786.rs:140:24
@@ -39,6 +43,10 @@ note: the following trait bounds were not satisfied:
39
43
|
40
44
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
41
45
| --------- - ^^^^^^ unsatisfied trait bound introduced here
46
+
help: one of the expressions' fields has a method of the same name
Copy file name to clipboardExpand all lines: src/test/ui/hrtb/issue-30786.nll.stderr
+8
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,10 @@ note: the following trait bounds were not satisfied:
18
18
|
19
19
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
20
20
| --------- - ^^^^^^ unsatisfied trait bound introduced here
21
+
help: one of the expressions' fields has a method of the same name
22
+
|
23
+
LL | let filter = map.stream.filterx(|x: &_| true);
24
+
| +++++++
21
25
22
26
error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>`, but its trait bounds were not satisfied
23
27
--> $DIR/issue-30786.rs:140:24
@@ -39,6 +43,10 @@ note: the following trait bounds were not satisfied:
39
43
|
40
44
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
41
45
| --------- - ^^^^^^ unsatisfied trait bound introduced here
46
+
help: one of the expressions' fields has a method of the same name
0 commit comments