Closed
Description
Simplest to see in action:
C:\Users\steve\tmp> cat foo.rs
/// ```
/// #![feature(box_syntax)]
///
/// let five = box 5;
/// ```
///
pub fn passes() {}
/// ```
/// // a comment
/// #![feature(box_syntax)]
///
/// let five = box 5;
/// ```
///
pub fn fails() {}
C:\Users\steve\tmp> rustdoc --test foo.rs
running 2 tests
test foo.rs - fails (line 9) ... FAILED
test foo.rs - passes (line 1) ... ok
failures:
---- foo.rs - fails (line 9) stdout ----
error[E0658]: box expression syntax is experimental; you can call `Box::new` instead. (see issue #49733)
--> foo.rs:13:12
|
6 | let five = box 5;
| ^^^^^
|
= help: add #![feature(box_syntax)] to the crate attributes to enable
thread 'foo.rs - fails (line 9)' panicked at 'couldn't compile the test', librustdoc\test.rs:325:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failures:
foo.rs - fails (line 9)
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
including the comment means that everything gets wrapped in a main, which means the feature flag is wrapped in a main, and therefore doesn't turn on. this is very confusing.