From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/missing/missing-items/auxiliary/m1.rs | 9 ++ src/test/ui/missing/missing-items/m2.rs | 12 ++ src/test/ui/missing/missing-items/m2.stderr | 17 +++ .../missing-items/missing-type-parameter.rs | 5 + .../missing-items/missing-type-parameter.stderr | 14 +++ .../missing-items/missing-type-parameter2.rs | 19 ++++ .../missing-items/missing-type-parameter2.stderr | 121 +++++++++++++++++++++ 7 files changed, 197 insertions(+) create mode 100644 src/test/ui/missing/missing-items/auxiliary/m1.rs create mode 100644 src/test/ui/missing/missing-items/m2.rs create mode 100644 src/test/ui/missing/missing-items/m2.stderr create mode 100644 src/test/ui/missing/missing-items/missing-type-parameter.rs create mode 100644 src/test/ui/missing/missing-items/missing-type-parameter.stderr create mode 100644 src/test/ui/missing/missing-items/missing-type-parameter2.rs create mode 100644 src/test/ui/missing/missing-items/missing-type-parameter2.stderr (limited to 'src/test/ui/missing/missing-items') diff --git a/src/test/ui/missing/missing-items/auxiliary/m1.rs b/src/test/ui/missing/missing-items/auxiliary/m1.rs new file mode 100644 index 000000000..fcf52c9e8 --- /dev/null +++ b/src/test/ui/missing/missing-items/auxiliary/m1.rs @@ -0,0 +1,9 @@ +pub trait X { + const CONSTANT: u32; + type Type; + fn method(&self, s: String) -> Self::Type; + fn method2(self: Box, s: String) -> Self::Type; + fn method3(other: &Self, s: String) -> Self::Type; + fn method4(&self, other: &Self) -> Self::Type; + fn method5(self: &Box) -> Self::Type; +} diff --git a/src/test/ui/missing/missing-items/m2.rs b/src/test/ui/missing/missing-items/m2.rs new file mode 100644 index 000000000..c2a6914ab --- /dev/null +++ b/src/test/ui/missing/missing-items/m2.rs @@ -0,0 +1,12 @@ +// aux-build:m1.rs + + +extern crate m1; + +struct X { +} + +impl m1::X for X { //~ ERROR not all trait items implemented +} + +fn main() {} diff --git a/src/test/ui/missing/missing-items/m2.stderr b/src/test/ui/missing/missing-items/m2.stderr new file mode 100644 index 000000000..d18fb443a --- /dev/null +++ b/src/test/ui/missing/missing-items/m2.stderr @@ -0,0 +1,17 @@ +error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method`, `method2`, `method3`, `method4`, `method5` + --> $DIR/m2.rs:9:1 + | +LL | impl m1::X for X { + | ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method`, `method2`, `method3`, `method4`, `method5` in implementation + | + = help: implement the missing item: `const CONSTANT: u32 = 42;` + = help: implement the missing item: `type Type = Type;` + = help: implement the missing item: `fn method(&self, _: String) -> ::Type { todo!() }` + = help: implement the missing item: `fn method2(self: Box, _: String) -> ::Type { todo!() }` + = help: implement the missing item: `fn method3(_: &Self, _: String) -> ::Type { todo!() }` + = help: implement the missing item: `fn method4(&self, _: &Self) -> ::Type { todo!() }` + = help: implement the missing item: `fn method5(self: &Box) -> ::Type { todo!() }` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. diff --git a/src/test/ui/missing/missing-items/missing-type-parameter.rs b/src/test/ui/missing/missing-items/missing-type-parameter.rs new file mode 100644 index 000000000..8a64053a4 --- /dev/null +++ b/src/test/ui/missing/missing-items/missing-type-parameter.rs @@ -0,0 +1,5 @@ +fn foo() { } + +fn main() { + foo(); //~ ERROR type annotations needed +} diff --git a/src/test/ui/missing/missing-items/missing-type-parameter.stderr b/src/test/ui/missing/missing-items/missing-type-parameter.stderr new file mode 100644 index 000000000..722539fca --- /dev/null +++ b/src/test/ui/missing/missing-items/missing-type-parameter.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/missing-type-parameter.rs:4:5 + | +LL | foo(); + | ^^^ cannot infer type of the type parameter `X` declared on the function `foo` + | +help: consider specifying the generic argument + | +LL | foo::(); + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/missing/missing-items/missing-type-parameter2.rs b/src/test/ui/missing/missing-items/missing-type-parameter2.rs new file mode 100644 index 000000000..e9b32fb71 --- /dev/null +++ b/src/test/ui/missing/missing-items/missing-type-parameter2.rs @@ -0,0 +1,19 @@ +struct X(); + +impl X {} +//~^ ERROR cannot find type `N` in this scope +//~| ERROR unresolved item provided when a constant was expected +impl X {} +//~^ ERROR cannot find type `N` in this scope +//~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +//~| ERROR unresolved item provided when a constant was expected + +fn foo(_: T) where T: Send {} +//~^ ERROR cannot find type `T` in this scope +//~| ERROR cannot find type `T` in this scope + +fn bar(_: A) {} +//~^ ERROR cannot find type `A` in this scope + +fn main() { +} diff --git a/src/test/ui/missing/missing-items/missing-type-parameter2.stderr b/src/test/ui/missing/missing-items/missing-type-parameter2.stderr new file mode 100644 index 000000000..f33951c98 --- /dev/null +++ b/src/test/ui/missing/missing-items/missing-type-parameter2.stderr @@ -0,0 +1,121 @@ +error[E0412]: cannot find type `N` in this scope + --> $DIR/missing-type-parameter2.rs:3:8 + | +LL | struct X(); + | ------------------------ similarly named struct `X` defined here +LL | +LL | impl X {} + | ^ + | +help: a struct with a similar name exists + | +LL | impl X {} + | ~ +help: you might be missing a type parameter + | +LL | impl X {} + | +++ + +error[E0412]: cannot find type `N` in this scope + --> $DIR/missing-type-parameter2.rs:6:28 + | +LL | impl X {} + | - ^ + | | + | similarly named type parameter `T` defined here + | +help: a type parameter with a similar name exists + | +LL | impl X {} + | ~ +help: you might be missing a type parameter + | +LL | impl X {} + | +++ + +error[E0412]: cannot find type `T` in this scope + --> $DIR/missing-type-parameter2.rs:11:20 + | +LL | struct X(); + | ------------------------ similarly named struct `X` defined here +... +LL | fn foo(_: T) where T: Send {} + | ^ + | +help: a struct with a similar name exists + | +LL | fn foo(_: T) where X: Send {} + | ~ +help: you might be missing a type parameter + | +LL | fn foo(_: T) where T: Send {} + | +++ + +error[E0412]: cannot find type `T` in this scope + --> $DIR/missing-type-parameter2.rs:11:11 + | +LL | struct X(); + | ------------------------ similarly named struct `X` defined here +... +LL | fn foo(_: T) where T: Send {} + | ^ + | +help: a struct with a similar name exists + | +LL | fn foo(_: X) where T: Send {} + | ~ +help: you might be missing a type parameter + | +LL | fn foo(_: T) where T: Send {} + | +++ + +error[E0412]: cannot find type `A` in this scope + --> $DIR/missing-type-parameter2.rs:15:24 + | +LL | struct X(); + | ------------------------ similarly named struct `X` defined here +... +LL | fn bar(_: A) {} + | ^ + | +help: a struct with a similar name exists + | +LL | fn bar(_: X) {} + | ~ +help: you might be missing a type parameter + | +LL | fn bar(_: A) {} + | +++ + +error[E0747]: unresolved item provided when a constant was expected + --> $DIR/missing-type-parameter2.rs:3:8 + | +LL | impl X {} + | ^ + | +help: if this generic argument was intended as a const parameter, surround it with braces + | +LL | impl X<{ N }> {} + | + + + +error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/missing-type-parameter2.rs:6:9 + | +LL | impl X {} + | ^^^^^^^^^^^^^^^ + +error[E0747]: unresolved item provided when a constant was expected + --> $DIR/missing-type-parameter2.rs:6:28 + | +LL | impl X {} + | ^ + | +help: if this generic argument was intended as a const parameter, surround it with braces + | +LL | impl X<{ N }> {} + | + + + +error: aborting due to 8 previous errors + +Some errors have detailed explanations: E0412, E0747. +For more information about an error, try `rustc --explain E0412`. -- cgit v1.2.3