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#153662 - estebank:suggest-fully-qualified-path, r=davidtwco
Suggest fully qualified path on method name collision
Provide suggestion for using a fully qualified path when method names collide between traits and inherent impl.
```
error[E0061]: this method takes 0 arguments but 1 argument was supplied
--> $DIR/shadowed-intrinsic-method.rs:20:7
|
LL | a.borrow(());
| ^^^^^^ -- unexpected argument of type `()`
|
note: the `borrow` call is resolved to the method in `std::borrow::Borrow`, shadowing the method of the same name on the inherent impl for `A`
--> $DIR/shadowed-intrinsic-method.rs:20:7
|
LL | use std::borrow::Borrow;
| ------------------- `std::borrow::Borrow` imported here
...
LL | a.borrow(());
| ^^^^^^ refers to `std::borrow::Borrow::borrow`
note: method defined here
--> $SRC_DIR/core/src/borrow.rs:LL:COL
help: you might have meant to call the other method; you can use the fully-qualified path to call it explicitly
|
LL - a.borrow(());
LL + A::borrow(&mut a, ());
|
help: remove the extra argument
|
LL - a.borrow(());
LL + a.borrow();
|
```
Fixrust-lang#54103.
error[E0061]: this method takes 0 arguments but 1 argument was supplied
2
+
--> $DIR/shadowed-intrinsic-method.rs:20:7
3
+
|
4
+
LL | a.borrow(());
5
+
| ^^^^^^ -- unexpected argument of type `()`
6
+
|
7
+
note: the `borrow` call is resolved to the method in `std::borrow::Borrow`, shadowing the method of the same name on the inherent impl for `A`
8
+
--> $DIR/shadowed-intrinsic-method.rs:20:7
9
+
|
10
+
LL | use std::borrow::Borrow;
11
+
| ------------------- `std::borrow::Borrow` imported here
12
+
...
13
+
LL | a.borrow(());
14
+
| ^^^^^^ refers to `std::borrow::Borrow::borrow`
15
+
note: method defined here
16
+
--> $SRC_DIR/core/src/borrow.rs:LL:COL
17
+
help: you might have meant to call the other method; you can use the fully-qualified path to call it explicitly
18
+
|
19
+
LL - a.borrow(());
20
+
LL + A::borrow(&mut a, ());
21
+
|
22
+
help: remove the extra argument
23
+
|
24
+
LL - a.borrow(());
25
+
LL + a.borrow();
26
+
|
27
+
28
+
error[E0061]: this method takes 0 arguments but 1 argument was supplied
29
+
--> $DIR/shadowed-intrinsic-method.rs:23:7
30
+
|
31
+
LL | b.borrow(());
32
+
| ^^^^^^ -- unexpected argument of type `()`
33
+
|
34
+
note: the `borrow` call is resolved to the method in `std::borrow::Borrow`, shadowing the method of the same name on the inherent impl for `main::<impl B>`
35
+
--> $DIR/shadowed-intrinsic-method.rs:23:7
36
+
|
37
+
LL | use std::borrow::Borrow;
38
+
| ------------------- `std::borrow::Borrow` imported here
39
+
...
40
+
LL | b.borrow(());
41
+
| ^^^^^^ refers to `std::borrow::Borrow::borrow`
42
+
note: method defined here
43
+
--> $SRC_DIR/core/src/borrow.rs:LL:COL
44
+
help: you might have meant to call the other method; you can use the fully-qualified path to call it explicitly
45
+
|
46
+
LL - b.borrow(());
47
+
LL + B::borrow(&mut b, ());
48
+
|
49
+
help: remove the extra argument
50
+
|
51
+
LL - b.borrow(());
52
+
LL + b.borrow();
53
+
|
54
+
55
+
error[E0061]: this method takes 0 arguments but 1 argument was supplied
56
+
--> $DIR/shadowed-intrinsic-method.rs:27:7
57
+
|
58
+
LL | c.borrow(());
59
+
| ^^^^^^ -- unexpected argument of type `()`
60
+
|
61
+
note: the `borrow` call is resolved to the method in `std::borrow::Borrow`, shadowing the method of the same name on the inherent impl for `main::C`
62
+
--> $DIR/shadowed-intrinsic-method.rs:27:7
63
+
|
64
+
LL | use std::borrow::Borrow;
65
+
| ------------------- `std::borrow::Borrow` imported here
66
+
...
67
+
LL | c.borrow(());
68
+
| ^^^^^^ refers to `std::borrow::Borrow::borrow`
69
+
note: method defined here
70
+
--> $SRC_DIR/core/src/borrow.rs:LL:COL
71
+
help: you might have meant to call the other method; you can use the fully-qualified path to call it explicitly
72
+
|
73
+
LL - c.borrow(());
74
+
LL + C::borrow(&mut c, ());
75
+
|
76
+
help: remove the extra argument
77
+
|
78
+
LL - c.borrow(());
79
+
LL + c.borrow();
80
+
|
81
+
82
+
error[E0061]: this method takes 0 arguments but 1 argument was supplied
83
+
--> $DIR/shadowed-intrinsic-method.rs:34:7
84
+
|
85
+
LL | b.borrow(());
86
+
| ^^^^^^ -- unexpected argument of type `()`
87
+
|
88
+
note: the `borrow` call is resolved to the method in `std::borrow::Borrow`, shadowing the method of the same name on the inherent impl for `main::<impl B>`
89
+
--> $DIR/shadowed-intrinsic-method.rs:34:7
90
+
|
91
+
LL | use std::borrow::Borrow;
92
+
| ------------------- `std::borrow::Borrow` imported here
93
+
...
94
+
LL | b.borrow(());
95
+
| ^^^^^^ refers to `std::borrow::Borrow::borrow`
96
+
note: method defined here
97
+
--> $SRC_DIR/core/src/borrow.rs:LL:COL
98
+
help: you might have meant to call the other method; you can use the fully-qualified path to call it explicitly
99
+
|
100
+
LL - b.borrow(());
101
+
LL + B::borrow(&mut b, ());
102
+
|
103
+
help: remove the extra argument
104
+
|
105
+
LL - b.borrow(());
106
+
LL + b.borrow();
107
+
|
108
+
109
+
error: aborting due to 4 previous errors
110
+
111
+
For more information about this error, try `rustc --explain E0061`.
0 commit comments