-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 should ignore unresolved imports in function bodies #97976
Comments
You've included your stable rustc version, but the given instructions use nightly. Does the issue also exist on stable? If not, could you just confirm the nightly version at issue? |
@eggyal Yes, it is also exist on stable. Issue edited. |
The problem isn't rustdoc here but your If I'm completely wrong about this, don't hesitate to reopen the issue. Closing it in the meantime. |
@GuillaumeGomez But Rustdoc promised in the Book:
This also covers import errors, doesn't it? |
This is an interesting point. We need some information. This section should be updated. Reopening the issue then. |
You can use -Ztreat-err-as-bug and RIST_BACKTRACE to find which query is invoking name resolution here. |
@jyn514 This is output. I'm not sure, it still seems to be using pass instead of query? I didn't find an overrideable query named
|
It looks like I missed this in #73566. I only ignored errors in late resolution, not early imports: rust/compiler/rustc_resolve/src/lib.rs Lines 1545 to 1550 in 3a8b014
A workaround in the meantime is to avoid #[cfg(any(all(windows, feature = "winapi"), doc))]
fn doc_me() {
let text = vec![0_u16];
let text = text.as_ptr();
unsafe { winapi::um::debugapi::OutputDebugStringW(text) }
} |
Honestly, if no one has noticed this until now, I'm inclined to just leave it broken - this entire "feature" is a giant hack anyway. |
I'm going to close this, I don't think it was ever supported even with everybody_loops and we document the limitation in https://doc.rust-lang.org/beta/rustdoc/advanced-features.html#interactions-between-platform-specific-docs. |
I tried this code:
Cargo.toml
src/main.rs
Run
cargo doc --all-features --open # or cargo +nightly doc --all-features --open
on platforms other than Windows.
I expected to see this happen: No errors in the terminal, the
doc_me
function should be displayed in the documentation page. (According to the Rustdoc documentation Interactions between platform-specific docs)Instead, this happened: Terminal outputs error:
If we change the code of
src/main.rs
to: (remove theuse
statement)It will work as expected.
Meta
rustc --version --verbose
:rustc +nightly --version --verbose
:The text was updated successfully, but these errors were encountered: