Skip to content

Commit

Permalink
Add test for unstable trait impl lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Sep 11, 2020
1 parent 471fb62 commit 1c1bfba
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/ui/stability-attribute/stability-attribute-trait-impl.rs
Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1c1bfba

Please sign in to comment.