mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
add more tests
This commit is contained in:
parent
944c0e23b8
commit
e65214785d
@ -5,6 +5,14 @@ pub struct Private { _priv: () }
|
||||
#[non_exhaustive]
|
||||
pub struct NonExhaustive {}
|
||||
|
||||
#[non_exhaustive]
|
||||
pub enum NonExhaustiveEnum {}
|
||||
|
||||
pub enum NonExhaustiveVariant {
|
||||
#[non_exhaustive]
|
||||
A,
|
||||
}
|
||||
|
||||
pub struct ExternalIndirection<T> {
|
||||
pub x: T,
|
||||
}
|
||||
|
@ -3,7 +3,13 @@
|
||||
// aux-build: repr-transparent-non-exhaustive.rs
|
||||
extern crate repr_transparent_non_exhaustive;
|
||||
|
||||
use repr_transparent_non_exhaustive::{Private, NonExhaustive, ExternalIndirection};
|
||||
use repr_transparent_non_exhaustive::{
|
||||
Private,
|
||||
NonExhaustive,
|
||||
NonExhaustiveEnum,
|
||||
NonExhaustiveVariant,
|
||||
ExternalIndirection,
|
||||
};
|
||||
|
||||
pub struct InternalPrivate {
|
||||
_priv: (),
|
||||
@ -38,22 +44,52 @@ pub struct T6(Sized, NonExhaustive);
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T7(Sized, InternalIndirection<Private>);
|
||||
pub struct T7(Sized, NonExhaustiveEnum);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T8(Sized, InternalIndirection<NonExhaustive>);
|
||||
pub struct T8(Sized, NonExhaustiveVariant);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T9(Sized, ExternalIndirection<Private>);
|
||||
pub struct T9(Sized, InternalIndirection<Private>);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T10(Sized, ExternalIndirection<NonExhaustive>);
|
||||
pub struct T10(Sized, InternalIndirection<NonExhaustive>);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T11(Sized, InternalIndirection<NonExhaustiveEnum>);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T12(Sized, InternalIndirection<NonExhaustiveVariant>);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T13(Sized, ExternalIndirection<Private>);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T14(Sized, ExternalIndirection<NonExhaustive>);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T15(Sized, ExternalIndirection<NonExhaustiveEnum>);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct T16(Sized, ExternalIndirection<NonExhaustiveVariant>);
|
||||
//~^ ERROR zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
//~| WARN this was previously accepted by the compiler
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:31:22
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:37:22
|
||||
|
|
||||
LL | pub struct T5(Sized, Private);
|
||||
| ^^^^^^^
|
||||
@ -14,7 +14,7 @@ LL | #![deny(repr_transparent_external_private_fields)]
|
||||
= note: this struct contains `Private`, which contains private fields, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:36:22
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:42:22
|
||||
|
|
||||
LL | pub struct T6(Sized, NonExhaustive);
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -24,9 +24,29 @@ LL | pub struct T6(Sized, NonExhaustive);
|
||||
= note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:41:22
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:47:22
|
||||
|
|
||||
LL | pub struct T7(Sized, InternalIndirection<Private>);
|
||||
LL | pub struct T7(Sized, NonExhaustiveEnum);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this enum contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:52:22
|
||||
|
|
||||
LL | pub struct T8(Sized, NonExhaustiveVariant);
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this enum contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:57:22
|
||||
|
|
||||
LL | pub struct T9(Sized, InternalIndirection<Private>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
@ -34,34 +54,74 @@ LL | pub struct T7(Sized, InternalIndirection<Private>);
|
||||
= note: this struct contains `Private`, which contains private fields, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:46:22
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:62:23
|
||||
|
|
||||
LL | pub struct T8(Sized, InternalIndirection<NonExhaustive>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:51:22
|
||||
|
|
||||
LL | pub struct T9(Sized, ExternalIndirection<Private>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this struct contains `Private`, which contains private fields, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:56:23
|
||||
|
|
||||
LL | pub struct T10(Sized, ExternalIndirection<NonExhaustive>);
|
||||
LL | pub struct T10(Sized, InternalIndirection<NonExhaustive>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:67:23
|
||||
|
|
||||
LL | pub struct T11(Sized, InternalIndirection<NonExhaustiveEnum>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this enum contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:72:23
|
||||
|
|
||||
LL | pub struct T12(Sized, InternalIndirection<NonExhaustiveVariant>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this enum contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:77:23
|
||||
|
|
||||
LL | pub struct T13(Sized, ExternalIndirection<Private>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this struct contains `Private`, which contains private fields, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:82:23
|
||||
|
|
||||
LL | pub struct T14(Sized, ExternalIndirection<NonExhaustive>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:87:23
|
||||
|
|
||||
LL | pub struct T15(Sized, ExternalIndirection<NonExhaustiveEnum>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this enum contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: zero-sized fields in repr(transparent) cannot contain external non-exhaustive types
|
||||
--> $DIR/repr-transparent-non-exhaustive.rs:92:23
|
||||
|
|
||||
LL | pub struct T16(Sized, ExternalIndirection<NonExhaustiveVariant>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
|
||||
= note: this enum contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user