summary refs log tree commit diff
path: root/src/librustdoc/lib.rs
AgeCommit message (Collapse)AuthorLines
2020-11-06Auto merge of #75778 - AndyGauge:75521-rustdoc-book-improvements, r=jyn514bors-0/+1
75521 rustdoc book improvements Added some guidelines about documenting with rustdoc Fixes #75521
2020-11-04Added Rustdoc book sections for linting and embedding more examplesAndrew Gauger-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-28rustdoc: Fix some nitsIan Jackson-2/+2
* Remove a needless comma in the Rust code * Replace double spaces after full stops with single spaces Requested-by: @GuillaumeGomez Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28rustdoc: Provide a --default-theme THEME optionIan Jackson-0/+10
This is a fairly simple special case of --default-eetting. We must set both "theme" and "use-system-theme". Providing it separately enables us to document a way to set the theme without expoosing the individual settings keywords, which are quite complex. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28rustdoc: Provide a general --default-setting SETTING[=VALUE] optionIan Jackson-0/+10
We just plumb through what the user tells us. This is flagged as unstable, mostly because I don't understand the compatibility rules that rustdoc obeys for local storage data, and how error handling of invalid data works. We collect() the needed HashMap from Vec of Vecs of (key, value) pairs, so that there is a nice place to add new more-specific options. It would have been possible to use Extend::extend but doing it this way ensures that all the used inputs are (and will stay) right next to each other. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-20Remove unused type from librustdocGuillaume Gomez-9/+0
2020-10-08Allow generic parameters in intra-doc linksCamelid-0/+2
The contents of the generics will be mostly ignored (except for warning if fully-qualified syntax is used, which is currently unsupported in intra-doc links - see issue #74563). * Allow links like `Vec<T>`, `Result<T, E>`, and `Option<Box<T>>` * Allow links like `Vec::<T>::new()` * Warn on * Unbalanced angle brackets (e.g. `Vec<T` or `Vec<T>>`) * Missing type to apply generics to (`<T>` or `<Box<T>>`) * Use of fully-qualified syntax (`<Vec as IntoIterator>::into_iter`) * Invalid path separator (`Vec:<T>:new`) * Too many angle brackets (`Vec<<T>>`) * Empty angle brackets (`Vec<>`) Note that this implementation *does* allow some constructs that aren't valid in the actual Rust syntax, for example `Box::<T>new()`. That may not be supported in rustdoc in the future; it is an implementation detail.
2020-09-15Add a comment why rustdoc loads crates from the sysrootJoshua Nelson-1/+5
2020-09-14Add a comment why `extern crate` is necessary for rustdocJoshua Nelson-2/+6
2020-08-31Fix strings indentGuillaume Gomez-11/+11
2020-08-27Rename rustdoc/test -> rustdoc/doctestAleksey Kladov-2/+2
This modules contains the implementation of doctests, and not the tests of rustdoc itself. This name is confusing, so let's rename it to doctest for clarity.
2020-08-25Rename debugging_options -> debugging_opts to match rustcJoshua Nelson-2/+2
This way the rustdoc field names are the same as the rustc field names.
2020-08-23Use underscores instead of spacesJoshua Nelson-2/+2
2020-08-23Time how long it takes to render HTMLJoshua Nelson-5/+5
2020-08-22stabilize ptr_offset_fromRalf Jung-1/+0
2020-08-19Allow reusing the code in `collect_trait_impls`Joshua Nelson-0/+1
2020-08-05Auto merge of #75124 - nnethercote:clean-up-rustdoc-main, r=oli-obkbors-60/+51
Clean up rustdoc's `main()` It can be simplified and made more similar to rustc's `main()`. r? @oli-obk
2020-08-05Be smarter about error handling in `run()`.Nicholas Nethercote-4/+2
`run()` returns `Result<(), String>`. But on failure it always returns an empty string, and then `wrap_return()` treats an empty string specially, by not reporting the error. It turns out we already have the `ErrorReported` type for this sort of behaviour. This commit changes `run()` to use it.
2020-08-05Remove `setup_callbacks_and_run_in_default_thread_pool_with_globals()`.Nicholas Nethercote-1/+3
It's a very thin wrapper around `setup_callbacks_and_run_in_thread_pool_with_globals()` and it has a single call site.
2020-08-05Avoid an unnecessary thread creation at rustdoc startup.Nicholas Nethercote-55/+46
rustdoc's `main()` immediately spawns a thread, M, with a large stack (16MiB or 32MiB) on which it runs `main_args()`. `main_args()` does a small amount of options processing and then calls `setup_callbacks_and_run_in_default_thread_pool_with_globals()`, which spawns it own thread, and M is not used further. So, thread M seems unnecessary. However, it does serve a purpose: if the options processing in `main_args()` panics, that panic is caught when M is joined. So M can't simply be removed. However, `main_options()`, which is called by `main_args()`, has a `catch_fatal_errors()` call within it. We can move that call to `main()` and change it to the very similar `catch_with_exit_code()`. With that in place, M can be removed, and panics from options processing will still be caught appropriately. Even better, this makes rustdoc's `main()` match rustc's `main()`, which also uses `catch_with_exit_code()`. (Also note that the use of a 16MiB/32MiB stack was eliminated from rustc in #55617.)
2020-08-04Remove log alias from librustdocIvan Tham-1/+1
2020-08-02Fix logging for rustdocJoshua Nelson-1/+1
2020-07-31Make rustdoc share the logger initialization routine with rustc.Oliver Scherer-2/+2
2020-07-30Update driver to add json backendJoseph Ryan-14/+30
2020-07-29Refactor DocFS to fix error handling bugsJoseph Ryan-3/+8
2020-07-27More requested changesJoseph Ryan-3/+3
2020-07-27Make requested changesJoseph Ryan-1/+1
2020-07-27Extract `Cache` and other types from `html` moduleJoseph Ryan-13/+2
2020-07-27Refactor html backend to use generic interfaceJoseph Ryan-1/+4
2020-07-27Move `Error` and `RenderInfo` out of `html` moduleJoseph Ryan-1/+3
2020-07-15Don't ICE on infinitely recursive typesJoshua Nelson-0/+2
`evaluate_obligation` can only be run on types that are already valid. So rustdoc still has to run typeck even though it doesn't care about the result.
2020-07-15Don't ICE on errors in function returning impl traitJoshua Nelson-0/+1
Instead, report the error. This emits the errors on-demand, without special-casing `impl Trait`, so it should catch all ICEs of this kind, including ones that haven't been found yet. Since the error is emitted during type-checking there is less info about the error; see comments in the code for details. - Add test case for -> impl Trait - Add test for impl trait with alias - Move EmitIgnoredResolutionErrors to rustdoc This makes `fn typeck_item_bodies` public, which is not desired behavior. That change should be removed once https://github.com/rust-lang/rust/pull/74070 is merged. - Don't visit nested closures twice
2020-07-10Change some function names.Nicholas Nethercote-1/+4
A couple of these are quite long, but they do a much better job of explaining what they do, which was non-obvious before.
2020-07-10Eliminate `rust_input`.Nicholas Nethercote-31/+23
It has a single call site and having it as a separate (higher-order!) function makes the code harder to read.
2020-07-02Remove render-redirect-pages option in rustdocGuillaume Gomez-7/+0
2020-06-20Remove uses of `Vec::remove_item`Lukas Kalbertodt-1/+0
2020-06-13Clean up some weird command stringsGuillaume Gomez-9/+7
2020-05-09End unification of exit codes in librustdocGuillaume Gomez-9/+18
2020-05-08Clean up rustdoc source codeGuillaume Gomez-1/+7
2020-04-16Dogfood or_patterns in rustdocJosh Stone-0/+1
2020-04-11Depend on getopts from crates.ioLuca Barbieri-1/+1
rustc_session exports it for other crates to avoid mismatching crate versions.
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-1/+1
2020-03-24rustc: remove rustc_hir_pretty dependency.Mazdak Farrokhzad-0/+1
2020-03-23Rollup merge of #69494 - GuillaumeGomez:stabilize-crate-version, ↵Mazdak Farrokhzad-1/+1
r=ehuss,aleksator,ollie27 Stabilize --crate-version option in rustdoc I don't see any reason to not stabilize it anymore, so let's go! cc @kinnison @ehuss r? @ollie27
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-2/+2
2020-03-14Make downstream crates compile.Camille GILLOT-0/+1
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-1/+1
2020-02-29Make it build againVadim Petrochenkov-1/+1
2020-02-26Stabilize --crate-version option in rustdocGuillaume Gomez-1/+1
2020-02-16Other crates.Camille GILLOT-0/+1