Skip to content

Commit 6c747e0

Browse files
committed
Fix tests after revert of rustdoc cfg(test) feature
1 parent 6cc42ce commit 6c747e0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/test/rustdoc-ui/cfg-test.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
// compile-flags:--test
33
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
44

5+
// Crates like core have doctests gated on `cfg(not(test))` so we need to make
6+
// sure `cfg(test)` is not active when running `rustdoc --test`.
7+
58
/// this doctest will be ignored:
69
///
710
/// ```
811
/// assert!(false);
912
/// ```
10-
#[cfg(not(test))]
13+
#[cfg(test)]
1114
pub struct Foo;
1215

1316
/// this doctest will be tested:
1417
///
1518
/// ```
1619
/// assert!(true);
1720
/// ```
18-
#[cfg(test)]
21+
#[cfg(not(test))]
1922
pub struct Foo;

src/test/rustdoc-ui/cfg-test.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/cfg-test.rs - Foo (line 15) ... ok
3+
test $DIR/cfg-test.rs - Foo (line 18) ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
66

0 commit comments

Comments
 (0)