diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-09-04 00:20:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-04 00:20:39 +0200 |
| commit | bd9750fd2ad7edee3c4cb28b42596ceacb5813a3 (patch) | |
| tree | dd0e688052f26a188c5f08c20b1dfb181fc367bf /src | |
| parent | 84f0c3f79a85329dd79a54694ff8a7f427c842e9 (diff) | |
| parent | 12a49523697f4a64609558b467c460b9a4b333c1 (diff) | |
| download | rust-bd9750fd2ad7edee3c4cb28b42596ceacb5813a3.tar.gz rust-bd9750fd2ad7edee3c4cb28b42596ceacb5813a3.zip | |
Rollup merge of #100302 - compiler-errors:deref-path-methods, r=jackh726
Suggest associated method on deref types when path syntax method fails Fixes #100278
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/suggestions/deref-path-method.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/suggestions/deref-path-method.stderr | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/deref-path-method.rs b/src/test/ui/suggestions/deref-path-method.rs new file mode 100644 index 00000000000..0281cdb6b37 --- /dev/null +++ b/src/test/ui/suggestions/deref-path-method.rs @@ -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 `[_]` +} diff --git a/src/test/ui/suggestions/deref-path-method.stderr b/src/test/ui/suggestions/deref-path-method.stderr new file mode 100644 index 00000000000..1cc37d61151 --- /dev/null +++ b/src/test/ui/suggestions/deref-path-method.stderr @@ -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`. |
