diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
commit | a4b7ed7a42c716ab9f05e351f003d589124fd55d (patch) | |
tree | b620cd3f223850b28716e474e80c58059dca5dd4 /src/test/ui/repeat-expr | |
parent | Adding upstream version 1.67.1+dfsg1. (diff) | |
download | rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip |
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/repeat-expr')
-rw-r--r-- | src/test/ui/repeat-expr/infer.rs | 16 | ||||
-rw-r--r-- | src/test/ui/repeat-expr/repeat-expr-in-static.rs | 8 | ||||
-rw-r--r-- | src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs | 19 | ||||
-rw-r--r-- | src/test/ui/repeat-expr/repeat-to-run-dtor-twice.stderr | 15 | ||||
-rw-r--r-- | src/test/ui/repeat-expr/repeat_count.rs | 34 | ||||
-rw-r--r-- | src/test/ui/repeat-expr/repeat_count.stderr | 69 |
6 files changed, 0 insertions, 161 deletions
diff --git a/src/test/ui/repeat-expr/infer.rs b/src/test/ui/repeat-expr/infer.rs deleted file mode 100644 index 8197713b9..000000000 --- a/src/test/ui/repeat-expr/infer.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass - -#[derive(Clone, Default)] -struct MaybeCopy<T>(T); - -impl Copy for MaybeCopy<u8> {} - -fn is_copy<T: Copy>(x: T) { - println!("{}", std::any::type_name::<T>()); -} - -fn main() { - is_copy(MaybeCopy::default()); - [MaybeCopy::default(); 13]; - // didn't work, because `Copy` was only checked in the mir -} diff --git a/src/test/ui/repeat-expr/repeat-expr-in-static.rs b/src/test/ui/repeat-expr/repeat-expr-in-static.rs deleted file mode 100644 index 0b8953793..000000000 --- a/src/test/ui/repeat-expr/repeat-expr-in-static.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass - -static FOO: [isize; 4] = [32; 4]; -static BAR: [isize; 4] = [32, 32, 32, 32]; - -pub fn main() { - assert_eq!(FOO, BAR); -} diff --git a/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs b/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs deleted file mode 100644 index 0cd8eceef..000000000 --- a/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Tests that one can't run a destructor twice with the repeated vector -// literal syntax. - -struct Foo { - x: isize, - -} - -impl Drop for Foo { - fn drop(&mut self) { - println!("Goodbye!"); - } -} - -fn main() { - let a = Foo { x: 3 }; - let _ = [ a; 5 ]; - //~^ ERROR the trait bound `Foo: Copy` is not satisfied [E0277] -} diff --git a/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.stderr b/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.stderr deleted file mode 100644 index 36b936163..000000000 --- a/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0277]: the trait bound `Foo: Copy` is not satisfied - --> $DIR/repeat-to-run-dtor-twice.rs:17:15 - | -LL | let _ = [ a; 5 ]; - | ^ the trait `Copy` is not implemented for `Foo` - | - = note: the `Copy` trait is required because this value will be copied for each element of the array -help: consider annotating `Foo` with `#[derive(Copy)]` - | -LL | #[derive(Copy)] - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/repeat-expr/repeat_count.rs b/src/test/ui/repeat-expr/repeat_count.rs deleted file mode 100644 index 96abff4ab..000000000 --- a/src/test/ui/repeat-expr/repeat_count.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Regression test for issue #3645 - -fn main() { - let n = 1; - let a = [0; n]; - //~^ ERROR attempt to use a non-constant value in a constant [E0435] - let b = [0; ()]; - //~^ ERROR mismatched types - //~| expected `usize`, found `()` - let c = [0; true]; - //~^ ERROR mismatched types - //~| expected `usize`, found `bool` - let d = [0; 0.5]; - //~^ ERROR mismatched types - //~| expected `usize`, found floating-point number - let e = [0; "foo"]; - //~^ ERROR mismatched types - //~| expected `usize`, found `&str` - let f = [0; -4_isize]; - //~^ ERROR mismatched types - //~| expected `usize`, found `isize` - let f = [0_usize; -1_isize]; - //~^ ERROR mismatched types - //~| expected `usize`, found `isize` - let f = [0; 4u8]; - //~^ ERROR mismatched types - //~| expected `usize`, found `u8` - struct G { - g: (), - } - let g = [0; G { g: () }]; - //~^ ERROR mismatched types - //~| expected `usize`, found struct `G` -} diff --git a/src/test/ui/repeat-expr/repeat_count.stderr b/src/test/ui/repeat-expr/repeat_count.stderr deleted file mode 100644 index e222c141f..000000000 --- a/src/test/ui/repeat-expr/repeat_count.stderr +++ /dev/null @@ -1,69 +0,0 @@ -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/repeat_count.rs:5:17 - | -LL | let n = 1; - | ----- help: consider using `const` instead of `let`: `const n` -LL | let a = [0; n]; - | ^ non-constant value - -error[E0308]: mismatched types - --> $DIR/repeat_count.rs:7:17 - | -LL | let b = [0; ()]; - | ^^ expected `usize`, found `()` - -error[E0308]: mismatched types - --> $DIR/repeat_count.rs:10:17 - | -LL | let c = [0; true]; - | ^^^^ expected `usize`, found `bool` - -error[E0308]: mismatched types - --> $DIR/repeat_count.rs:13:17 - | -LL | let d = [0; 0.5]; - | ^^^ expected `usize`, found floating-point number - -error[E0308]: mismatched types - --> $DIR/repeat_count.rs:16:17 - | -LL | let e = [0; "foo"]; - | ^^^^^ expected `usize`, found `&str` - -error[E0308]: mismatched types - --> $DIR/repeat_count.rs:31:17 - | -LL | let g = [0; G { g: () }]; - | ^^^^^^^^^^^ expected `usize`, found struct `G` - -error[E0308]: mismatched types - --> $DIR/repeat_count.rs:19:17 - | -LL | let f = [0; -4_isize]; - | ^^^^^^^^ expected `usize`, found `isize` - | - = note: `-4_isize` cannot fit into type `usize` - -error[E0308]: mismatched types - --> $DIR/repeat_count.rs:22:23 - | -LL | let f = [0_usize; -1_isize]; - | ^^^^^^^^ expected `usize`, found `isize` - | - = note: `-1_isize` cannot fit into type `usize` - -error[E0308]: mismatched types - --> $DIR/repeat_count.rs:25:17 - | -LL | let f = [0; 4u8]; - | ^^^ expected `usize`, found `u8` - | -help: change the type of the numeric literal from `u8` to `usize` - | -LL | let f = [0; 4usize]; - | ~~~~~ - -error: aborting due to 9 previous errors - -Some errors have detailed explanations: E0308, E0435. -For more information about an error, try `rustc --explain E0308`. |