Add test for unstable trait impl lint.

This commit is contained in:
Mara Bos 2020-09-10 20:55:04 +02:00
parent 471fb622aa
commit 1c1bfba84a
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,28 @@
#![feature(staged_api)]
#[stable(feature = "x", since = "1")]
struct StableType;
#[unstable(feature = "x", issue = "none")]
struct UnstableType;
#[stable(feature = "x", since = "1")]
trait StableTrait {}
#[unstable(feature = "x", issue = "none")]
trait UnstableTrait {}
#[unstable(feature = "x", issue = "none")]
impl UnstableTrait for UnstableType {}
#[unstable(feature = "x", issue = "none")]
impl StableTrait for UnstableType {}
#[unstable(feature = "x", issue = "none")]
impl UnstableTrait for StableType {}
#[unstable(feature = "x", issue = "none")]
//~^ ERROR An `#[unstable]` annotation here has no effect.
impl StableTrait for StableType {}
fn main() {}

View file

@ -0,0 +1,10 @@
error: An `#[unstable]` annotation here has no effect. See issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information.
--> $DIR/stability-attribute-trait-impl.rs:24:1
|
LL | #[unstable(feature = "x", issue = "none")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(rustc::ineffective_unstable_trait_impl)]` on by default
error: aborting due to previous error