diff options
Diffstat (limited to 'tests/ui/resolve')
-rw-r--r-- | tests/ui/resolve/explicit-self-lowercase-param.rs | 8 | ||||
-rw-r--r-- | tests/ui/resolve/explicit-self-lowercase-param.stderr | 8 | ||||
-rw-r--r-- | tests/ui/resolve/issue-109250.rs | 3 | ||||
-rw-r--r-- | tests/ui/resolve/issue-109250.stderr | 14 | ||||
-rw-r--r-- | tests/ui/resolve/issue-111312.rs | 11 | ||||
-rw-r--r-- | tests/ui/resolve/issue-111312.stderr | 15 | ||||
-rw-r--r-- | tests/ui/resolve/issue-111727.rs | 5 | ||||
-rw-r--r-- | tests/ui/resolve/issue-111727.stderr | 9 | ||||
-rw-r--r-- | tests/ui/resolve/issue-3099-a.rs | 5 | ||||
-rw-r--r-- | tests/ui/resolve/issue-3099-a.stderr | 14 | ||||
-rw-r--r-- | tests/ui/resolve/issue-3099-b.rs | 5 | ||||
-rw-r--r-- | tests/ui/resolve/issue-3099-b.stderr | 14 | ||||
-rw-r--r-- | tests/ui/resolve/issue-50599.rs | 1 | ||||
-rw-r--r-- | tests/ui/resolve/issue-50599.stderr | 6 | ||||
-rw-r--r-- | tests/ui/resolve/resolve-variant-assoc-item.stderr | 14 |
15 files changed, 125 insertions, 7 deletions
diff --git a/tests/ui/resolve/explicit-self-lowercase-param.rs b/tests/ui/resolve/explicit-self-lowercase-param.rs new file mode 100644 index 000000000..7171bd8a4 --- /dev/null +++ b/tests/ui/resolve/explicit-self-lowercase-param.rs @@ -0,0 +1,8 @@ +struct Foo; + +impl Foo { + fn do_nothing(self: Box<self>) {} //~ ERROR attempt to use a non-constant value in a constant + //~^ HELP try using `Self` +} + +fn main() {} diff --git a/tests/ui/resolve/explicit-self-lowercase-param.stderr b/tests/ui/resolve/explicit-self-lowercase-param.stderr new file mode 100644 index 000000000..cd64dbb38 --- /dev/null +++ b/tests/ui/resolve/explicit-self-lowercase-param.stderr @@ -0,0 +1,8 @@ +error: attempt to use a non-constant value in a constant + --> $DIR/explicit-self-lowercase-param.rs:4:29 + | +LL | fn do_nothing(self: Box<self>) {} + | ^^^^ help: try using `Self` + +error: aborting due to previous error + diff --git a/tests/ui/resolve/issue-109250.rs b/tests/ui/resolve/issue-109250.rs new file mode 100644 index 000000000..68e33f693 --- /dev/null +++ b/tests/ui/resolve/issue-109250.rs @@ -0,0 +1,3 @@ +fn main() { //~ HELP consider importing + HashMap::new; //~ ERROR failed to resolve: use of undeclared type `HashMap` +} diff --git a/tests/ui/resolve/issue-109250.stderr b/tests/ui/resolve/issue-109250.stderr new file mode 100644 index 000000000..d5b8c08ce --- /dev/null +++ b/tests/ui/resolve/issue-109250.stderr @@ -0,0 +1,14 @@ +error[E0433]: failed to resolve: use of undeclared type `HashMap` + --> $DIR/issue-109250.rs:2:5 + | +LL | HashMap::new; + | ^^^^^^^ use of undeclared type `HashMap` + | +help: consider importing this struct + | +LL + use std::collections::HashMap; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/resolve/issue-111312.rs b/tests/ui/resolve/issue-111312.rs new file mode 100644 index 000000000..acea37b35 --- /dev/null +++ b/tests/ui/resolve/issue-111312.rs @@ -0,0 +1,11 @@ +// edition: 2021 + +trait Has { + fn has() {} +} + +trait HasNot {} + +fn main() { + HasNot::has(); //~ ERROR +} diff --git a/tests/ui/resolve/issue-111312.stderr b/tests/ui/resolve/issue-111312.stderr new file mode 100644 index 000000000..4c864029c --- /dev/null +++ b/tests/ui/resolve/issue-111312.stderr @@ -0,0 +1,15 @@ +error[E0599]: no function or associated item named `has` found for trait `HasNot` + --> $DIR/issue-111312.rs:10:13 + | +LL | HasNot::has(); + | ^^^ function or associated item not found in `HasNot` + | +note: `Has` defines an item `has` + --> $DIR/issue-111312.rs:3:1 + | +LL | trait Has { + | ^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/resolve/issue-111727.rs b/tests/ui/resolve/issue-111727.rs new file mode 100644 index 000000000..36f308121 --- /dev/null +++ b/tests/ui/resolve/issue-111727.rs @@ -0,0 +1,5 @@ +// edition: 2021 + +fn main() { + std::any::Any::create(); //~ ERROR +} diff --git a/tests/ui/resolve/issue-111727.stderr b/tests/ui/resolve/issue-111727.stderr new file mode 100644 index 000000000..bd748211e --- /dev/null +++ b/tests/ui/resolve/issue-111727.stderr @@ -0,0 +1,9 @@ +error[E0599]: no function or associated item named `create` found for trait `Any` + --> $DIR/issue-111727.rs:4:20 + | +LL | std::any::Any::create(); + | ^^^^^^ function or associated item not found in `Any` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/resolve/issue-3099-a.rs b/tests/ui/resolve/issue-3099-a.rs new file mode 100644 index 000000000..9c3d8cf5a --- /dev/null +++ b/tests/ui/resolve/issue-3099-a.rs @@ -0,0 +1,5 @@ +enum A { B, C } + +enum A { D, E } //~ ERROR the name `A` is defined multiple times + +fn main() {} diff --git a/tests/ui/resolve/issue-3099-a.stderr b/tests/ui/resolve/issue-3099-a.stderr new file mode 100644 index 000000000..e3733cebb --- /dev/null +++ b/tests/ui/resolve/issue-3099-a.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `A` is defined multiple times + --> $DIR/issue-3099-a.rs:3:1 + | +LL | enum A { B, C } + | ------ previous definition of the type `A` here +LL | +LL | enum A { D, E } + | ^^^^^^ `A` redefined here + | + = note: `A` must be defined only once in the type namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/resolve/issue-3099-b.rs b/tests/ui/resolve/issue-3099-b.rs new file mode 100644 index 000000000..71952c3b0 --- /dev/null +++ b/tests/ui/resolve/issue-3099-b.rs @@ -0,0 +1,5 @@ +pub mod a {} + +pub mod a {} //~ ERROR the name `a` is defined multiple times + +fn main() {} diff --git a/tests/ui/resolve/issue-3099-b.stderr b/tests/ui/resolve/issue-3099-b.stderr new file mode 100644 index 000000000..c0cfefeb9 --- /dev/null +++ b/tests/ui/resolve/issue-3099-b.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `a` is defined multiple times + --> $DIR/issue-3099-b.rs:3:1 + | +LL | pub mod a {} + | --------- previous definition of the module `a` here +LL | +LL | pub mod a {} + | ^^^^^^^^^ `a` redefined here + | + = note: `a` must be defined only once in the type namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/resolve/issue-50599.rs b/tests/ui/resolve/issue-50599.rs index 72238a591..00588735b 100644 --- a/tests/ui/resolve/issue-50599.rs +++ b/tests/ui/resolve/issue-50599.rs @@ -2,5 +2,4 @@ fn main() { const N: u32 = 1_000; const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value let mut digits = [0u32; M]; - //~^ constant } diff --git a/tests/ui/resolve/issue-50599.stderr b/tests/ui/resolve/issue-50599.stderr index d7419b64f..d58b6ca5b 100644 --- a/tests/ui/resolve/issue-50599.stderr +++ b/tests/ui/resolve/issue-50599.stderr @@ -16,12 +16,6 @@ LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; LL + const M: usize = (f64::from(N) * LOG10_2) as usize; | -note: erroneous constant used - --> $DIR/issue-50599.rs:4:29 - | -LL | let mut digits = [0u32; M]; - | ^ - error: aborting due to previous error For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/resolve/resolve-variant-assoc-item.stderr b/tests/ui/resolve/resolve-variant-assoc-item.stderr index 4be101996..ed157197d 100644 --- a/tests/ui/resolve/resolve-variant-assoc-item.stderr +++ b/tests/ui/resolve/resolve-variant-assoc-item.stderr @@ -3,12 +3,26 @@ error[E0433]: failed to resolve: `V` is a variant, not a module | LL | E::V::associated_item; | ^ `V` is a variant, not a module + | +help: there is an enum variant `E::V`; try using the variant's enum + | +LL | E; + | ~ error[E0433]: failed to resolve: `V` is a variant, not a module --> $DIR/resolve-variant-assoc-item.rs:6:5 | LL | V::associated_item; | ^ `V` is a variant, not a module + | +help: there is an enum variant `E::V`; try using the variant's enum + | +LL | E; + | ~ +help: an enum with a similar name exists + | +LL | E::associated_item; + | ~ error: aborting due to 2 previous errors |