diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2022-03-04 21:59:18 -0500 |
|---|---|---|
| committer | Jacob Pratt <jacob@jhpratt.dev> | 2022-03-09 16:32:47 -0500 |
| commit | 38478ea0cda8c7e2a4e8e841f97910bcb6d08ef3 (patch) | |
| tree | e47063526a6844f7be37f6986be543636b4c2c54 /src/test/ui/stability-attribute | |
| parent | 5636655d0f0afb0d509cd86ad479773f5854630e (diff) | |
| download | rust-38478ea0cda8c7e2a4e8e841f97910bcb6d08ef3.tar.gz rust-38478ea0cda8c7e2a4e8e841f97910bcb6d08ef3.zip | |
Permit `#[deprecated]` in stdlib
Diffstat (limited to 'src/test/ui/stability-attribute')
10 files changed, 59 insertions, 103 deletions
diff --git a/src/test/ui/stability-attribute/auxiliary/lint-stability.rs b/src/test/ui/stability-attribute/auxiliary/lint-stability.rs index b9019329c22..99c29dcdda6 100644 --- a/src/test/ui/stability-attribute/auxiliary/lint-stability.rs +++ b/src/test/ui/stability-attribute/auxiliary/lint-stability.rs @@ -5,21 +5,21 @@ #![stable(feature = "lint_stability", since = "1.0.0")] #[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", note = "text")] +#[deprecated(since = "1.0.0", note = "text")] pub fn deprecated() {} #[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", note = "text")] +#[deprecated(since = "1.0.0", note = "text")] pub fn deprecated_text() {} #[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "99.99.99", note = "text")] +#[deprecated(since = "99.99.99", note = "text")] pub fn deprecated_future() {} #[unstable(feature = "unstable_test_feature", issue = "none")] -#[rustc_deprecated(since = "1.0.0", note = "text")] +#[deprecated(since = "1.0.0", note = "text")] pub fn deprecated_unstable() {} #[unstable(feature = "unstable_test_feature", issue = "none")] -#[rustc_deprecated(since = "1.0.0", note = "text")] +#[deprecated(since = "1.0.0", note = "text")] pub fn deprecated_unstable_text() {} #[unstable(feature = "unstable_test_feature", issue = "none")] @@ -37,17 +37,17 @@ pub struct MethodTester; impl MethodTester { #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] pub fn method_deprecated(&self) {} #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] pub fn method_deprecated_text(&self) {} #[unstable(feature = "unstable_test_feature", issue = "none")] - #[rustc_deprecated(since = "1.0.0", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] pub fn method_deprecated_unstable(&self) {} #[unstable(feature = "unstable_test_feature", issue = "none")] - #[rustc_deprecated(since = "1.0.0", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] pub fn method_deprecated_unstable_text(&self) {} #[unstable(feature = "unstable_test_feature", issue = "none")] @@ -64,17 +64,17 @@ impl MethodTester { #[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", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] fn trait_deprecated(&self) {} #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] fn trait_deprecated_text(&self) {} #[unstable(feature = "unstable_test_feature", issue = "none")] - #[rustc_deprecated(since = "1.0.0", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] fn trait_deprecated_unstable(&self) {} #[unstable(feature = "unstable_test_feature", issue = "none")] - #[rustc_deprecated(since = "1.0.0", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] fn trait_deprecated_unstable_text(&self) {} #[unstable(feature = "unstable_test_feature", issue = "none")] @@ -93,7 +93,7 @@ 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", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] type TypeDeprecated = u8; } @@ -104,18 +104,18 @@ impl Trait for MethodTester {} pub trait UnstableTrait { fn dummy(&self) { } } #[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", note = "text")] +#[deprecated(since = "1.0.0", note = "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", note = "text")] +#[deprecated(since = "1.0.0", note = "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", note = "text")] +#[deprecated(since = "1.0.0", note = "text")] pub struct DeprecatedUnstableStruct { #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize } @@ -133,10 +133,10 @@ pub enum UnstableEnum {} pub enum StableEnum {} #[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", note = "text")] +#[deprecated(since = "1.0.0", note = "text")] pub struct DeprecatedUnitStruct; #[unstable(feature = "unstable_test_feature", issue = "none")] -#[rustc_deprecated(since = "1.0.0", note = "text")] +#[deprecated(since = "1.0.0", note = "text")] pub struct DeprecatedUnstableUnitStruct; #[unstable(feature = "unstable_test_feature", issue = "none")] pub struct UnstableUnitStruct; @@ -146,10 +146,10 @@ 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", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] DeprecatedVariant, #[unstable(feature = "unstable_test_feature", issue = "none")] - #[rustc_deprecated(since = "1.0.0", note = "text")] + #[deprecated(since = "1.0.0", note = "text")] DeprecatedUnstableVariant, #[unstable(feature = "unstable_test_feature", issue = "none")] UnstableVariant, @@ -159,10 +159,10 @@ pub enum Enum { } #[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", note = "text")] +#[deprecated(since = "1.0.0", note = "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", note = "text")] +#[deprecated(since = "1.0.0", note = "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); diff --git a/src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs b/src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs index 20dceb1ec12..1d6a6bd4e13 100644 --- a/src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs +++ b/src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs @@ -40,14 +40,14 @@ pub struct Struct3<A = isize, #[unstable(feature = "unstable_default", issue = " pub field2: B, } -#[rustc_deprecated(since = "1.1.0", note = "test")] +#[deprecated(since = "1.1.0", note = "test")] #[stable(feature = "stable_test_feature", since = "1.0.0")] pub struct Struct4<A = usize> { #[stable(feature = "stable_test_feature", since = "1.0.0")] pub field: A, } -#[rustc_deprecated(since = "1.1.0", note = "test")] +#[deprecated(since = "1.1.0", note = "test")] #[stable(feature = "stable_test_feature", since = "1.0.0")] pub struct Struct5<#[unstable(feature = "unstable_default", issue = "none")] A = usize> { #[stable(feature = "stable_test_feature", since = "1.0.0")] @@ -99,7 +99,7 @@ pub enum Enum3<T = isize, #[unstable(feature = "unstable_default", issue = "none Err(#[stable(feature = "stable_test_feature", since = "1.0.0")] E), } -#[rustc_deprecated(since = "1.1.0", note = "test")] +#[deprecated(since = "1.1.0", note = "test")] #[stable(feature = "stable_test_feature", since = "1.0.0")] pub enum Enum4<T = usize> { #[stable(feature = "stable_test_feature", since = "1.0.0")] @@ -108,7 +108,7 @@ pub enum Enum4<T = usize> { None, } -#[rustc_deprecated(since = "1.1.0", note = "test")] +#[deprecated(since = "1.1.0", note = "test")] #[stable(feature = "stable_test_feature", since = "1.0.0")] pub enum Enum5<#[unstable(feature = "unstable_default", issue = "none")] T = usize> { #[stable(feature = "stable_test_feature", since = "1.0.0")] @@ -152,11 +152,11 @@ pub type Alias2<T = usize> = Option<T>; pub type Alias3<T = isize, #[unstable(feature = "unstable_default", issue = "none")] E = usize> = Result<T, E>; -#[rustc_deprecated(since = "1.1.0", note = "test")] +#[deprecated(since = "1.1.0", note = "test")] #[stable(feature = "stable_test_feature", since = "1.0.0")] pub type Alias4<T = usize> = Option<T>; -#[rustc_deprecated(since = "1.1.0", note = "test")] +#[deprecated(since = "1.1.0", note = "test")] #[stable(feature = "stable_test_feature", since = "1.0.0")] pub type Alias5<#[unstable(feature = "unstable_default", issue = "none")] T = usize> = Option<T>; diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs index 1627d1d3f9f..f61acc8aac5 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs @@ -2,6 +2,4 @@ #[unstable()] //~ ERROR: stability attributes may not be used #[stable()] //~ ERROR: stability attributes may not be used -#[rustc_deprecated()] //~ ERROR: stability attributes may not be used -//~^ ERROR missing 'since' fn main() {} diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr index a2b2d3cbe59..45d965ea0a0 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr @@ -10,19 +10,6 @@ error[E0734]: stability attributes may not be used outside of the standard libra LL | #[stable()] | ^^^^^^^^^^^ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1 - | -LL | #[rustc_deprecated()] - | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0542]: missing 'since' - --> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1 - | -LL | #[rustc_deprecated()] - | ^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0542, E0734. -For more information about an error, try `rustc --explain E0542`. +For more information about this error, try `rustc --explain E0734`. diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs index dfbd9ea5ebf..4015f2f971e 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs @@ -1,5 +1,3 @@ #[unstable()] //~ ERROR: stability attributes may not be used #[stable()] //~ ERROR: stability attributes may not be used -#[rustc_deprecated()] //~ ERROR: stability attributes may not be used -//~^ ERROR missing 'since' fn main() {} diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr index 9af8d1df4ea..391f3c2744d 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr @@ -10,19 +10,6 @@ error[E0734]: stability attributes may not be used outside of the standard libra LL | #[stable()] | ^^^^^^^^^^^ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/stability-attribute-non-staged.rs:3:1 - | -LL | #[rustc_deprecated()] - | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0542]: missing 'since' - --> $DIR/stability-attribute-non-staged.rs:3:1 - | -LL | #[rustc_deprecated()] - | ^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0542, E0734. -For more information about an error, try `rustc --explain E0542`. +For more information about this error, try `rustc --explain E0734`. diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs index b85f9342045..64f99635219 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs @@ -18,13 +18,11 @@ mod bogus_attribute_types_2 { fn f4() { } #[stable(feature = "a", since = "b")] - #[rustc_deprecated] //~ ERROR malformed `rustc_deprecated` attribute - //~^ ERROR missing 'since' + #[deprecated] //~ ERROR missing 'since' fn f5() { } #[stable(feature = "a", since = "b")] - #[rustc_deprecated = "a"] //~ ERROR malformed `rustc_deprecated` attribute - //~^ ERROR missing 'since' + #[deprecated = "a"] //~ ERROR missing 'since' fn f6() { } } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr index 8e51215b1e6..a76f5be1e3d 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr @@ -22,30 +22,18 @@ error: malformed `stable` attribute input LL | #[stable = "a"] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[stable(feature = "name", since = "version")]` -error: malformed `rustc_deprecated` attribute input - --> $DIR/stability-attribute-sanity-4.rs:21:5 - | -LL | #[rustc_deprecated] - | ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_deprecated(since = "version", note = "...")]` - -error: malformed `rustc_deprecated` attribute input - --> $DIR/stability-attribute-sanity-4.rs:26:5 - | -LL | #[rustc_deprecated = "a"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_deprecated(since = "version", note = "...")]` - error[E0542]: missing 'since' --> $DIR/stability-attribute-sanity-4.rs:21:5 | -LL | #[rustc_deprecated] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[deprecated] + | ^^^^^^^^^^^^^ error[E0542]: missing 'since' - --> $DIR/stability-attribute-sanity-4.rs:26:5 + --> $DIR/stability-attribute-sanity-4.rs:25:5 | -LL | #[rustc_deprecated = "a"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[deprecated = "a"] + | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0542`. diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.rs b/src/test/ui/stability-attribute/stability-attribute-sanity.rs index 44874dd8cb0..f37a8f328a7 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.rs @@ -37,11 +37,11 @@ mod missing_version { fn f1() { } #[stable(feature = "a", since = "b")] - #[rustc_deprecated(note = "a")] //~ ERROR missing 'since' [E0542] + #[deprecated(note = "a")] //~ ERROR missing 'since' [E0542] fn f2() { } #[stable(feature = "a", since = "b")] - #[rustc_deprecated(since = "a")] //~ ERROR missing 'note' [E0543] + #[deprecated(since = "a")] //~ ERROR missing 'note' [E0543] fn f3() { } } @@ -58,19 +58,19 @@ fn multiple2() { } fn multiple3() { } #[stable(feature = "a", since = "b")] //~ ERROR invalid stability version found -#[rustc_deprecated(since = "b", note = "text")] -#[rustc_deprecated(since = "b", note = "text")] //~ ERROR multiple deprecated attributes +#[deprecated(since = "b", note = "text")] +#[deprecated(since = "b", note = "text")] //~ ERROR multiple deprecated attributes #[rustc_const_unstable(feature = "c", issue = "none")] #[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels pub const fn multiple4() { } #[stable(feature = "a", since = "1.0.0")] //~ ERROR invalid deprecation version found //~^ ERROR feature `a` is declared stable since 1.0.0 -#[rustc_deprecated(since = "invalid", note = "text")] +#[deprecated(since = "invalid", note = "text")] fn invalid_deprecation_version() {} -#[rustc_deprecated(since = "a", note = "text")] +#[deprecated(since = "a", note = "text")] fn deprecated_without_unstable_or_stable() { } -//~^^ ERROR rustc_deprecated attribute must be paired with either stable or unstable attribute +//~^^ ERROR deprecated attribute must be paired with either stable or unstable attribute fn main() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr index 9b2cb2550ca..9e2d9f27084 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr @@ -55,14 +55,14 @@ LL | #[stable(feature = "a")] error[E0542]: missing 'since' --> $DIR/stability-attribute-sanity.rs:40:5 | -LL | #[rustc_deprecated(note = "a")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[deprecated(note = "a")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0543]: missing 'note' --> $DIR/stability-attribute-sanity.rs:44:5 | -LL | #[rustc_deprecated(since = "a")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[deprecated(since = "a")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:49:1 @@ -85,10 +85,10 @@ LL | #[stable(feature = "a", since = "b")] error[E0550]: multiple deprecated attributes --> $DIR/stability-attribute-sanity.rs:62:1 | -LL | #[rustc_deprecated(since = "b", note = "text")] - | ----------------------------------------------- first deprecation attribute -LL | #[rustc_deprecated(since = "b", note = "text")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ repeated deprecation attribute +LL | #[deprecated(since = "b", note = "text")] + | ----------------------------------------- first deprecation attribute +LL | #[deprecated(since = "b", note = "text")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ repeated deprecation attribute error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:64:1 @@ -114,11 +114,11 @@ LL | #[stable(feature = "a", since = "1.0.0")] LL | fn invalid_deprecation_version() {} | ----------------------------------- the stability attribute annotates this item -error[E0549]: rustc_deprecated attribute must be paired with either stable or unstable attribute +error[E0549]: deprecated attribute must be paired with either stable or unstable attribute --> $DIR/stability-attribute-sanity.rs:72:1 | -LL | #[rustc_deprecated(since = "a", note = "text")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[deprecated(since = "a", note = "text")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0711]: feature `a` is declared stable since 1.0.0, but was previously declared stable since b --> $DIR/stability-attribute-sanity.rs:67:1 |
