Rollup merge of #100302 - compiler-errors:deref-path-methods, r=jackh726
Suggest associated method on deref types when path syntax method fails Fixes #100278
This commit is contained in:
commit
bd9750fd2a
3 changed files with 80 additions and 2 deletions
6
src/test/ui/suggestions/deref-path-method.rs
Normal file
6
src/test/ui/suggestions/deref-path-method.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
fn main() {
|
||||
let vec = Vec::new();
|
||||
Vec::contains(&vec, &0);
|
||||
//~^ ERROR no function or associated item named `contains` found for struct `Vec<_, _>` in the current scope
|
||||
//~| HELP the function `contains` is implemented on `[_]`
|
||||
}
|
||||
14
src/test/ui/suggestions/deref-path-method.stderr
Normal file
14
src/test/ui/suggestions/deref-path-method.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0599]: no function or associated item named `contains` found for struct `Vec<_, _>` in the current scope
|
||||
--> $DIR/deref-path-method.rs:3:10
|
||||
|
|
||||
LL | Vec::contains(&vec, &0);
|
||||
| ^^^^^^^^ function or associated item not found in `Vec<_, _>`
|
||||
|
|
||||
help: the function `contains` is implemented on `[_]`
|
||||
|
|
||||
LL | <[_]>::contains(&vec, &0);
|
||||
| ~~~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue