about summary refs log tree commit diff
path: root/tests/rustdoc-ui/doctest
AgeCommit message (Collapse)AuthorLines
2025-10-03Rollup merge of #147292 - Urgau:rustdoc-test-unstable_opts, r=fmeaseMatthias Krüger-134/+211
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
2025-10-03Add regression test for `-Zcrate-attr` in `rustdoc --test`Urgau-0/+54
2025-10-03Respect `--error-format` in `rustdoc --test`Urgau-28/+51
2025-10-03Respect `-Z` unstable options in `rustdoc --test`Urgau-119/+119
2025-09-26Add regression test for merged doctests compilation time displayGuillaume Gomez-8/+14
2025-08-06Print thread ID in panic message if thread name is unknownTrevor Gross-5/+5
`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.
2025-07-30Rollup merge of #144308 - GuillaumeGomez:merged-doctest-times, r=lolbinarycatSamuel Tardieu-92/+125
[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" />
2025-07-28feat: Right align line numbersScott Schafer-1/+1
2025-07-24Update rustdoc ui testsGuillaume Gomez-92/+125
2025-05-22Collect and use `#[doc(test(attr(..)))]` at every levelUrgau-0/+262
2025-05-22Allow `#![doc(test(attr(..)))]` doctests to be again merged togetherUrgau-3/+8
2025-05-22Collect and use `#![doc(test(attr(..)))]` at module level tooUrgau-0/+115
2025-05-22Auto merge of #140527 - GuillaumeGomez:doctest-main-fn, r=notriddlebors-0/+73
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`
2025-05-09Rollup merge of #139863 - fmease:simp-doctest-build-arg-passing, ↵Matthias Krüger-6/+5
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
2025-05-02Add regression test for #140310Guillaume Gomez-0/+43
2025-05-02Emit a warning if the doctest `main` function will not be runGuillaume Gomez-0/+30
2025-05-01rustdoc: Fix doctest heuristic for main fn wrappingLeón Orell Valerian Liehr-51/+154
2025-04-28Rollup merge of #140220 - GuillaumeGomez:doctest-main-wrapping, r=fmeaseGuillaume Gomez-27/+55
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
2025-04-27Fix bad handling of macros if there is already a `main` functionGuillaume Gomez-0/+23
2025-04-25If there is a `;` alone, we consider that the doctest needs to be put inside ↵Guillaume Gomez-27/+4
a function
2025-04-25Add rustdoc-ui regression test for #140289Guillaume Gomez-0/+72
2025-04-25Correctly display stdout and stderr in case a doctest is failingGuillaume Gomez-0/+4
2025-04-23Add regression ui test for #140162 and for #139651Guillaume Gomez-0/+28
2025-04-15Replace flag `--doctest-compilation-args` with a simpler one: ↵León Orell Valerian Liehr-6/+5
`--doctest-build-arg` More notably, the value of the new flag does *not* get lexed shell-like and ad hoc.
2025-04-14Report span of test when should_panic test failedxizheyin-1/+1
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-10replace `//@ compile-flags: --edition` with `//@ edition`Pietro Albini-4/+5
2025-04-04Rollup merge of #139328 - GuillaumeGomez:fix-panic-output-137970, r=fmeaseMatthias Krüger-0/+34
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````
2025-04-03Use `eprint!` instead of `eprintln!`Guillaume Gomez-0/+34
2025-04-03compiletest: Require `//~` annotations even if `error-pattern` is specifiedVadim Petrochenkov-1/+2
2025-03-28Rollup merge of #138104 - GuillaumeGomez:simplify-doctest-parsing, r=fmeaseMatthias Krüger-3/+32
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`
2025-03-27Correctly handle line comments in attributes and generate extern cratesGuillaume Gomez-3/+32
outside of wrapping function
2025-03-25ignore doctests only in specified targetsTakayuki Maeda-0/+20
add necessary lines fix ui test error
2025-03-14Do not suggest using `-Zmacro-backtrace` for builtin macrosEsteban Küber-2/+0
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-10doctests: build test bundle and harness separatelyMichael Howell-1/+71
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.
2025-02-16Enable relative-path-include-bytes on WindowsChris Denton-3/+3
2025-02-03Enable more tests on WindowsBen Kimock-1/+1
2025-01-20Rollup merge of #135736 - fmease:rustdoc-fix-flaky-test, r=GuillaumeGomez许杰友 Jieyou Xu (Joe)-1/+2
rustdoc: Fix flaky doctest test Fixes #135660.
2025-01-19rustdoc: Fix flaky doctest testLeón Orell Valerian Liehr-1/+2
2025-01-01Try to write the panic message with a single `write_all` callJohn Kåre Alsaker-0/+2
2024-12-31chore: fix some typospeicuiping-1/+1
Signed-off-by: peicuiping <ezc5@sina.cn>
2024-12-27Remove the `-test` suffix from normalize directivesZalathar-84/+84
2024-12-20Add test to ensure passing `--doctest_compilation_args` multiple times workGuillaume Gomez-0/+23
2024-12-20Add regression test for `--doctest-compilation-args`Guillaume Gomez-0/+18
2024-12-16Remove unneeded handling of backlines in doctest attributesGuillaume Gomez-0/+46
2024-12-16Also handle cases where attributes are unclosedGuillaume Gomez-2/+20
2024-12-16Add ui regression test for #134221Guillaume Gomez-0/+59
2024-11-28Update more 2024 tests to remove -Zunstable-optionsEric Huss-3/+3
2024-11-22Stabilize the 2024 editionEric Huss-41/+45
2024-10-30Rollup merge of #132210 - notriddle:notriddle/doctest-span-hack, ↵Jubilee-12/+86
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.
2024-10-30Ignore Windows due to its differing path syntaxMichael Howell-4/+5