diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-07-14 02:18:24 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-07-14 02:28:43 +0500 |
| commit | b7d024b05622702df0b8f0eb7d67c9e7b534b9ea (patch) | |
| tree | 492b94971d7ec6ad9355de0b8d29c7528dc4aeb9 /tests/ui/shadowed | |
| parent | 56835d7ac14da9f966e1ff39fd9ffd2e29b764d1 (diff) | |
| download | rust-b7d024b05622702df0b8f0eb7d67c9e7b534b9ea.tar.gz rust-b7d024b05622702df0b8f0eb7d67c9e7b534b9ea.zip | |
moved tests
Diffstat (limited to 'tests/ui/shadowed')
| -rw-r--r-- | tests/ui/shadowed/shadowing-generic-item.rs | 13 | ||||
| -rw-r--r-- | tests/ui/shadowed/shadowing-generic-item.stderr | 22 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/ui/shadowed/shadowing-generic-item.rs b/tests/ui/shadowed/shadowing-generic-item.rs new file mode 100644 index 00000000000..46cfdf1efa8 --- /dev/null +++ b/tests/ui/shadowed/shadowing-generic-item.rs @@ -0,0 +1,13 @@ +struct T { i: i32 } +fn f<T>() { + let t = T { i: 0 }; //~ ERROR expected struct, variant or union type, found type parameter `T` +} + +mod Foo { + pub fn f() {} +} +fn g<Foo>() { + Foo::f(); //~ ERROR no function or associated item named `f` +} + +fn main() {} diff --git a/tests/ui/shadowed/shadowing-generic-item.stderr b/tests/ui/shadowed/shadowing-generic-item.stderr new file mode 100644 index 00000000000..f0eaa1a5c64 --- /dev/null +++ b/tests/ui/shadowed/shadowing-generic-item.stderr @@ -0,0 +1,22 @@ +error[E0574]: expected struct, variant or union type, found type parameter `T` + --> $DIR/lexical-scopes.rs:3:13 + | +LL | struct T { i: i32 } + | - you might have meant to refer to this struct +LL | fn f<T>() { + | - found this type parameter +LL | let t = T { i: 0 }; + | ^ not a struct, variant or union type + +error[E0599]: no function or associated item named `f` found for type parameter `Foo` in the current scope + --> $DIR/lexical-scopes.rs:10:10 + | +LL | fn g<Foo>() { + | --- function or associated item `f` not found for this type parameter +LL | Foo::f(); + | ^ function or associated item not found in `Foo` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0574, E0599. +For more information about an error, try `rustc --explain E0574`. |
