-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Stabilize doc_cfg, auto_doc_cfg and cfg_hide features #100883
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
Closed
+346
−227
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f6305dd
Stabilize doc_cfg, doc_auto_cfg and doc_cfg_hide features
GuillaumeGomez 8579576
Add doc(auto_cfg) and doc(no_auto_cfg) attributes
GuillaumeGomez 76a9661
Add missing `#![doc(auto_cfg)]` attribute in rustdoc tests
GuillaumeGomez 6d9360e
Add rustdoc-ui test for `doc(auto_cfg)` and `doc(no_auto_cfg)` attrib…
GuillaumeGomez 6790415
Add documentation for `doc(auto_cfg)` and `doc(no_auto_cfg)` attributes
GuillaumeGomez 341b101
Add check for usage of both `doc(auto_cfg)` and `doc(no_auto_cfg)` at…
GuillaumeGomez 2d06d65
Add tests for duplicated usage of `doc(auto_cfg)` and `doc(no_auto_cfg)`
GuillaumeGomez 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
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
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 was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
// ignore-tidy-linelength | ||
|
||
#![feature(doc_cfg)] | ||
|
||
pub mod another_folder; | ||
pub mod another_mod; | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#![feature(doc_cfg)] | ||
|
||
#[doc(cfg(), cfg(foo, bar))] | ||
//~^ ERROR | ||
//~^^ ERROR | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
running 1 test | ||
test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) ... ok | ||
test $DIR/doc-test-rustdoc-feature.rs - Foo (line 8) ... ok | ||
|
||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME | ||
|
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,15 @@ | ||
// edition: 2021 | ||
#![deny(warnings)] | ||
#![doc(no_auto_cfg)] //~ ERROR | ||
//~^ ERROR | ||
#![doc(auto_cfg, no_auto_cfg)] //~ ERROR | ||
#![doc(no_auto_cfg(1))] //~ ERROR | ||
#![doc(no_auto_cfg = 1)] //~ ERROR | ||
#![doc(auto_cfg(1))] //~ ERROR | ||
#![doc(auto_cfg = 1)] //~ ERROR | ||
GuillaumeGomez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#[doc(auto_cfg)] //~ ERROR | ||
//~^ WARN | ||
#[doc(no_auto_cfg)] //~ ERROR | ||
//~^ WARN | ||
pub struct Bar; |
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,83 @@ | ||
error: this attribute can only be applied at the crate level | ||
--> $DIR/doc_no_auto_cfg.rs:11:7 | ||
| | ||
LL | #[doc(auto_cfg)] | ||
| ^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/doc_no_auto_cfg.rs:2:9 | ||
| | ||
LL | #![deny(warnings)] | ||
| ^^^^^^^^ | ||
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
= note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information | ||
help: to apply to the crate, use an inner attribute | ||
| | ||
LL | #![doc(auto_cfg)] | ||
| ~~~~~~~~~~~~~~~~~ | ||
|
||
error: this attribute can only be applied at the crate level | ||
--> $DIR/doc_no_auto_cfg.rs:13:7 | ||
| | ||
LL | #[doc(no_auto_cfg)] | ||
| ^^^^^^^^^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
= note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information | ||
help: to apply to the crate, use an inner attribute | ||
| | ||
LL | #![doc(no_auto_cfg)] | ||
| ~~~~~~~~~~~~~~~~~~~~ | ||
|
||
error: `doc(no_auto_cfg)` is enabled by default before the 2024 edition | ||
--> $DIR/doc_no_auto_cfg.rs:3:8 | ||
| | ||
LL | #![doc(no_auto_cfg)] | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: `#[deny(unused_attributes)]` implied by `#[deny(warnings)]` | ||
|
||
error: `doc(no_auto_cfg)` is enabled by default before the 2024 edition | ||
--> $DIR/doc_no_auto_cfg.rs:5:18 | ||
| | ||
LL | #![doc(auto_cfg, no_auto_cfg)] | ||
| ^^^^^^^^^^^ | ||
|
||
error: please don't specify both `doc(auto_cfg)` and `doc(no_auto_cfg)` | ||
--> $DIR/doc_no_auto_cfg.rs:3:8 | ||
| | ||
LL | #![doc(no_auto_cfg)] | ||
| ^^^^^^^^^^^ | ||
LL | | ||
LL | #![doc(auto_cfg, no_auto_cfg)] | ||
| ----------- the other is specified here | ||
|
||
error: `#![doc(no_auto_cfg)]` attribute doesn't expect a value | ||
--> $DIR/doc_no_auto_cfg.rs:6:8 | ||
| | ||
LL | #![doc(no_auto_cfg(1))] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: `#![doc(no_auto_cfg)]` attribute doesn't expect a value | ||
--> $DIR/doc_no_auto_cfg.rs:7:8 | ||
| | ||
LL | #![doc(no_auto_cfg = 1)] | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: `#![doc(auto_cfg)]` attribute doesn't expect a value | ||
--> $DIR/doc_no_auto_cfg.rs:8:8 | ||
| | ||
LL | #![doc(auto_cfg(1))] | ||
| ^^^^^^^^^^^ | ||
|
||
error: `#![doc(auto_cfg)]` attribute doesn't expect a value | ||
--> $DIR/doc_no_auto_cfg.rs:9:8 | ||
| | ||
LL | #![doc(auto_cfg = 1)] | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to 9 previous errors | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#![feature(doc_cfg)] | ||
#[doc(cfg = "x")] //~ ERROR not followed by parentheses | ||
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates | ||
struct S {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
// compile-flags:--cfg feature="worricow" | ||
#![crate_name = "xenogenous"] | ||
|
||
#![doc(auto_cfg)] | ||
|
||
// @has 'xenogenous/struct.Worricow.html' | ||
// @count - '//*[@class="stab portability"]' 0 | ||
// @count - '//*[@class="stab portability"]' 1 | ||
#[cfg(feature = "worricow")] | ||
pub struct Worricow; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#![feature(doc_cfg)] | ||
#![feature(target_feature, cfg_target_feature)] | ||
|
||
// @has doc_cfg/struct.Portable.html | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#![feature(doc_cfg)] | ||
|
||
#![crate_name = "foo"] | ||
|
||
// @has foo/fn.foo.html | ||
|
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
1 change: 0 additions & 1 deletion
1
src/test/rustdoc/reexport-stability-tags-deprecated-and-portability.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
1 change: 0 additions & 1 deletion
1
src/test/rustdoc/reexport-stability-tags-unstable-and-portability.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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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.
kinda wish our docs here were better
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 already rewrote the original a bit. Which parts are you thinking about?