From 246f239d9f40f633160f0c18f87a20922d4e77bb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:37 +0200 Subject: Merging debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- .../ui/tuple/add-tuple-within-arguments.stderr | 4 +- src/test/ui/tuple/builtin-fail.rs | 19 ++++++++ src/test/ui/tuple/builtin-fail.stderr | 55 ++++++++++++++++++++++ src/test/ui/tuple/builtin.rs | 20 ++++++++ src/test/ui/tuple/wrong_argument_ice-3.stderr | 11 +++-- src/test/ui/tuple/wrong_argument_ice-4.stderr | 2 +- 6 files changed, 104 insertions(+), 7 deletions(-) create mode 100644 src/test/ui/tuple/builtin-fail.rs create mode 100644 src/test/ui/tuple/builtin-fail.stderr create mode 100644 src/test/ui/tuple/builtin.rs (limited to 'src/test/ui/tuple') diff --git a/src/test/ui/tuple/add-tuple-within-arguments.stderr b/src/test/ui/tuple/add-tuple-within-arguments.stderr index 95df96ca0..7029d298d 100644 --- a/src/test/ui/tuple/add-tuple-within-arguments.stderr +++ b/src/test/ui/tuple/add-tuple-within-arguments.stderr @@ -8,7 +8,7 @@ note: function defined here --> $DIR/add-tuple-within-arguments.rs:1:4 | LL | fn foo(s: &str, a: (i32, i32), s2: &str) {} - | ^^^ ------- ------------- -------- + | ^^^ ------------- help: wrap these arguments in parentheses to construct a tuple | LL | foo("hi", (1, 2), "hi"); @@ -28,7 +28,7 @@ note: function defined here --> $DIR/add-tuple-within-arguments.rs:3:4 | LL | fn bar(s: &str, a: (&str,), s2: &str) {} - | ^^^ ------- ---------- -------- + | ^^^ ---------- help: use a trailing comma to create a tuple with one element | LL | bar("hi", ("hi",), "hi"); diff --git a/src/test/ui/tuple/builtin-fail.rs b/src/test/ui/tuple/builtin-fail.rs new file mode 100644 index 000000000..312080961 --- /dev/null +++ b/src/test/ui/tuple/builtin-fail.rs @@ -0,0 +1,19 @@ +#![feature(tuple_trait)] + +fn assert_is_tuple() {} + +struct TupleStruct(i32, i32); + +fn from_param_env() { + assert_is_tuple::(); + //~^ ERROR `T` is not a tuple +} + +fn main() { + assert_is_tuple::(); + //~^ ERROR `i32` is not a tuple + assert_is_tuple::<(i32)>(); + //~^ ERROR `i32` is not a tuple + assert_is_tuple::(); + //~^ ERROR `TupleStruct` is not a tuple +} diff --git a/src/test/ui/tuple/builtin-fail.stderr b/src/test/ui/tuple/builtin-fail.stderr new file mode 100644 index 000000000..e3e29a73f --- /dev/null +++ b/src/test/ui/tuple/builtin-fail.stderr @@ -0,0 +1,55 @@ +error[E0277]: `T` is not a tuple + --> $DIR/builtin-fail.rs:8:23 + | +LL | assert_is_tuple::(); + | ^ the trait `Tuple` is not implemented for `T` + | +note: required by a bound in `assert_is_tuple` + --> $DIR/builtin-fail.rs:3:23 + | +LL | fn assert_is_tuple() {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` +help: consider restricting type parameter `T` + | +LL | fn from_param_env() { + | ++++++++++++++++++++ + +error[E0277]: `i32` is not a tuple + --> $DIR/builtin-fail.rs:13:23 + | +LL | assert_is_tuple::(); + | ^^^ the trait `Tuple` is not implemented for `i32` + | +note: required by a bound in `assert_is_tuple` + --> $DIR/builtin-fail.rs:3:23 + | +LL | fn assert_is_tuple() {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` + +error[E0277]: `i32` is not a tuple + --> $DIR/builtin-fail.rs:15:24 + | +LL | assert_is_tuple::<(i32)>(); + | ^^^ the trait `Tuple` is not implemented for `i32` + | +note: required by a bound in `assert_is_tuple` + --> $DIR/builtin-fail.rs:3:23 + | +LL | fn assert_is_tuple() {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` + +error[E0277]: `TupleStruct` is not a tuple + --> $DIR/builtin-fail.rs:17:23 + | +LL | assert_is_tuple::(); + | ^^^^^^^^^^^ the trait `Tuple` is not implemented for `TupleStruct` + | +note: required by a bound in `assert_is_tuple` + --> $DIR/builtin-fail.rs:3:23 + | +LL | fn assert_is_tuple() {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/tuple/builtin.rs b/src/test/ui/tuple/builtin.rs new file mode 100644 index 000000000..d87ce5263 --- /dev/null +++ b/src/test/ui/tuple/builtin.rs @@ -0,0 +1,20 @@ +// check-pass + +#![feature(tuple_trait)] + +fn assert_is_tuple() {} + +struct Unsized([u8]); + +fn from_param_env() { + assert_is_tuple::(); +} + +fn main() { + assert_is_tuple::<()>(); + assert_is_tuple::<(i32,)>(); + assert_is_tuple::<(Unsized,)>(); + from_param_env::<()>(); + from_param_env::<(i32,)>(); + from_param_env::<(Unsized,)>(); +} diff --git a/src/test/ui/tuple/wrong_argument_ice-3.stderr b/src/test/ui/tuple/wrong_argument_ice-3.stderr index 2733fb314..f3a547fa2 100644 --- a/src/test/ui/tuple/wrong_argument_ice-3.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-3.stderr @@ -2,10 +2,13 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/wrong_argument_ice-3.rs:9:16 | LL | groups.push(new_group, vec![process]); - | ^^^^ --------- ------------- argument of type `Vec<&Process>` unexpected - | | - | expected tuple, found struct `Vec` + | ^^^^ ------------- argument of type `Vec<&Process>` unexpected | +note: expected tuple, found struct `Vec` + --> $DIR/wrong_argument_ice-3.rs:9:21 + | +LL | groups.push(new_group, vec![process]); + | ^^^^^^^^^ = note: expected tuple `(Vec, Vec)` found struct `Vec` note: associated function defined here @@ -16,7 +19,7 @@ LL | pub fn push(&mut self, value: T) { help: remove the extra argument | LL | groups.push(/* (Vec, Vec) */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/tuple/wrong_argument_ice-4.stderr b/src/test/ui/tuple/wrong_argument_ice-4.stderr index 828ae21b4..a2686ab94 100644 --- a/src/test/ui/tuple/wrong_argument_ice-4.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-4.stderr @@ -16,7 +16,7 @@ LL | (|| {})(|| { help: remove the extra argument | LL | (|| {})(); - | ~~~~~~~~~ + | ~~ error: aborting due to previous error -- cgit v1.2.3