Skip to content

Rollup of 7 pull requests #129006

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

Closed
wants to merge 84 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
a282e52
Unify run button display with "copy code" button and with mdbook buttons
GuillaumeGomez Jul 30, 2024
be71bd9
Update GUI tests for code example buttons
GuillaumeGomez Jul 30, 2024
e2da2fb
Update rustdoc tests
GuillaumeGomez Jul 30, 2024
59cb159
Prevent clicking on a link or on a button to toggle the code example …
GuillaumeGomez Jul 30, 2024
bb5d83d
Clean up rustdoc make_test function code
GuillaumeGomez Jun 8, 2024
15454a9
Add `DocTest` type
GuillaumeGomez Jun 8, 2024
fd66bc3
Simplify doctest tests
GuillaumeGomez Jun 8, 2024
1f8be6e
Split doctests between standalone and mergeable ones
GuillaumeGomez Jun 8, 2024
4589010
Split standalone and mergeable doctests
GuillaumeGomez Jun 8, 2024
1d44d58
Split doctests into two categories: mergeable ones and standalone ones
GuillaumeGomez Jun 10, 2024
8010f43
Only merge doctests starting 2024 edition
GuillaumeGomez Jun 10, 2024
93e7b82
Add new doc codeblock `standalone` attribute
GuillaumeGomez Jun 10, 2024
9f67385
Add documentation for the doctest `standalone` attribute
GuillaumeGomez Apr 30, 2024
3aa9608
Prevent merged doctests to break stdin if the generated file is too big
GuillaumeGomez Jun 10, 2024
40334f6
If there is any AST error with a doctest, we make it a standalone test
GuillaumeGomez Jun 10, 2024
29f4ee9
Correctly handle the case where there is no doctests to run
GuillaumeGomez Jun 10, 2024
7403c2b
Correctly handle doctests with invalid AST
GuillaumeGomez Jun 10, 2024
8f0c9b2
Add/update `rustdoc-ui` tests to check new merged doctests
GuillaumeGomez Jun 10, 2024
366d78e
Add new `run-make` tests for doctests
GuillaumeGomez Jun 10, 2024
3f899ad
Simplify `has_main_fn` to be a boolean instead of a `Option<Span>`
GuillaumeGomez Jun 10, 2024
8e96523
Greatly improve handling of doctests attributes, making it possible t…
GuillaumeGomez Jun 12, 2024
948d17f
Don't merge doctests with `#[global_allocator]`
GuillaumeGomez Jun 13, 2024
2379d23
Fix weird memory allocation failure in merged doctests by storing doc…
GuillaumeGomez Jun 13, 2024
23dc792
Make merged doctests run in their own process
GuillaumeGomez Jun 13, 2024
5e4aad8
Don't change indent in merged doctests
GuillaumeGomez Jun 14, 2024
9dbc84a
Mark location doctest as standalone since file information will not w…
GuillaumeGomez Jun 14, 2024
3632fcf
Correctly handle `internal_features` attribute
GuillaumeGomez Jun 15, 2024
9448e0e
If no argument is provided to merged doctests binary, they will be ru…
GuillaumeGomez Jun 18, 2024
b1aa96a
Only show rustdoc doctest compilation output if `nocapture` is used
GuillaumeGomez Jun 18, 2024
b7a0d2b
Disable merged doctests by default
GuillaumeGomez Jun 18, 2024
6b57b17
Correctly handle macros using `$crate` in merged doctests
GuillaumeGomez Jun 19, 2024
7286d97
Add 2024 edition doctests to cover corner cases
GuillaumeGomez Jun 19, 2024
7471156
Improve code by removing unneeded function arguments
GuillaumeGomez Jun 20, 2024
b4e3659
Add documentation on `DocTest` and `RunnableDoctest` structs
GuillaumeGomez Jun 20, 2024
486fe80
Run mergeable doctest as part of standalone doctests if there is only…
GuillaumeGomez Jun 20, 2024
b55e9b0
Reduce merged doctest source code size
GuillaumeGomez Jun 20, 2024
59d3b71
Rename `DocTest` into `DocTestBuilder`
GuillaumeGomez Jun 23, 2024
e7ff92f
If there are crate attributes, we prevent doctest to be merged with o…
GuillaumeGomez Jun 23, 2024
0ed4e62
Improve code readability
GuillaumeGomez Jun 24, 2024
b92ad6f
Remove need for `unsafe` code in merged doctests
GuillaumeGomez Jul 8, 2024
c66731f
Don't special-case if there is only one merged doctest
GuillaumeGomez Jul 8, 2024
c8280b4
Unify naming of `DocTest`
GuillaumeGomez Jul 9, 2024
8a065b6
Move `is_multiple_tests` argument into `RunnableDocTest`
GuillaumeGomez Jul 9, 2024
60a7936
Improve documentation for internal doctest API
GuillaumeGomez Jul 9, 2024
530a646
Add more merged doctests tests
GuillaumeGomez Jul 9, 2024
d57e6b5
Add doctest to ensure that doctests with crate-level attributes are n…
GuillaumeGomez Jul 11, 2024
7989409
Only keep "useful" code in `tests/rustdoc-ui/2024-doctests-checks.rs`
GuillaumeGomez Jul 11, 2024
10143bb
Fix commands syntax in rustdoc-ui tests
GuillaumeGomez Jul 12, 2024
80d4ccc
Run fmt
GuillaumeGomez Jul 29, 2024
1a256bf
Update `tests/run-make/doctests-keep-binaries-2024/rmake.rs` test to …
GuillaumeGomez Jul 29, 2024
fcaa14e
Ignore cross compile check for `tests/run-make/doctests-keep-binaries…
GuillaumeGomez Aug 7, 2024
03ee7b5
Move verbose help parsing to `main`
Kobzol Aug 9, 2024
5431a93
Pass `Flags` to `Config::parse` explicitly
Kobzol Aug 9, 2024
f83b085
rustc_attr: remove redundant `#[allow(rustc::untranslatable_diagnosti…
GrigorenkoPV Aug 7, 2024
43f3a21
rustc_const_eval: remove redundant `#[allow(rustc::untranslatable_dia…
GrigorenkoPV Aug 7, 2024
3a18c6b
rustc_const_eval: make message about "const stable" translatable
GrigorenkoPV Aug 7, 2024
a11922d
rustc_const_eval: make LazyLock suggestion translatable
GrigorenkoPV Aug 7, 2024
c36b21a
rustc_attr: make "compact `cfg(target(..))` is unstable" translatable
GrigorenkoPV Aug 7, 2024
334a097
rustc_ast_lowering: make "using `_` for array lengths is unstable" tr…
GrigorenkoPV Aug 7, 2024
290df4f
rustc_ast_lowering: make "yield syntax is experimental" translatable
GrigorenkoPV Aug 7, 2024
6760298
rustc_ast_lowering: make asm-related unstability messages translatable
GrigorenkoPV Aug 7, 2024
48413cf
rustc_borrowck: make dereference suggestion translatable
GrigorenkoPV Aug 8, 2024
446e03e
rustc_borrowck: make suggestion to move closure translatable
GrigorenkoPV Aug 8, 2024
1b6cc24
rustc_borrowck: make some suggestion about static lifetimes translatable
GrigorenkoPV Aug 8, 2024
1481ab3
rustc_borrowck: make "implicit static" suff translatable
GrigorenkoPV Aug 8, 2024
f43cdce
rustc_borrowck: fmt
GrigorenkoPV Aug 8, 2024
fbc2459
rustc_expand: remove some redundant `#[allow(rustc::untranslatable_di…
GrigorenkoPV Aug 8, 2024
1373074
rustc_expand: make a message translatable
GrigorenkoPV Aug 8, 2024
cbae581
rustc_interface: remove a redundant `#[allow(rustc::untranslatable_di…
GrigorenkoPV Aug 8, 2024
2babab6
rustc_lint: remove some redundant `#[allow(rustc::untranslatable_diag…
GrigorenkoPV Aug 8, 2024
d548636
rustc_metadata: remove a redundant `#[allow(rustc::untranslatable_dia…
GrigorenkoPV Aug 8, 2024
007cc2c
rustc_metadata: make "link {arg,cfg} is unstable" translatable
GrigorenkoPV Aug 8, 2024
fcdb374
rustc_passes: remove a redundant `#[allow(rustc::untranslatable_diagn…
GrigorenkoPV Aug 9, 2024
f09a2b0
rustc_passes: make some messages in check_attr translatable
GrigorenkoPV Aug 9, 2024
03b6c2f
Fix and enable disabled codegen-units tests
saethlin Aug 10, 2024
68ff453
std::fs::get_path freebsd update.
devnexen Aug 11, 2024
c361c92
Use assert_matches around the compiler
compiler-errors Aug 11, 2024
0d8f56d
Rollup merge of #126245 - GuillaumeGomez:doctest-improvement-v2, r=t-…
GuillaumeGomez Aug 12, 2024
b7b66a3
Rollup merge of #128394 - GuillaumeGomez:run-button, r=t-rustdoc
GuillaumeGomez Aug 12, 2024
3a64051
Rollup merge of #128878 - Kobzol:refactor-flags, r=onur-ozkan
GuillaumeGomez Aug 12, 2024
418f475
Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=n…
GuillaumeGomez Aug 12, 2024
4009df9
Rollup merge of #128929 - saethlin:enable-codegen-units-tests, r=comp…
GuillaumeGomez Aug 12, 2024
8bbf05c
Rollup merge of #128967 - devnexen:get_path_fbsd_upd, r=joboet
GuillaumeGomez Aug 12, 2024
beea4ff
Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu
GuillaumeGomez Aug 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add DocTest type
  • Loading branch information
