diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-12-07 02:01:35 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-12-07 02:25:09 +0300 |
| commit | 4eb9da3b17a1e6cdb8517e9f9ee7000f8effaef4 (patch) | |
| tree | a0031460e4fc31923d9dc1374f8aaf84e2d61dd1 /src/test/ui/stability-attribute | |
| parent | 0f6f2d681b39c5f95459cd09cb936b6ceb27cd82 (diff) | |
| download | rust-4eb9da3b17a1e6cdb8517e9f9ee7000f8effaef4.tar.gz rust-4eb9da3b17a1e6cdb8517e9f9ee7000f8effaef4.zip | |
Move some tests to subdirectories
Diffstat (limited to 'src/test/ui/stability-attribute')
| -rw-r--r-- | src/test/ui/stability-attribute/auxiliary/lint-stability.rs | 188 | ||||
| -rw-r--r-- | src/test/ui/stability-attribute/issue-28075.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/stability-attribute/issue-28075.stderr | 11 | ||||
| -rw-r--r-- | src/test/ui/stability-attribute/issue-28388-3.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/stability-attribute/issue-28388-3.stderr | 11 |
5 files changed, 234 insertions, 0 deletions
diff --git a/src/test/ui/stability-attribute/auxiliary/lint-stability.rs b/src/test/ui/stability-attribute/auxiliary/lint-stability.rs new file mode 100644 index 00000000000..de4058887cf --- /dev/null +++ b/src/test/ui/stability-attribute/auxiliary/lint-stability.rs @@ -0,0 +1,188 @@ +#![crate_name="lint_stability"] +#![crate_type = "lib"] +#![feature(staged_api)] +#![feature(associated_type_defaults)] +#![stable(feature = "lint_stability", since = "1.0.0")] + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated() {} +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated_text() {} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "99.99.99", reason = "text")] +pub fn deprecated_future() {} + +#[unstable(feature = "unstable_test_feature", issue = "none")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated_unstable() {} +#[unstable(feature = "unstable_test_feature", issue = "none")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated_unstable_text() {} + +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub fn unstable() {} +#[unstable(feature = "unstable_test_feature", reason = "text", issue = "none")] +pub fn unstable_text() {} + +#[stable(feature = "rust1", since = "1.0.0")] +pub fn stable() {} +#[stable(feature = "rust1", since = "1.0.0")] +pub fn stable_text() {} + +#[stable(feature = "rust1", since = "1.0.0")] +pub struct MethodTester; + +impl MethodTester { + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated(&self) {} + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated_text(&self) {} + + #[unstable(feature = "unstable_test_feature", issue = "none")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated_unstable(&self) {} + #[unstable(feature = "unstable_test_feature", issue = "none")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated_unstable_text(&self) {} + + #[unstable(feature = "unstable_test_feature", issue = "none")] + pub fn method_unstable(&self) {} + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "none")] + pub fn method_unstable_text(&self) {} + + #[stable(feature = "rust1", since = "1.0.0")] + pub fn method_stable(&self) {} + #[stable(feature = "rust1", since = "1.0.0")] + pub fn method_stable_text(&self) {} +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +pub trait Trait { + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated(&self) {} + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated_text(&self) {} + + #[unstable(feature = "unstable_test_feature", issue = "none")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated_unstable(&self) {} + #[unstable(feature = "unstable_test_feature", issue = "none")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated_unstable_text(&self) {} + + #[unstable(feature = "unstable_test_feature", issue = "none")] + fn trait_unstable(&self) {} + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "none")] + fn trait_unstable_text(&self) {} + + #[stable(feature = "rust1", since = "1.0.0")] + fn trait_stable(&self) {} + #[stable(feature = "rust1", since = "1.0.0")] + fn trait_stable_text(&self) {} +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +pub trait TraitWithAssociatedTypes { + #[unstable(feature = "unstable_test_feature", issue = "none")] + type TypeUnstable = u8; + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + type TypeDeprecated = u8; +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +impl Trait for MethodTester {} + +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub trait UnstableTrait { fn dummy(&self) { } } + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub trait DeprecatedTrait { + #[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { } +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedStruct { + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize +} +#[unstable(feature = "unstable_test_feature", issue = "none")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedUnstableStruct { + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize +} +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub struct UnstableStruct { + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize +} +#[stable(feature = "rust1", since = "1.0.0")] +pub struct StableStruct { + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize +} +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub enum UnstableEnum {} +#[stable(feature = "rust1", since = "1.0.0")] +pub enum StableEnum {} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedUnitStruct; +#[unstable(feature = "unstable_test_feature", issue = "none")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedUnstableUnitStruct; +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub struct UnstableUnitStruct; +#[stable(feature = "rust1", since = "1.0.0")] +pub struct StableUnitStruct; + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +pub enum Enum { + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + DeprecatedVariant, + #[unstable(feature = "unstable_test_feature", issue = "none")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + DeprecatedUnstableVariant, + #[unstable(feature = "unstable_test_feature", issue = "none")] + UnstableVariant, + + #[stable(feature = "rust1", since = "1.0.0")] + StableVariant, +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); +#[unstable(feature = "unstable_test_feature", issue = "none")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); +#[stable(feature = "rust1", since = "1.0.0")] +pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[macro_export] +macro_rules! macro_test { + () => (deprecated()); +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[macro_export] +macro_rules! macro_test_arg { + ($func:expr) => ($func); +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[macro_export] +macro_rules! macro_test_arg_nested { + ($func:ident) => (macro_test_arg!($func())); +} diff --git a/src/test/ui/stability-attribute/issue-28075.rs b/src/test/ui/stability-attribute/issue-28075.rs new file mode 100644 index 00000000000..6b4ea46f361 --- /dev/null +++ b/src/test/ui/stability-attribute/issue-28075.rs @@ -0,0 +1,13 @@ +// Unstable entities should be caught in import lists + +// aux-build:lint-stability.rs + +#![allow(warnings)] + +extern crate lint_stability; + +use lint_stability::{unstable, deprecated}; +//~^ ERROR use of unstable library feature 'unstable_test_feature' + +fn main() { +} diff --git a/src/test/ui/stability-attribute/issue-28075.stderr b/src/test/ui/stability-attribute/issue-28075.stderr new file mode 100644 index 00000000000..7e53bb54457 --- /dev/null +++ b/src/test/ui/stability-attribute/issue-28075.stderr @@ -0,0 +1,11 @@ +error[E0658]: use of unstable library feature 'unstable_test_feature' + --> $DIR/issue-28075.rs:9:22 + | +LL | use lint_stability::{unstable, deprecated}; + | ^^^^^^^^ + | + = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/stability-attribute/issue-28388-3.rs b/src/test/ui/stability-attribute/issue-28388-3.rs new file mode 100644 index 00000000000..7ba99350121 --- /dev/null +++ b/src/test/ui/stability-attribute/issue-28388-3.rs @@ -0,0 +1,11 @@ +// Prefix in imports with empty braces should be resolved and checked privacy, stability, etc. + +// aux-build:lint-stability.rs + +extern crate lint_stability; + +use lint_stability::UnstableEnum::{}; +//~^ ERROR use of unstable library feature 'unstable_test_feature' +use lint_stability::StableEnum::{}; // OK + +fn main() {} diff --git a/src/test/ui/stability-attribute/issue-28388-3.stderr b/src/test/ui/stability-attribute/issue-28388-3.stderr new file mode 100644 index 00000000000..d2e46683b90 --- /dev/null +++ b/src/test/ui/stability-attribute/issue-28388-3.stderr @@ -0,0 +1,11 @@ +error[E0658]: use of unstable library feature 'unstable_test_feature' + --> $DIR/issue-28388-3.rs:7:5 + | +LL | use lint_stability::UnstableEnum::{}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. |
