diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-16 21:53:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-16 21:53:06 +0200 |
| commit | 7be15b850ffd180f7cf178d055c5516bd923b952 (patch) | |
| tree | aed05f1543bc7681e44a65326b0f74366ce3fed3 /tests | |
| parent | 3a22be33db27e4f90e95dfaad301af400386efc1 (diff) | |
| parent | 29f31c58e9428ee6ad6c2faf2c391eea782f020d (diff) | |
| download | rust-7be15b850ffd180f7cf178d055c5516bd923b952.tar.gz rust-7be15b850ffd180f7cf178d055c5516bd923b952.zip | |
Rollup merge of #130033 - compiler-errors:foreign-fn-types, r=BoxyUwU
Don't call `fn_arg_names` query for non-`fn` foreign items in resolver Fixes #130015
Diffstat (limited to 'tests')
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/resolve/auxiliary/foreign-trait-with-assoc.rs b/tests/ui/resolve/auxiliary/foreign-trait-with-assoc.rs new file mode 100644 index 00000000000..952957ec480 --- /dev/null +++ b/tests/ui/resolve/auxiliary/foreign-trait-with-assoc.rs @@ -0,0 +1,3 @@ +pub trait Foo { + type Bar; +} diff --git a/tests/ui/resolve/dont-compute-arg-names-for-non-fn.rs b/tests/ui/resolve/dont-compute-arg-names-for-non-fn.rs new file mode 100644 index 00000000000..20bbbff8fd2 --- /dev/null +++ b/tests/ui/resolve/dont-compute-arg-names-for-non-fn.rs @@ -0,0 +1,11 @@ +//@ aux-build:foreign-trait-with-assoc.rs + +extern crate foreign_trait_with_assoc; +use foreign_trait_with_assoc::Foo; + +// Make sure we don't try to call `fn_arg_names` on a non-fn item. + +impl Foo for Bar {} +//~^ ERROR cannot find type `Bar` in this scope + +fn main() {} diff --git a/tests/ui/resolve/dont-compute-arg-names-for-non-fn.stderr b/tests/ui/resolve/dont-compute-arg-names-for-non-fn.stderr new file mode 100644 index 00000000000..a1a8bb575e1 --- /dev/null +++ b/tests/ui/resolve/dont-compute-arg-names-for-non-fn.stderr @@ -0,0 +1,14 @@ +error[E0412]: cannot find type `Bar` in this scope + --> $DIR/dont-compute-arg-names-for-non-fn.rs:8:14 + | +LL | impl Foo for Bar {} + | ^^^ + | +help: you might have meant to use the associated type + | +LL | impl Foo for Self::Bar {} + | ++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. |