GuillaumeGomez committed Aug 7, 2024
commit 15454a96de3a152be9438ef51ec8918f4c530023
12 changes: 6 additions & 6 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::{panic, str};

pub(crate) use make::make_test;
pub(crate) use make::DocTest;
pub(crate) use markdown::test as test_markdown;
use rustc_ast as ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
Expand Down Expand Up @@ -732,13 +732,12 @@ fn doctest_run_fn(
unused_externs.lock().unwrap().push(uext);
};
let edition = scraped_test.edition(&rustdoc_options);
let (full_test_code, full_test_line_offset, supports_color) = make_test(
&scraped_test.text,
Some(&global_opts.crate_name),
let doctest = DocTest::new(&scraped_test.text, Some(&global_opts.crate_name), edition);
let (full_test_code, full_test_line_offset) = doctest.generate_unique_doctest(
scraped_test.langstr.test_harness,
&global_opts,
edition,
Some(&test_opts.test_id),
Some(&global_opts.crate_name),
);
let runnable_test = RunnableDoctest {
full_test_code,
Expand All @@ -747,7 +746,8 @@ fn doctest_run_fn(
global_opts,
scraped_test,
};
let res = run_test(runnable_test, &rustdoc_options, supports_color, report_unused_externs);
let res =
run_test(runnable_test, &rustdoc_options, doctest.supports_color, report_unused_externs);

if let Err(err) = res {
match err {
Expand Down
Loading