Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,15 +425,15 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
List: &["predicate"],
"https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute"
),
DuplicatesOk, EncodeCrossCrate::Yes
DuplicatesOk, EncodeCrossCrate::No
),
ungated!(
cfg_attr, Normal,
template!(
List: &["predicate, attr1, attr2, ..."],
"https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute"
),
DuplicatesOk, EncodeCrossCrate::Yes
DuplicatesOk, EncodeCrossCrate::No
),

// Testing:
Expand Down Expand Up @@ -1100,7 +1100,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// can only be generated by the compiler.
ungated!(
cfg_trace, Normal, template!(Word /* irrelevant */), DuplicatesOk,
EncodeCrossCrate::No
EncodeCrossCrate::Yes
),
ungated!(
cfg_attr_trace, Normal, template!(Word /* irrelevant */), DuplicatesOk,
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc/doc_auto_cfg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Test covering RFC 3631 features.
// Basic tests covering RFC 3631 features.

#![crate_name = "foo"]
#![feature(doc_cfg)]
Expand Down
11 changes: 11 additions & 0 deletions tests/rustdoc/inline_cross/auxiliary/doc-auto-cfg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ compile-flags: --cfg extension

#[cfg(extension)]
pub fn compute() {}

pub struct Type;

impl Type {
#[cfg(extension)]
pub fn transform(self) -> Self { self }
}

This file was deleted.

53 changes: 53 additions & 0 deletions tests/rustdoc/inline_cross/doc-auto-cfg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Test that `doc(auto_cfg)` works with inlined cross-crate re-exports.
//@ compile-flags: --cfg feature="extra" --cfg feature="addon"

#![feature(doc_cfg)]
#![crate_name = "it"]

//@ aux-build: doc-auto-cfg.rs
extern crate doc_auto_cfg;

// The cfg is on the reexported item.
// issue: <https://github.com/rust-lang/rust/issues/141301>
pub mod pre {
//@ has 'it/pre/index.html' '//*[@class="stab portability"]' 'extension'
//@ has 'it/pre/fn.compute.html' '//*[@class="stab portability"]' \
// 'Available on extension only.'
pub use doc_auto_cfg::*;

// Indeed, this reexport doesn't have a cfg badge!
// That's because this crate (`it`) wouldn't've compiled in the first place
// if `--cfg extension` wasn't passed when compiling the auxiliary crate
// contrary to the glob import above since `compute` wouldn't exist.
//
//@ !has 'it/pre/fn.calculate.html' '//*[@class="stab portability"]' \
// 'Available on extension only.'
pub use doc_auto_cfg::compute as calculate;

// FIXME(HtmlDocCk): Ideally I would've used the following XPath here:
// `*[@class="impl-items"][*[@id="method.transform"]]//*[@class="stab portability"]`
//
//@ has 'it/pre/struct.Kind.html' '//*[@id="method.transform"]' ''
//@ has - '//*[@class="impl-items"]//*[@class="stab portability"]' \
// 'Available on extension only.'
pub use doc_auto_cfg::Type as Kind;
}

// The cfg is on the reexport.
pub mod post {
// issue: <https://github.com/rust-lang/rust/issues/113982>
//@ has 'it/post/index.html' '//*[@class="stab portability"]' 'extra'
//@ has - '//*[@class="stab portability"]' 'extra and extension'
//@ has 'it/post/struct.Type.html' '//*[@class="stab portability"]' \
// 'Available on crate feature extra only.'
//@ has 'it/post/fn.compute.html' '//*[@class="stab portability"]' \
// 'Available on crate feature extra and extension only.'
#[cfg(feature = "extra")]
pub use doc_auto_cfg::*;

//@ has 'it/post/index.html' '//*[@class="stab portability"]' 'addon'
//@ has 'it/post/struct.Addon.html' '//*[@class="stab portability"]' \
// 'Available on crate feature addon only.'
#[cfg(feature = "addon")]
pub use doc_auto_cfg::Type as Addon;
}

This file was deleted.

20 changes: 0 additions & 20 deletions tests/rustdoc/reexport/doc_auto_cfg-reexport-foreign-113982.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This test ensures that non-glob reexports don't get their attributes merge with
// This test ensures that non-glob reexports don't get their attributes merged with
// the reexported item whereas glob reexports do with the `doc_auto_cfg` feature.

#![crate_name = "foo"]
Expand Down
Loading