-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Warn for #[unstable] on trait impls when it has no effect. #76538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bors
merged 8 commits into
rust-lang:master
from
fusion-engineering-forks:check-useless-unstable-trait-impl
Sep 12, 2020
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1854f8b
Warn for #[unstable] on trait impls when it has no effect.
m-ou-se e5c645f
Turn useless #[unstable] attributes into errors.
m-ou-se f6fbf66
Mark RefUnwindSafe impls for stable atomic types as stable.
m-ou-se cf8e5d1
Mark Error impl for LayoutErr as stable.
m-ou-se 89fb34f
Turn unstable trait impl error into a lint, so it can be disabled.
m-ou-se 471fb62
Allow unstable From impl for [Raw]Waker.
m-ou-se 1c1bfba
Add test for unstable trait impl lint.
m-ou-se 14cc177
Improve `ineffective_unstable_trait_impl` error message.
m-ou-se File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
28 changes: 28 additions & 0 deletions
28
src/test/ui/stability-attribute/stability-attribute-trait-impl.rs
This file contains hidden or 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 [rustc::ineffective_unstable_trait_impl] | ||
impl StableTrait for StableType {} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr
This file contains hidden or 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,11 @@ | ||
error: an `#[unstable]` annotation here has no effect | ||
--> $DIR/stability-attribute-trait-impl.rs:24:1 | ||
| | ||
LL | #[unstable(feature = "x", issue = "none")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[deny(rustc::ineffective_unstable_trait_impl)]` on by default | ||
= note: see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information | ||
|
||
error: aborting due to previous error | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.