about summary refs log tree commit diff
path: root/src/librustdoc/core.rs
AgeCommit message (Collapse)AuthorLines
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-0/+2
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-10-29rustdoc: Split effective visibilities from rustc from similar data built by ↵Vadim Petrochenkov-2/+1
rustdoc for external def-ids
2022-10-29Auto merge of #102698 - michaelwoerister:unord-collections, r=lncrbors-2/+2
Introduce UnordMap, UnordSet, and UnordBag (MCP 533) This is the start of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533). I followed `@eddyb's` suggestion of naming the collection types `Unord(Map/Set/Bag)` which is a bit easier to type than `Unordered(Map/Set/Bag)` r? `@eddyb`
2022-10-27Introduce UnordMap, UnordSet, and UnordBag (see MCP 533)Michael Woerister-2/+2
MCP 533: https://github.com/rust-lang/compiler-team/issues/533 Also, as an example, substitute UnordMap for FxHashMap in used_trait_imports query result.
2022-10-26privacy: Rename "accessibility levels" to "effective visibilities"Vadim Petrochenkov-2/+2
And a couple of other naming tweaks Related to https://github.com/rust-lang/rust/issues/48054
2022-10-24Address some commentsmejrs-2/+2
2022-10-19rustdoc: Eliminate uses of `EarlyDocLinkResolver::all_traits`Vadim Petrochenkov-15/+2
2022-10-19Implement -Ztrack-diagnosticsmejrs-0/+2
2022-10-18Remove `RunCompiler::emitter`.Nicholas Nethercote-2/+0
It's no longer used.
2022-10-01rustdoc: adopt to the new lint APIMaybe Waffle-6/+2
2022-09-27rustdoc: remove `clean::TraitWithExtraInfo`Michael Howell-5/+3
Instead, it gathers the extra info later, when it's actually requested.
2022-09-27rustc_typeck to rustc_hir_analysislcnr-1/+1
2022-09-14change AccessLevels representationBryanskiy-4/+1
2022-07-29Change maybe_body_owned_by to take local def idMiguel Guarniz-1/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-22Make some clean::Trait fields computation on demandGuillaume Gomez-2/+1
2022-07-16Correctly handle usage of private items in public API for JSON output formatGuillaume Gomez-0/+3
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-8/+8
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13Auto merge of #99066 - est31:remove_box_librustdoc, r=jshabors-1/+1
Remove most box syntax from librustdoc This is the second attempt after the librustdoc specific changes have been reverted from #87781 in #89134, due to a minor, but exant regression caused by the changes. ~~There have been some changes to librustdoc in the past and maybe thanks to them there is no regression any more. If there is still a regression, one can investigate further and maybe find ways to fix the regressions. Thus, i request a perf run.~~ Edit: turns out there is still a regression, but it's caused only by a subset of the changes. So I've changed this PR to only contains the changes that don't cause any performance regressions, keeping the regression causing changes for a later PR.
2022-07-11Remove box syntax from Box<function pointer> constructionest31-1/+1
The function pointer should be extremely small, close to pointer size.
2022-07-06session: `output-width` -> `diagnostic-width`David Wood-5/+5
Rename the `--output-width` flag to `--diagnostic-width` as this appears to be the preferred name within the compiler team. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06session: `terminal-width` -> `output-width`David Wood-5/+5
Rename the `--terminal-width` flag to `--output-width` as the behaviour doesn't just apply to terminals (and so is slightly less accurate). Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06sess: stabilize `--terminal-width`David Wood-2/+5
Formerly `-Zterminal-width`, `--terminal-width` allows the user or build tool to inform rustc of the width of the terminal so that diagnostics can be truncated. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-3/+3
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-34/+42
2022-05-08Support `#[expect]` attributes for rustdoc lints (RFC 2383)xFrednet-0/+4
2022-04-19rustdoc: Cache preprocessed markdown linksVadim Petrochenkov-2/+2
2022-04-19rustdoc: Optimize and refactor doc link resolutionVadim Petrochenkov-1/+4
- Cache doc link resolutions obtained early - Cache markdown links retrieved from doc strings early - Rename and restructure the code in early doc link resolution to be closer to #94857
2022-04-16Rename `def_id` into `item_id` when the type is `ItemId` for readabilityGuillaume Gomez-3/+3
2022-04-13errors: lazily load fallback fluent bundleDavid Wood-1/+1
Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-07rustdoc: Early doc link resolution fixes and refactoringsVadim Petrochenkov-1/+3
2022-04-05session: opt for enabling directionality markersDavid Wood-1/+1
Add an option for enabling and disabling Fluent's directionality isolation markers in output. Disabled by default as these can render in some terminals and applications. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: implement sysroot/testing bundle loadingDavid Wood-1/+4
Extend loading of Fluent bundles so that bundles can be loaded from the sysroot based on the language requested by the user, or using a nightly flag. Sysroot bundles are loaded from `$sysroot/share/locale/$locale/*.ftl`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: implement fallback diagnostic translationDavid Wood-0/+3
This commit updates the signatures of all diagnostic functions to accept types that can be converted into a `DiagnosticMessage`. This enables existing diagnostic calls to continue to work as before and Fluent identifiers to be provided. The `SessionDiagnostic` derive just generates normal diagnostic calls, so these APIs had to be modified to accept Fluent identifiers. In addition, loading of the "fallback" Fluent bundle, which contains the built-in English messages, has been implemented. Each diagnostic now has "arguments" which correspond to variables in the Fluent messages (necessary to render a Fluent message) but no API for adding arguments has been added yet. Therefore, diagnostics (that do not require interpolation) can be converted to use Fluent identifiers and will be output as before.
2022-03-16rustc_error: make ErrorReported impossible to constructmark-1/+1
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-02-25Wire up --check-cfg to rustdocLoïc BRANSTETT-1/+3
2022-02-18Rollup merge of #93915 - Urgau:rfc-3013, r=petrochenkovMatthias Krüger-0/+1
Implement --check-cfg option (RFC 3013), take 2 This pull-request implement RFC 3013: Checking conditional compilation at compile time (https://github.com/rust-lang/rfcs/pull/3013) and is based on the previous attempt https://github.com/rust-lang/rust/pull/89346 by `@mwkmwkmwk` that was closed due to inactivity. I have address all the review comments from the previous attempt and added some more tests. cc https://github.com/rust-lang/rust/issues/82450 r? `@petrochenkov`
2022-02-18Rollup merge of #93497 - willcrichton:rustdoc-scrape-test, r=GuillaumeGomezMatthias Krüger-0/+3
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-16Implement --check-cfg option (RFC 3013)Loïc BRANSTETT-0/+1
Co-authored-by: Urgau <lolo.branstett@numericable.fr> Co-authored-by: Marcelina Kościelnicka <mwk@0x04.net>
2022-02-13Remove Config::stderrbjorn3-1/+0
1. It captured stdout and not stderr 2. It isn't used anywhere 3. All error messages should go to the DiagnosticOutput instead 4. It modifies thread local state
2022-02-11Add --scrape-tests flags so rustdoc can scrape examples from testsWill Crichton-0/+3
2022-01-25rustdoc: Pre-calculate traits that are in scope for doc linksVadim Petrochenkov-8/+5
This eliminates one more late use of resolver
2022-01-21rustdoc: Make some `pub` items crate-privateNoah Lev-2/+2
They don't need to be `pub`. Making them crate-private improves code clarity and `dead_code` linting.
2022-01-18Rollup merge of #92947 - vacuus:rustdoc-core-visit-path, r=camelidMatthias Krüger-3/+3
rustdoc: Use `intersperse` in a `visit_path` function (~~Is there a better way to word the title?~~ Eh, this works, I guess.) I'm surprised that the compiler didn't complain when I left out the `.to_string()`, but hey, if it works then it works.
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-5/+5
2022-01-15Remove `collect`Roc Yu-3/+3
2022-01-07rustdoc: Introduce a resolver cache for sharing data between early doc link ↵Vadim Petrochenkov-56/+34
resolution and later passes
2021-12-28rustc_metadata: Encode list of all crate's traits into metadataVadim Petrochenkov-4/+2
2021-12-20Auto merge of #91900 - pitaj:fix-91714, r=jyn514bors-42/+12
rustdoc: make `--passes` and `--no-defaults` have no effect Fixes #91714 One potential issue is that currently there is no stable way to achieve `--document-hidden-items`. This affects test `issue-15347`. I also had to modify the tests `issue-42875` and `no-compiler-export`. Regardless of combinations of `--document-hidden-items` and `--document-private-items`, I was unable to get these to pass without the modifications. I left behind a comment noting the change.
2021-12-18Remove `collapsed` fieldJoshua Nelson-3/+0
`render/context` always runs after `run_global_context`, so it was always set to `true`. This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was removed ages ago, and the ability to configure passes is about to be removed.
2021-12-15rustdoc: remove `--passes` and `--no-defaults`Peter Jaszkowiak-42/+12
- flags no longer function, see #44136 - adjust tests to match new behavior - removed test issue-42875 (covered regression with --no-defaults) - moved input-format to removed flags - move all removed flags to bottom - note flag removal in command help - remove DefaultPassOption enum (now redundant with `show_coverage`)