diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-05 09:13:28 +0100 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 09:32:08 +0000 |
| commit | cf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch) | |
| tree | 40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/ui/internal/auxiliary | |
| parent | ca855e6e42787ecd062d81d53336fe6788ef51a9 (diff) | |
| download | rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip | |
Move /src/test to /tests
Diffstat (limited to 'tests/ui/internal/auxiliary')
| -rw-r--r-- | tests/ui/internal/auxiliary/internal_unstable.rs | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/tests/ui/internal/auxiliary/internal_unstable.rs b/tests/ui/internal/auxiliary/internal_unstable.rs new file mode 100644 index 00000000000..eb4d6cb380e --- /dev/null +++ b/tests/ui/internal/auxiliary/internal_unstable.rs @@ -0,0 +1,101 @@ +#![feature(staged_api, allow_internal_unstable)] +#![stable(feature = "stable", since = "1.0.0")] + +#[unstable(feature = "function", issue = "none")] +pub fn unstable() {} + + +#[stable(feature = "stable", since = "1.0.0")] +pub struct Foo { + #[unstable(feature = "struct_field", issue = "none")] + pub x: u8 +} + +impl Foo { + #[unstable(feature = "method", issue = "none")] + pub fn method(&self) {} +} + +#[stable(feature = "stable", since = "1.0.0")] +pub struct Bar { + #[unstable(feature = "struct2_field", issue = "none")] + pub x: u8 +} + +#[stable(feature = "stable", since = "1.0.0")] +#[allow_internal_unstable(function)] +#[macro_export] +macro_rules! call_unstable_allow { + () => { $crate::unstable() } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[allow_internal_unstable(struct_field)] +#[macro_export] +macro_rules! construct_unstable_allow { + ($e: expr) => { + $crate::Foo { x: $e } + } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[allow_internal_unstable(method)] +#[macro_export] +macro_rules! call_method_allow { + ($e: expr) => { $e.method() } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[allow_internal_unstable(struct_field, struct2_field)] +#[macro_export] +macro_rules! access_field_allow { + ($e: expr) => { $e.x } +} + +// regression test for #77088 +#[stable(feature = "stable", since = "1.0.0")] +#[allow_internal_unstable(struct_field)] +#[allow_internal_unstable(struct2_field)] +#[macro_export] +macro_rules! access_field_allow2 { + ($e: expr) => { $e.x } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[allow_internal_unstable()] +#[macro_export] +macro_rules! pass_through_allow { + ($e: expr) => { $e } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[macro_export] +macro_rules! call_unstable_noallow { + () => { $crate::unstable() } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[macro_export] +macro_rules! construct_unstable_noallow { + ($e: expr) => { + $crate::Foo { x: $e } + } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[macro_export] +macro_rules! call_method_noallow { + ($e: expr) => { $e.method() } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[macro_export] +macro_rules! access_field_noallow { + ($e: expr) => { $e.x } +} + +#[stable(feature = "stable", since = "1.0.0")] +#[macro_export] +macro_rules! pass_through_noallow { + ($e: expr) => { $e } +} |
