| Age | Commit message (Collapse) | Author | Lines |
|
Respect `-Z` unstable options in `rustdoc --test`
This PR makes rustdoc respect `-Z` unstable options when collecting doctests (`rustdoc --test`).
In the process I also realized that `--error-format` wasn't respected as well, making UI annotations impossible to write so I fixed that as well.
Best reviewed commit by commit.
Fixes https://github.com/rust-lang/rust/issues/147276
Fixes https://github.com/rust-lang/rust/issues/143930
r? fmease
|
|
|
|
|
|
|
|
|
|
`panic!` does not print any identifying information for threads that are
unnamed. However, in many cases, the thread ID can be determined.
This changes the panic message from something like this:
thread '<unnamed>' panicked at src/main.rs:3:5:
explicit panic
To something like this:
thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5:
explicit panic
Stack overflow messages are updated as well.
This change applies to both named and unnamed threads. The ID printed is
the OS integer thread ID rather than the Rust thread ID, which should
also be what debuggers print.
|
|
[rustdoc] Display total time and compilation time of merged doctests
Fixes rust-lang/rust#144270.
Does it look good to you `@kpreid?`
<img width="908" height="263" alt="image" src="https://github.com/user-attachments/assets/cd5d082d-c4e0-42ed-91dd-bd263b413dcd" />
|
|
|
|
|
|
|
|
|
|
|
|
Emit a warning if the doctest `main` function will not be run
Fixes #140310.
I think we could try to go much further like adding a "link" (ie UI annotations) on the `main` function in the doctest. However that will require some more computation, not sure if it's worth it or not. Can still be done in a follow-up if we want it.
For now, this PR does two things:
1. Pass the `DiagCtxt` to the doctest parser to emit the warning.
2. Correctly generate the `Span` to where the doctest is starting (I hope the way I did it isn't too bad either...).
cc `@fmease`
r? `@notriddle`
|
|
r=GuillaumeGomez
rustdoc: Replace unstable flag `--doctest-compilation-args` with a simpler one: `--doctest-build-arg`
Tracking issue: https://github.com/rust-lang/rust/issues/134172.
Context: https://github.com/rust-lang/rust/pull/137096#issuecomment-2776318800
Yeets the ad hoc shell-like lexer for 'nested' program arguments.
No FCP necessary since the flag is unstable.
I've chosen to replace `compilation` with `build` because it's shorter (you now need to pass it multiple times in order to pass many arguments to the doctest compiler, so it matters a bit) and since I prefer it esthetically.
**Issue**: Even though we don't process the argument passed to `--doctest-build-arg`, we end up passing it via an argument file (`rustc `@argfile`)` which delimits arguments by line break (LF or CRLF, [via](https://doc.rust-lang.org/rustc/command-line-arguments.html#path-load-command-line-flags-from-a-path)) meaning ultimately the arguments still get split which is unfortunate. Still, I think this change is an improvement over the status quo.
I'll update the tracking issue if/once this PR merges. I'll also add the (CR)LF issue to 'unresolved question'.
r? GuillaumeGomez
r? notriddle
|
|
|
|
|
|
|
|
Fix detection of main function if there are expressions around it
Fixes #140162.
Fixes #139651.
Once this is merged, we can backport and I'll send a follow-up to emit a warning in case a `main` function is about to be "wrapped" (and therefore not run).
r? `@fmease`
try-job: x86_64-mingw-1
|
|
|
|
a function
|
|
|
|
|
|
|
|
`--doctest-build-arg`
More notably, the value of the new flag does *not* get lexed shell-like and ad hoc.
|
|
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
|
|
|
|
Fix 2024 edition doctest panic output
Fixes #137970.
The problem was that the output was actually displayed by rustc itself because we're exiting with `Result<(), String>`, and the display is really not great. So instead, we get the output, we print it and then we return an `ExitCode`.
r? ````@aDotInTheVoid````
|
|
|
|
|
|
Greatly simplify doctest parsing and information extraction
The original process was pretty terrible, as it tried to extract information such as attributes by performing matches over tokens like `#!`, which doesn't work very well considering you can have `# ! [`, which is valid.
Also, it now does it in one pass: if the parser is happy, then we try to extract information, otherwise we return early.
r? `@fmease`
|
|
outside of wrapping function
|
|
add necessary lines
fix ui test error
|
|
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
|
|
This prevents the included test case from getting at nightly-only
features when run on stable. The harness builds with
RUSTC_BOOTSTRAP, but the bundle doesn't.
|
|
|
|
|
|
rustdoc: Fix flaky doctest test
Fixes #135660.
|
|
|
|
|
|
Signed-off-by: peicuiping <ezc5@sina.cn>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r=GuillaumeGomez
rustdoc: make doctest span tweak a 2024 edition change
Fixes #132203
This is a compatibility hack, because I think the new behavior is better. When an A `include_str!` B, and B `include_str!` C, the path to C should be resolved relative to B, not A. That's how `include!` itself works, so that's how `include_str!` with should work.
|
|
|