Nicholas Nethercote
701ccd3ead
Remove HirCollector::sess.
...
It's redundant w.r.t. `HirCollector::tcx`. This removes the unnecessary
`'a` lifetime.
2024-09-25 20:48:43 +10:00
Michael Goulet
c682aa162b
Reformat using the new identifier sorting from rustfmt
2024-09-22 19:11:29 -04:00
Matthias Krüger
732ad59779
Rollup merge of #129988 - arnaudgolfouse:modify-locale_resources, r=davidtwco
...
Use `Vec` in `rustc_interface::Config::locale_resources`
This allows a third-party tool to injects its own resources, when receiving the config via `rustc_driver::Callbacks::config`.
2024-09-17 17:28:32 +02:00
EtomicBomb
3782251c2c
librustdoc::config: removed Input from Options
...
The `librustdoc::config::Options` struct no longer includes
`rustc_session::config::Input`. This is so that Input can be optional.
In rfc#3662, the crate input is not required if `--merge=finalize`.
Replacing Input with Option<Input> was decided against. In most places
that Input is needed, it should be statically known to not be optional
(means fewer unwraps). We just want to have an Input-free Options in
librustdoc::main_args, where we can run the write shared procedure.
2024-09-07 18:57:48 -04:00
arnaudgolfouse
13d56dc160
Use a Vec in rustc_interface::Config::locale_resources
...
This allows a third-party tool to injects its own resources,
when receiving the config via `rustc_driver::Callbacks::config`.
2024-09-05 16:49:38 +02:00
Matthias Krüger
893d073a2e
Rollup merge of #129774 - nnethercote:rm-extern-crate-tracing-remainder, r=GuillaumeGomez
...
Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt
A follow-up to #129767 and earlier PRs doing this for `rustc_*` crates.
r? ```@GuillaumeGomez```
2024-08-31 14:46:12 +02:00
Nicholas Nethercote
37d1ce91b5
Remove #[macro_use] extern crate tracing from rustdoc.
2024-08-30 13:16:08 +10:00
Guillaume Gomez
8683439a20
Fix clippy lints
2024-08-29 12:14:41 +02:00
Guillaume Gomez
05fb8ff4f5
Fix intra-doc link
2024-08-13 20:14:58 +02:00
Guillaume Gomez
c9f730e223
Improve documentation for internal doctest API
2024-08-13 20:14:57 +02:00
Guillaume Gomez
baf8ce83b8
Move is_multiple_tests argument into RunnableDocTest
2024-08-13 20:14:57 +02:00
Guillaume Gomez
ab3d90e037
Unify naming of DocTest
2024-08-13 20:14:57 +02:00
Guillaume Gomez
4b1db071d1
Don't special-case if there is only one merged doctest
2024-08-13 20:14:56 +02:00
Guillaume Gomez
a3bc2c7478
Improve code readability
2024-08-13 20:14:56 +02:00
Guillaume Gomez
ffc18c5cfb
Rename DocTest into DocTestBuilder
2024-08-13 20:14:56 +02:00
Guillaume Gomez
d512438435
Run mergeable doctest as part of standalone doctests if there is only one
2024-08-13 20:14:56 +02:00
Guillaume Gomez
bfabf1db44
Add documentation on DocTest and RunnableDoctest structs
2024-08-13 20:14:56 +02:00
Guillaume Gomez
6d552ba446
Improve code by removing unneeded function arguments
2024-08-13 20:14:56 +02:00
Guillaume Gomez
112e44740e
Disable merged doctests by default
2024-08-13 20:14:55 +02:00
Guillaume Gomez
0bd2c99ce8
Only show rustdoc doctest compilation output if nocapture is used
2024-08-13 20:14:55 +02:00
Guillaume Gomez
0f0681e941
Make merged doctests run in their own process
2024-08-13 20:14:54 +02:00
Guillaume Gomez
6eabffbaec
Greatly improve handling of doctests attributes, making it possible to merge doctests more efficiently
2024-08-13 20:14:54 +02:00
Guillaume Gomez
03118fa80a
Simplify has_main_fn to be a boolean instead of a Option<Span>
2024-08-13 20:14:54 +02:00
Guillaume Gomez
7ec3cabe17
Correctly handle doctests with invalid AST
2024-08-13 20:14:54 +02:00
Guillaume Gomez
59a9e0986d
Correctly handle the case where there is no doctests to run
2024-08-13 20:14:54 +02:00
Guillaume Gomez
a0ae8ac861
If there is any AST error with a doctest, we make it a standalone test
...
To do so, AST error detection was improved in order to not filter out
too many doctests.
2024-08-13 20:14:54 +02:00
Guillaume Gomez
b7079c5c83
Prevent merged doctests to break stdin if the generated file is too big
2024-08-13 20:14:53 +02:00
Guillaume Gomez
3147520d34
Add new doc codeblock standalone attribute
2024-08-13 20:14:53 +02:00
Guillaume Gomez
58cd70e062
Only merge doctests starting 2024 edition
2024-08-13 20:14:53 +02:00
Guillaume Gomez
6ae3524835
Split doctests into two categories: mergeable ones and standalone ones
2024-08-13 20:14:53 +02:00
Guillaume Gomez
96051f20e2
Split standalone and mergeable doctests
2024-08-13 20:14:53 +02:00
Guillaume Gomez
39f029a852
Split doctests between standalone and mergeable ones
2024-08-13 20:14:53 +02:00
Guillaume Gomez
5e244370fe
Add DocTest type
2024-08-13 20:14:53 +02:00
Esteban Küber
95c1c34fff
review comments
2024-08-08 14:58:52 +00:00
Esteban Küber
ae696f847d
Split ColorConfig off of HumanReadableErrorType
...
The previous setup tied two unrelated things together. Splitting these two is a better model.
2024-08-08 14:41:33 +00:00
Nicholas Nethercote
84ac80f192
Reformat use declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Oli Scherer
7ba82d61eb
Use a dedicated type instead of a reference for the diagnostic context
...
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18 15:42:11 +00:00
Edward Shen
d9f78cb793
rustdoc: Add support for --remap-path-prefix
...
Adds --remap-path-prefix as an unstable option. This is implemented to
mimic the behavior of rustc's --remap-path-prefix but with minor
adjustments.
This flag similarly takes in two paths, a prefix to replace and a
replacement string.
2024-06-09 10:34:54 -07:00
Noah Lev
d06a05e262
Move logic for "making" doctests to submodule
...
This code turns the raw code given by the user into something actually
runnable, e.g. by adding a `main` function if it doesn't already exist.
I also made a couple other items private that didn't need to be
crate-public.
2024-06-07 17:51:48 +02:00
Noah Lev
0dc72d9551
Make doctests before running them; reintroduce RunnableDoctest
2024-06-07 17:48:48 +02:00
Noah Lev
366000dc07
Move some arguments to fields and reorganize fields
...
I moved some local arguments and options to either the local options
struct or, if it made sense, the global options struct.
2024-06-07 17:48:48 +02:00
Noah Lev
a429afacbc
Remove RunnableDoctest
...
It should instead be the actual input to the running logic. Currently
it's not actually quite runnable since it's still missing some
information.
2024-06-07 17:48:48 +02:00
Noah Lev
e9e2634547
Make two fields computed on-demand
2024-06-07 17:48:48 +02:00
Noah Lev
790b7e9cbf
rustdoc: Remove DoctestVisitor::get_line
...
This was used to get the line number of the first line from the current
docstring, which was then used together with an offset within the
docstring. It's simpler to just pass the offset to the visitor and have
it do the math because it's clearer and this calculation only needs to
be done in one place (the Rust doctest visitor).
2024-06-07 17:48:47 +02:00
Noah Lev
46d2aa5a8f
Remove global options from IndividualTestOptions
2024-06-07 17:48:47 +02:00
Noah Lev
279b4d22f7
Merge RustDoctest and MdDoctest into one type
2024-06-07 17:48:47 +02:00
Noah Lev
b7dd401a78
rustdoc: Extract actual doctest running logic into function
2024-06-07 17:48:47 +02:00
Noah Lev
85499ebf13
Separate doctest collection from running
2024-06-07 17:48:47 +02:00
Noah Lev
16db1a1bd0
Move Markdown-specific doctest code into submodule
2024-06-07 17:48:47 +02:00
Noah Lev
516010bd0f
Start moving format-specific code into doctest submodule
2024-06-07 17:48:45 +02:00