File tree Expand file tree Collapse file tree 4 files changed +30
-7
lines changed
compiler/rustc_lint_defs/src
src/test/ui/stability-attribute Expand file tree Collapse file tree 4 files changed +30
-7
lines changed Original file line number Diff line number Diff line change 44//! compiler code, rather than using their own custom pass. Those
55//! lints are all available in `rustc_lint::builtin`.
66
7- use crate :: { declare_lint, declare_lint_pass, declare_tool_lint } ;
7+ use crate :: { declare_lint, declare_lint_pass} ;
88use rustc_span:: edition:: Edition ;
99use rustc_span:: symbol:: sym;
1010
@@ -2825,8 +2825,29 @@ declare_lint! {
28252825 } ;
28262826}
28272827
2828- declare_tool_lint ! {
2829- pub rustc:: INEFFECTIVE_UNSTABLE_TRAIT_IMPL ,
2828+ declare_lint ! {
2829+ /// The `ineffective_unstable_trait_impl` lint detects `#[unstable]` attributes which are not used.
2830+ ///
2831+ /// ### Example
2832+ ///
2833+ /// ```compile_fail
2834+ /// #![feature(staged_api)]
2835+ ///
2836+ /// #[derive(Clone)]
2837+ /// #[stable(feature = "x", since = "1")]
2838+ /// struct S {}
2839+ ///
2840+ /// #[unstable(feature = "y", issue = "none")]
2841+ /// impl Copy for S {}
2842+ /// ```
2843+ ///
2844+ /// {{produces}}
2845+ ///
2846+ /// ### Explanation
2847+ ///
2848+ /// `staged_api` does not currently support using a stability attribute on `impl` blocks.
2849+ /// `impl`s are always stable if both the type and trait are stable, and always unstable otherwise.
2850+ pub INEFFECTIVE_UNSTABLE_TRAIT_IMPL ,
28302851 Deny ,
28312852 "detects `#[unstable]` on stable trait implementations for stable types"
28322853}
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ pub trait Wake {
3333 }
3434}
3535
36- #[ allow( rustc:: ineffective_unstable_trait_impl) ]
36+ #[ cfg_attr( bootstrap, allow( rustc:: ineffective_unstable_trait_impl) ) ]
37+ #[ cfg_attr( not( bootstrap) , allow( ineffective_unstable_trait_impl) ) ]
3738#[ unstable( feature = "wake_trait" , issue = "69912" ) ]
3839impl < W : Wake + Send + Sync + ' static > From < Arc < W > > for Waker {
3940 fn from ( waker : Arc < W > ) -> Waker {
@@ -43,7 +44,8 @@ impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker {
4344 }
4445}
4546
46- #[ allow( rustc:: ineffective_unstable_trait_impl) ]
47+ #[ cfg_attr( bootstrap, allow( rustc:: ineffective_unstable_trait_impl) ) ]
48+ #[ cfg_attr( not( bootstrap) , allow( ineffective_unstable_trait_impl) ) ]
4749#[ unstable( feature = "wake_trait" , issue = "69912" ) ]
4850impl < W : Wake + Send + Sync + ' static > From < Arc < W > > for RawWaker {
4951 fn from ( waker : Arc < W > ) -> RawWaker {
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ impl StableTrait for UnstableType {}
2222impl UnstableTrait for StableType { }
2323
2424#[ unstable( feature = "x" , issue = "none" ) ]
25- //~^ ERROR an `#[unstable]` annotation here has no effect [rustc:: ineffective_unstable_trait_impl]
25+ //~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl]
2626impl StableTrait for StableType { }
2727
2828fn main ( ) { }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ error: an `#[unstable]` annotation here has no effect
44LL | #[unstable(feature = "x", issue = "none")]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
7- = note: `#[deny(rustc:: ineffective_unstable_trait_impl)]` on by default
7+ = note: `#[deny(ineffective_unstable_trait_impl)]` on by default
88 = note: see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information
99
1010error: aborting due to previous error
You can’t perform that action at this time.
0 commit comments