-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Duplicate extern crate
in doc tests (2021-11-21 Nightly Regression)
#91134
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Oh, I think I got misled by the "rustdoc" bit. |
I can't reproduce this. I tried /// ```
/// extern crate inner;
/// ```
pub trait Trait {
type Item;
} and running |
The failure is https://github.com/rust-bitcoin/rust-lightning/blob/main/lightning/src/chain/transaction.rs#L24 You can see the first failure in CI at https://github.com/rust-bitcoin/rust-lightning/runs/4288660534?check_suite_focus=true |
The following seems like a minimal reproduction when used with 2015: /// ```
/// extern crate mycrate;
/// mycrate::foo();
/// ```
pub fn foo() {} Bisected to #91026. |
cc @notriddle , I think it might make sense to revert #91026 temporarily unless you already have an idea for a fix. |
…emicolon, r=jyn514 fix(doctest): detect extern crate items in statement doctests This partially reverts rust-lang#91026, because rustdoc needs to detect the extern statements, even when they appear inside implicit `main()`. It does not entirely revert it, so the old bug is still fixed, by duplicating some of the logic from `parse_mod` instead of trying to use it directly. Fixes rust-lang#91134
Strictly speaking this is motivated by a nightly compile failure. Tracked at: (rust-lang/rust#91134). However, it is no longer the style in Rust 2018 and not in 2021 either so it's better to remove it from the newbie targeted resources.
We have a Rust-2015 doc test which has an
extern crate $CRATE_DOC_TEST_IS_IN
which started failing to build on nightly 2021-11-21 (but passes on stable/2021-11-20).It now fails with
The text was updated successfully, but these errors were encountered: