about summary refs log tree commit diff
path: root/src/librustdoc/scrape_examples.rs
AgeCommit message (Collapse)AuthorLines
2022-02-18Rollup merge of #93497 - willcrichton:rustdoc-scrape-test, r=GuillaumeGomezMatthias Krüger-4/+11
Pass `--test` flag through rustdoc to rustc so `#[test]` functions can be scraped As a part of stabilizing the scrape examples extension in Cargo, I uncovered a bug where examples cannot be scraped from tests. See this test: https://github.com/rust-lang/cargo/pull/10343/files#diff-27aa4f012ebfebaaee61498d91d2370de460628405d136b05e77efe61e044679R2496 The issue is that when rustdoc is run on a test file, because `--test` is not passed as a rustc option, then functions annotated with `#[test]` are ignored by the compiler. So this PR changes rustdoc so when `--test` is passed in conjunction with a `--scrape-example-<suffix>` flag, then the `test` field of `rustc_interface::Config` is true. r? `@camelid`
2022-02-16Adopt let_else in even more placesest31-3/+1
2022-02-11Add --scrape-tests flags so rustdoc can scrape examples from testsWill Crichton-4/+11
2022-02-08Rollup merge of #93568 - willcrichton:scrape-examples-leading-whitespace, ↵Matthias Krüger-1/+4
r=CraftSpider Include all contents of first line of scraped item in Rustdoc This fixes #93528. When scraping examples, it extends the span of the enclosing item to include all characters up to the start of the first line of the span. r? `@camelid`
2022-02-03rustdoc: clippy::complexity fixesMatthias Krüger-2/+1
clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
2022-02-01Include all contents of first line of scraped itemWill Crichton-1/+4
2022-01-22Make `Decodable` and `Decoder` infallible.Nicholas Nethercote-1/+1
`Decoder` has two impls: - opaque: this impl is already partly infallible, i.e. in some places it currently panics on failure (e.g. if the input is too short, or on a bad `Result` discriminant), and in some places it returns an error (e.g. on a bad `Option` discriminant). The number of places where either happens is surprisingly small, just because the binary representation has very little redundancy and a lot of input reading can occur even on malformed data. - json: this impl is fully fallible, but it's only used (a) for the `.rlink` file production, and there's a `FIXME` comment suggesting it should change to a binary format, and (b) in a few tests in non-fundamental ways. Indeed #85993 is open to remove it entirely. And the top-level places in the compiler that call into decoding just abort on error anyway. So the fallibility is providing little value, and getting rid of it leads to some non-trivial performance improvements. Much of this commit is pretty boring and mechanical. Some notes about a few interesting parts: - The commit removes `Decoder::{Error,error}`. - `InternIteratorElement::intern_with`: the impl for `T` now has the same optimization for small counts that the impl for `Result<T, E>` has, because it's now much hotter. - Decodable impls for SmallVec, LinkedList, VecDeque now all use `collect`, which is nice; the one for `Vec` uses unsafe code, because that gave better perf on some benchmarks.
2022-01-21Remove a span from hir::ExprKind::MethodCallCameron Steffen-1/+1
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-3/+4
2022-01-15Return a LocalDefId in get_parent_item.Camille GILLOT-1/+3
2021-12-11Don't emit shared files when scraping dependenciesWill Crichton-1/+2
2021-11-27Add trace statementsDeadbeef-0/+2
2021-11-27Fix another ICE in rustdoc scrape_examplesDeadbeef-6/+9
2021-11-07Auto merge of #90635 - matthiaskrgr:rustdoc_compl, r=GuillaumeGomezbors-1/+1
rustdoc: clippy::complexity fixes
2021-11-05rustdoc: clippy::complexity fixesMatthias Krüger-1/+1
2021-11-04Fix ICE when rustdoc is scraping examples inside of a proc macroWill Crichton-9/+20
2021-11-04Sort scraped call locations before serializingWill Crichton-0/+7
2021-10-29Fix rare ICE during typeck in rustdoc scrape_examplesWill Crichton-2/+18
2021-10-12Fix local crate not being scrapedWill Crichton-8/+12
2021-10-08Change handling of spans in scrape examples, add test for highlight decorationsWill Crichton-3/+5
2021-10-08Move more scrape-examples logic from JS to rustWill Crichton-1/+2
Fix failing test Add missing backslash Fix padding issue with horizontal scrollbar
2021-10-06Update to latest rustc and rustdoc stylesWill Crichton-1/+1
2021-10-06Change serialized format to use DefPathHash instead of custom StringWill Crichton-11/+3
Move test to rustdoc-ui Fix test writing to wrong directory Formatting Fix test Add FIXME Remove raw multiline strings
2021-10-06Add target crates as inputs to reduce size of intermediatesWill Crichton-5/+58
Add tests for module-path remapping and scrape example options Find all crates with a given name
2021-10-06Incorporate jyn's feedbackWill Crichton-62/+68
* Move call location logic from function constructor to rendering * Fix issue with macro spans in scraping examples * Clean up example loading logic Documentation / newtype for DecorationInfo Fix line number display Serialize edition of call site, other small cleanup
2021-10-06Move highlighting logic from JS to RustWill Crichton-21/+41
Continue migrating JS functionality Cleanup Fix compile error Clean up the diff Set toggle font to sans-serif
2021-10-06Sort examples by sizeWill Crichton-1/+29
Improve styling Start to clean up code, add comments
2021-10-06Generate example source files with corresponding linksWill Crichton-48/+86
Add display name Fix remaining merge conflicts Only embed code for items containing examples
2021-10-06Factor scraping and rendering into separate calls to rustdocWill Crichton-79/+63
Simplify toggle UI logic, add workspace root for URLs
2021-10-06Fix check issueWill Crichton-5/+5
Clean up tidy checks
2021-10-06Add updated support for example-analyzerWill Crichton-0/+138
Move rendering of examples into Finalize design Cleanup, rename found -> scraped Softer yellow Clean up dead code Document scrape_examples More simplification and documentation Remove extra css Test