Commit dd3b825
committed
Do not suggest pinning missing
When suggesting field access which would encounter a method not found, do not suggest pinning when those methods are on `impl Pin` itself.
```
error[E0599]: no method named `get_ref` found for tuple `(BufReader<File>,)` in the current scope
--> $DIR/missing-field-access.rs:11:15
|
LL | let x = f.get_ref();
| ^^^^^^^ method not found in `(BufReader<File>,)`
|
help: one of the expressions' fields has a method of the same name
|
LL | let x = f.0.get_ref();
| ++
```
instead of
```
error[E0599]: no method named `get_ref` found for tuple `(BufReader<File>,)` in the current scope
--> $DIR/missing-field-access.rs:11:15
|
LL | let x = f.get_ref();
| ^^^^^^^ method not found in `(BufReader<File>,)`
|
help: one of the expressions' fields has a method of the same name
|
LL | let x = f.0.get_ref();
| ++
help: consider pinning the expression
|
LL ~ let mut pinned = std::pin::pin!(f);
LL ~ let x = pinned.as_ref().get_ref();
|
```.get_ref()
1 parent 26c12c7 commit dd3b825
File tree
3 files changed
+14
-18
lines changed- compiler/rustc_hir_typeck/src/method
- tests/ui/tuple
3 files changed
+14
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3585 | 3585 | | |
3586 | 3586 | | |
3587 | 3587 | | |
| 3588 | + | |
3588 | 3589 | | |
3589 | 3590 | | |
3590 | 3591 | | |
| |||
3670 | 3671 | | |
3671 | 3672 | | |
3672 | 3673 | | |
3673 | | - | |
| 3674 | + | |
3674 | 3675 | | |
3675 | 3676 | | |
3676 | 3677 | | |
| |||
3734 | 3735 | | |
3735 | 3736 | | |
3736 | 3737 | | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
| 3741 | + | |
| 3742 | + | |
| 3743 | + | |
3737 | 3744 | | |
3738 | 3745 | | |
3739 | 3746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
9 | | - | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 16 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 14 | | |
20 | 15 | | |
21 | | - | |
| 16 | + | |
22 | 17 | | |
23 | 18 | | |
24 | 19 | | |
| |||
27 | 22 | | |
28 | 23 | | |
29 | 24 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 25 | | |
36 | 26 | | |
37 | 27 | | |
| |||
0 commit comments