-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
remove error code from E0789
, add UI test/docs
#107148
Merged
+59
−2
Merged
Changes from all commits
Commits
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 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 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,30 @@ | ||
#### This error code is internal to the compiler and will not be emitted with normal Rust code. | ||
|
||
The internal `rustc_allowed_through_unstable_modules` attribute must be used | ||
on an item with a `stable` attribute. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0789 | ||
// NOTE: both of these attributes are perma-unstable and should *never* be | ||
// used outside of the compiler and standard library. | ||
#![feature(rustc_attrs)] | ||
#![feature(staged_api)] | ||
|
||
#![unstable(feature = "foo_module", reason = "...", issue = "123")] | ||
|
||
#[rustc_allowed_through_unstable_modules] | ||
// #[stable(feature = "foo", since = "1.0")] | ||
struct Foo; | ||
// ^^^ error: `rustc_allowed_through_unstable_modules` attribute must be | ||
// paired with a `stable` attribute | ||
``` | ||
|
||
Typically when an item is marked with a `stable` attribute, the modules that | ||
enclose the item must also be marked with `stable` attributes, otherwise the | ||
item becomes *de facto* unstable. `#[rustc_allowed_through_unstable_modules]` | ||
is a workaround which allows an item to "escape" its unstable parent modules. | ||
This error occurs when an item is marked with | ||
`#[rustc_allowed_through_unstable_modules]` but no supplementary `stable` | ||
attribute exists. See [#99288](https://github.com/rust-lang/rust/pull/99288) | ||
for an example of `#[rustc_allowed_through_unstable_modules]` in use. |
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
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,12 @@ | ||
// compile-flags: --crate-type lib | ||
|
||
#![feature(rustc_attrs)] | ||
#![feature(staged_api)] | ||
#![unstable(feature = "foo_module", reason = "...", issue = "123")] | ||
|
||
#[rustc_allowed_through_unstable_modules] | ||
// #[stable(feature = "foo", since = "1.0")] | ||
struct Foo; | ||
//~^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute | ||
//~^^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute | ||
// FIXME: we shouldn't have two errors here, only occurs when using `-Zdeduplicate-diagnostics=no` |
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,15 @@ | ||
error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute | ||
--> $DIR/E0789.rs:9:1 | ||
| | ||
LL | struct Foo; | ||
| ^^^^^^^^^^^ | ||
|
||
error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute | ||
--> $DIR/E0789.rs:9:1 | ||
| | ||
LL | struct Foo; | ||
| ^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0789`. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still missing the style formatting "Erroneous code example". ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Won't it be nice when tidy can finally lint this properly!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm definitely looking forward to it!