forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for unstable trait impl lint.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/test/ui/stability-attribute/stability-attribute-trait-impl.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|