-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
doctests marked with 'no_run' permit ICEs #49514
Comments
rustdoc stops compilation after analysis for no_run Lines 261 to 263 in f1c21b0
|
@rust-lang/rustdoc What do y'all think? Should we try to compile |
Sounds weird. |
I don't see much point in compiling these. The tradeoff "you occasionally discover bugs in the compiler and can't run your tests" doesn't seem worth "your tests always take longer to run". |
@Manishearth suggested adding an attribute that means "compile fully, but don't run" (e.g. |
Thinking more about it I don't actually think people will want to use that, but what people might want is to have security in knowing their code isn't ice prone. Which ... Most of the causes for ICEs specific to a certain library's code are typically related to analysis, so maybe this is fine. I'm not sure. |
FWIW, this is more than just about ICEs. Any errors that only appear after analysis will not be caught. There is the opposite problem with the For example, this passes, but the code doesn't compile: //! ```no_run
//! let a: u8 = 42;
//! let b = ((a | 0x0F) - 1) >> 31 > 0;
//! println!("{}", b);
//! ``` This is a general problem with "check" style compilation, so it is not necessarily unique to rustdoc, but it does cause confusion when it doesn't work. See #49292 and #70923 and all the duplicates linked to those for examples of code that can check but not build. |
irc discussion: https://botbot.me/mozilla/rust-docs/2018-03-30/?msg=98430464&page=1
run this example: https://doc.rust-lang.org/nightly/std/fs/fn.read_string.html
at the time of writing it ICEs, but doctests don't catch it because it's marked
no_run
The text was updated successfully, but these errors were encountered: