-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustdoc doesn't execute documentation tests for #[target_feature] functions #49723
Comments
I wonder if it has to do with #49225? I checked the sample with the nightlies that were made right before and after the change. The previous nightly finds the test, the next nightly does not: $ rustdoc +nightly-2018-03-21 --test h.rs
running 1 test
test h.rs - foo (line 7) ... FAILED
failures:
---- h.rs - foo (line 7) stdout ----
thread 'rustc' panicked at 'test executable failed:
thread 'main' panicked at 'assertion failed: false', h.rs:3:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.
', librustdoc/test.rs:331:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failures:
h.rs - foo (line 7)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
$ rustdoc +nightly-2018-03-24 --test h.rs
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out |
Oh wait, it's not that change, it's #48759 - it dynamically adds |
@QuietMisdreavus can we revert the part of #48759 that adds |
After some conversations on IRC, we discovered that rustdoc doesn't add target features to the configuration environment when extracting and running doctests. I've opened #49864 to fix this. |
…ures, r=GuillaumeGomez add target features when extracting and running doctests When rendering documentation, rustdoc will happily load target features into the cfg environment from the current target, but fails to do this when doing anything with doctests. This would lead to situations where, thanks to rust-lang#48759, functions tagged with `#[target_feature]` couldn't run doctests, thanks to the automatic `#[doc(cfg(target_feature = "..."))]`. Currently, there's no way to pass codegen options to rustdoc that will affect its rustc sessions, but for now this will let you use target features that come default on the platform you're targeting. Fixes rust-lang#49723
Example:
The text was updated successfully, but these errors were encountered: