Skip to content
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

Fix doc_auto_cfg for impl blocks in different modules with different cfg #101279

Merged
merged 2 commits into from
Sep 2, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Add regression test for #101129
  • Loading branch information
GuillaumeGomez committed Sep 1, 2022
commit 68d0094305b4bebb96ef9d4c111fca256c1b0b4f
24 changes: 24 additions & 0 deletions src/test/rustdoc/doc_auto_cfg_nested_impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Regression test for <https://github.com/rust-lang/rust/issues/101129>.

#![feature(doc_auto_cfg)]
#![crate_type = "lib"]
#![crate_name = "foo"]

pub struct S;
pub trait MyTrait1 {}
pub trait MyTrait2 {}

// @has foo/struct.S.html
// @has - '//*[@id="impl-MyTrait1-for-S"]//*[@class="stab portability"]' \
// 'Available on non-crate feature coolstuff only.'
#[cfg(not(feature = "coolstuff"))]
impl MyTrait1 for S {}

#[cfg(not(feature = "coolstuff"))]
mod submod {
use crate::{S, MyTrait2};
// This impl should also have the `not(feature = "coolstuff")`.
// @has - '//*[@id="impl-MyTrait2-for-S"]//*[@class="stab portability"]' \
// 'Available on non-crate feature coolstuff only.'
impl MyTrait2 for S {}
}