Bless other tests

This commit is contained in:
mu001999
2026-01-07 00:03:32 +08:00
parent cb1de29659
commit 6c2dc40666
5 changed files with 99 additions and 14 deletions
-9
View File
@@ -1,9 +0,0 @@
//@ known-bug: #133965
//@ needs-rustc-debug-assertions
struct NonGeneric {}
#[derive(Default)]
struct NonGeneric<'a, const N: usize> {}
pub fn main() {}
@@ -14,7 +14,6 @@ trait Bar<const N: usize> {}
trait Bar<const N: dyn BB> {}
//[cfail]~^ ERROR cycle detected when computing type of `Bar::N`
//[cfail]~| ERROR cycle detected when computing type of `Bar::N`
//[cfail]~| ERROR cycle detected when computing type of `Bar::N`
//[cfail]~| ERROR `(dyn Bar<{ 2 + 1 }> + 'static)` is forbidden as the type of a const generic parameter
trait BB = Bar<{ 2 + 1 }>;
@@ -0,0 +1,14 @@
//@ needs-rustc-debug-assertions
struct NonGeneric {}
#[derive(Default)]
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^^ ERROR struct takes 0 generic arguments but 1 generic argument was supplied
//~^^^^ ERROR struct takes 0 generic arguments but 1 generic argument was supplied
struct NonGeneric<'a, const N: usize> {}
//~^ ERROR lifetime parameter `'a` is never used
//~^^ ERROR the name `NonGeneric` is defined multiple times
pub fn main() {}
@@ -0,0 +1,81 @@
error[E0428]: the name `NonGeneric` is defined multiple times
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:10:1
|
LL | struct NonGeneric {}
| ----------------- previous definition of the type `NonGeneric` here
...
LL | struct NonGeneric<'a, const N: usize> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonGeneric` redefined here
|
= note: `NonGeneric` must be defined only once in the type namespace of this module
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:5:10
|
LL | #[derive(Default)]
| ^^^^^^^ expected 0 lifetime arguments
...
LL | struct NonGeneric<'a, const N: usize> {}
| -- help: remove the lifetime argument
|
note: struct defined here, with 0 lifetime parameters
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:3:8
|
LL | struct NonGeneric {}
| ^^^^^^^^^^
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:5:10
|
LL | #[derive(Default)]
| ^^^^^^^ expected 0 generic arguments
|
note: struct defined here, with 0 generic parameters
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:3:8
|
LL | struct NonGeneric {}
| ^^^^^^^^^^
error[E0392]: lifetime parameter `'a` is never used
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:10:19
|
LL | struct NonGeneric<'a, const N: usize> {}
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:5:10
|
LL | #[derive(Default)]
| ^^^^^^^ expected 0 lifetime arguments
...
LL | struct NonGeneric<'a, const N: usize> {}
| -- help: remove the lifetime argument
|
note: struct defined here, with 0 lifetime parameters
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:3:8
|
LL | struct NonGeneric {}
| ^^^^^^^^^^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:5:10
|
LL | #[derive(Default)]
| ^^^^^^^ expected 0 generic arguments
...
LL | struct NonGeneric<'a, const N: usize> {}
| - help: remove the unnecessary generic argument
|
note: struct defined here, with 0 generic parameters
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:3:8
|
LL | struct NonGeneric {}
| ^^^^^^^^^^
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0107, E0392, E0428.
For more information about an error, try `rustc --explain E0107`.
@@ -11,25 +11,25 @@ error: struct expression with missing field initialiser for `alignment`
--> $DIR/non_scalar_alignment_value.rs:15:32
|
LL | alignment: Assume {},
| ^^^^^^
| ^^^^^^^^^
error: struct expression with missing field initialiser for `lifetimes`
--> $DIR/non_scalar_alignment_value.rs:15:32
|
LL | alignment: Assume {},
| ^^^^^^
| ^^^^^^^^^
error: struct expression with missing field initialiser for `safety`
--> $DIR/non_scalar_alignment_value.rs:15:32
|
LL | alignment: Assume {},
| ^^^^^^
| ^^^^^^^^^
error: struct expression with missing field initialiser for `validity`
--> $DIR/non_scalar_alignment_value.rs:15:32
|
LL | alignment: Assume {},
| ^^^^^^
| ^^^^^^^^^
error: aborting due to 4 previous errors; 1 warning emitted