summary refs log tree commit diff
path: root/src/librustdoc/clean
AgeCommit message (Collapse)AuthorLines
2024-11-20Auto merge of #133212 - lcnr:questionable-uwu, r=compiler-errorsbors-9/+7
continue `ParamEnv` to `TypingEnv` transition cc #132279 r? `@compiler-errors`
2024-11-19rustdoc: yeet `TypingEnv::from_param_env`lcnr-9/+7
2024-11-19move `fn is_item_raw` to `TypingEnv`lcnr-1/+1
2024-11-19Introduce `min_generic_const_args` and directly represent pathsNoah Lev-7/+8
Co-authored-by: Boxy UwU <rust@boxyuwu.dev> Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-6/+11
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-13Rollup merge of #132302 - fmease:rustdoc-better-vis-for-macro-decl, r=notriddleMatthias Krüger-32/+14
rustdoc: Treat declarative macros more like other item kinds Apparently at some time in the past we were unable to generate an href for the module path inside the visibility of decl macros 2.0 (`pub(in ...)`). As a result of this, a whole separate function was introduced specifically for printing the visibility of decl macros that didn't attempt to generate any links. The description of PR https://github.com/rust-lang/rust/pull/84074 states: > This fixes the overly-complex invariant mentioned in https://github.com/rust-lang/rust/pull/83237#issuecomment-815346570, where the macro source can't have any links in it only because the cache hasn't been populated yet. I can no longer reproduce the original issue. Reusing the existing visibility rendering logic *seems* to work just fine (I couldn't come up with any counterexamples, though I invite you to prove me wrong). * Fixes #83000 * Fixes the visibility showing up "twice" in rustdoc-JSON output: Once as the `visibility` field, once baked into the source[^1] * Fixes `#[doc(hidden)]` not getting rendered on doc(hidden) decl macros 2.0 under `--document-hiden-items` (for decl macros 1.2 the issue remains; I will address this separately when fixing #132304). --- <details><summary>Outdated Section</summary> NOTE: The current version of this PR is committing a UI crime, I'd like to receive feedback on that. Maybe you have a satisfactory solution for how to remedy it. Namely, as you know we have two different ways of / modes for highlighting code with color: 1. Only highlighting links / item paths and avoiding to highlight tokens by kind like keywords (to reduce visual noise and maybe also artifact size). Used for item declarations(\*). 2. Highlighting tokens by kind. Used for code blocks written by the user. (\*): With the notable exception being macro declarations! Well, since this PR reuses the same function for rendering the item visibility (which only makes sense), we have a clash of modes: We now use both ways of highlighting code for decl macros: №1 for the visibility, №2 for the rest. This awkward. See for yourself: * On master: ![Screenshot 2024-10-29 at 03-37-48 by_example_vis_named in decl_macro a b c - Rust](https://github.com/user-attachments/assets/22f0ab6e-9ba9-4c4e-8fb0-0741c91d360b) * On this branch: ![Screenshot 2024-10-29 at 03-36-41 by_example_vis_named in decl_macro a b c - Rust](https://github.com/user-attachments/assets/b11d81a3-3e2e-43cb-a5b8-6773a3048732) </details> Furthermore, we now no longer syntax-highlight declarative macros (be it `macro_rules!` or `macro`) since that was inconsistent with the way we render all other item kinds. See (collapsed) *Outdated Section* above. See also https://github.com/rust-lang/rust/pull/132302#discussion_r1821310783. | On master | On this branch | |---|---| | ![Screenshot 2024-11-13 at 16-12-46 by_example_vis_named in decl_macro a b c - Rust](https://github.com/user-attachments/assets/cb3aeb42-a56d-4ced-80d9-f2694f369af1) | ![Screenshot 2024-11-13 at 16-13-22 by_example_vis_named in decl_macro a b c - Rust](https://github.com/user-attachments/assets/b73bee50-1b85-4862-afba-5ad471443ccc) | [^1]: E.g., `"visibility":{"restricted":{"parent":1,"path":"::a"}},/*OMITTED*/,"inner":{"macro":"pub(in a) macro by_example_vis_named($foo:expr) {\n ...\n}"}`
2024-11-13rustdoc: Treat decl macros like other itemsLeón Orell Valerian Liehr-32/+14
2024-11-11[perf] rustdoc: Perform less work when cleaning parenthesized generic argsLeón Orell Valerian Liehr-25/+19
2024-11-06Clean middle generics using paren sugar if trait has rustc_paren_sugarMichael Goulet-1/+1
2024-11-05Auto merge of #132580 - compiler-errors:globs, r=Noratriebbors-16/+20
Remove unnecessary pub enum glob-imports from `rustc_middle::ty` We used to have an idiom in the compiler where we'd prefix or suffix all the variants of an enum, for example `BoundRegionKind`, with something like `Br`, and then *glob-import* that enum variant directly. `@noratrieb` brought this up, and I think that it's easier to read when we just use the normal style `EnumName::Variant`. This PR is a bit large, but it's just naming. The only somewhat opinionated change that this PR does is rename `BorrowKind::Imm` to `BorrowKind::Immutable` and same for the other variants. I think these enums are used sparingly enough that the extra length is fine. r? `@noratrieb` or reassign
2024-11-04Rename `DocContext::is_json` into `DocContext::is_json_output`Guillaume Gomez-2/+2
2024-11-04Fix invalid coverage computation when `--output-format=json` is enabledGuillaume Gomez-2/+2
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-4/+8
2024-11-04ty::KContainer -> ty::AssocItemContainer::KMichael Goulet-12/+12
2024-11-03Rename the FIXMEs, remove a few that dont matter anymoreMichael Goulet-2/+2
2024-11-01rustdoc: Directly use rustc_abi instead of reexportsJubilee Young-4/+3
rustc_target reexports a lot of things that are in rustc_abi, but that will be over soon and now is probably a good time to switch. Uses of rustc_target remain where they inquire about the target tuple.
2024-10-30Remap impl-trait lifetimes on HIR instead of AST lowering.Camille GILLOT-1/+1
2024-10-29update toolslcnr-5/+5
2024-10-26expand: Stop using artificial `ast::Item` for macros loaded from metadataVadim Petrochenkov-20/+6
2024-10-26Rollup merge of #132168 - fee1-dead-contrib:fxclean, r=compiler-errorsMatthias Krüger-1/+0
Effects cleanup - removed extra bits from predicates queries that are no longer needed in the new system - removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers r? compiler-errors
2024-10-26Effects cleanupDeadbeef-1/+0
- removed extra bits from predicates queries that are no longer needed in the new system - removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
2024-10-25tcx.is_const_fn doesn't work the way it is described, remove itRalf Jung-2/+2
Then we can rename the _raw functions to drop their suffix, and instead explicitly use is_stable_const_fn for the few cases where that is really what you want.
2024-10-25Re-do recursive const stability checksRalf Jung-10/+6
Fundamentally, we have *three* disjoint categories of functions: 1. const-stable functions 2. private/unstable functions that are meant to be callable from const-stable functions 3. functions that can make use of unstable const features This PR implements the following system: - `#[rustc_const_stable]` puts functions in the first category. It may only be applied to `#[stable]` functions. - `#[rustc_const_unstable]` by default puts functions in the third category. The new attribute `#[rustc_const_stable_indirect]` can be added to such a function to move it into the second category. - `const fn` without a const stability marker are in the second category if they are still unstable. They automatically inherit the feature gate for regular calls, it can now also be used for const-calls. Also, several holes in recursive const stability checking are being closed. There's still one potential hole that is hard to avoid, which is when MIR building automatically inserts calls to a particular function in stable functions -- which happens in the panic machinery. Those need to *not* be `rustc_const_unstable` (or manually get a `rustc_const_stable_indirect`) to be sure they follow recursive const stability. But that's a fairly rare and special case so IMO it's fine. The net effect of this is that a `#[unstable]` or unmarked function can be constified simply by marking it as `const fn`, and it will then be const-callable from stable `const fn` and subject to recursive const stability requirements. If it is publicly reachable (which implies it cannot be unmarked), it will be const-unstable under the same feature gate. Only if the function ever becomes `#[stable]` does it need a `#[rustc_const_unstable]` or `#[rustc_const_stable]` marker to decide if this should also imply const-stability. Adding `#[rustc_const_unstable]` is only needed for (a) functions that need to use unstable const lang features (including intrinsics), or (b) `#[stable]` functions that are not yet intended to be const-stable. Adding `#[rustc_const_stable]` is only needed for functions that are actually meant to be directly callable from stable const code. `#[rustc_const_stable_indirect]` is used to mark intrinsics as const-callable and for `#[rustc_const_unstable]` functions that are actually called from other, exposed-on-stable `const fn`. No other attributes are required.
2024-10-24Implement const effect predicate in new solverMichael Goulet-1/+3
2024-10-24Remove associated type based effects logicMichael Goulet-10/+5
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-3/+3
2024-10-22Represent TraitBoundModifiers as distinct parts in HIRMichael Goulet-9/+14
2024-10-19Fix testsMichael Goulet-3/+3
2024-10-16Auto merge of #131797 - matthiaskrgr:rollup-lzpze2k, r=matthiaskrgrbors-7/+6
Rollup of 9 pull requests Successful merges: - #130989 (Don't check unsize goal in MIR validation when opaques remain) - #131657 (Rustfmt `for<'a> async` correctly) - #131691 (Delay ambiguous intra-doc link resolution after `Cache` has been populated) - #131730 (Refactor some `core::fmt` macros) - #131751 (Rename `can_coerce` to `may_coerce`, and then structurally resolve correctly in the probe) - #131753 (Unify `secondary_span` and `swap_secondary_and_primary` args in `note_type_err`) - #131776 (Emscripten: Xfail backtrace ui tests) - #131777 (Fix trivially_copy_pass_by_ref in stable_mir) - #131778 (Fix needless_lifetimes in stable_mir) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-16Rollup merge of #131691 - GuillaumeGomez:intra-doc-link-filter-out-2, ↵Matthias Krüger-7/+6
r=notriddle Delay ambiguous intra-doc link resolution after `Cache` has been populated Fixes https://github.com/rust-lang/rust/issues/130233. I was getting nowhere with #130278. I took a wrong turn at some point and ended making way too many changes so instead I started again back from 0 and this time it worked out as expected. r? ```@notriddle```
2024-10-16Rollup merge of #131594 - fmease:rustdoc-mv-obj-safe-dyn-compat, r=notriddleMatthias Krüger-1/+1
rustdoc: Rename "object safe" to "dyn compatible" Supersedes #126554: 1. In line with [T-lang's latest resolution](https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118). 2. More comprehensive: Not only updates user-facing text but also source code. Part of #130852. Doesn't update rustdoc-JSON (will be filed separately). r? `@notriddle` (rust-lang/lang-team#286) `@GuillaumeGomez` (for visibility)
2024-10-16rustdoc: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-10-14Delay ambiguous intra-doc link resolution after `Cache` has been populatedGuillaume Gomez-7/+6
2024-10-14Move trait bound modifiers into hir::PolyTraitRefMichael Goulet-4/+4
2024-10-07Auto merge of #131235 - ↵bors-25/+25
codemountains:rename-nestedmetaitem-to-metaitemlnner, r=nnethercote Rename `NestedMetaItem` to `MetaItemInner` Fixes #131087 r? `@nnethercote`
2024-10-06Rename NestedMetaItem to MetaItemInnercodemountains-25/+25
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-8/+8
2024-10-04rm `ItemKind::OpaqueTy`Noah Lev-10/+2
This introduce an additional collection of opaques on HIR, as they can no longer be listed using the free item list.
2024-10-04Rollup merge of #131034 - Urgau:cfg-true-false, r=nnethercoteGuillaume Gomez-22/+44
Implement RFC3695 Allow boolean literals as cfg predicates This PR implements https://github.com/rust-lang/rfcs/pull/3695: allow boolean literals as cfg predicates, i.e. `cfg(true)` and `cfg(false)`. r? `@nnethercote` *(or anyone with parser knowledge)* cc `@clubby789`
2024-10-04Adjust rustdoc for literal boolean supportUrgau-22/+44
2024-10-02Remove redundant in_trait from hir::TyKind::OpaqueDefMichael Goulet-1/+1
2024-09-30rustdoc: rewrite stability inheritance as a passLukas Markeffsky-41/+17
2024-09-30add `stable_since` convenienceLukas Markeffsky-4/+1
2024-09-27Rollup merge of #130826 - fmease:compiler-mv-obj-safe-dyn-compat, ↵Matthias Krüger-1/+1
r=compiler-errors Compiler: Rename "object safe" to "dyn compatible" Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118. Tracking issue: https://github.com/rust-lang/rust/issues/130852 Excludes `compiler/rustc_codegen_cranelift` (to be filed separately). Includes Stable MIR. Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language). r? ghost
2024-09-25de-rc external traitsLukas Markeffsky-7/+4
Don't keep the `external_traits` as shared mutable data between the `DocContext` and `clean::Crate`. Instead, move the data over when necessary. This allows us to get rid of a borrowck hack in the `DocVisitor`.
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-09-24Rollup merge of #130798 - lukas-code:doc-stab, r=notriddleTrevor Gross-1/+39
rustdoc: inherit parent's stability where applicable It is currently not possible for a re-export to have a different stability (https://github.com/rust-lang/rust/issues/30827). Therefore the standard library uses a hack when moving items like `std::error::Error` or `std::net::IpAddr` into `core` by marking the containing module (`core::error` / `core::net`) as unstable or stable in a later version than the items the module contains. Previously, rustdoc would always show the *stability as declared* for an item rather than the *stability as publicly reachable* (i.e. the features required to actually access the item), which could be confusing when viewing the docs. This PR changes it so that we show the stability of the first unstable parent or the most recently stabilized parent instead, to hopefully make things less confusing. fixes https://github.com/rust-lang/rust/issues/130765 screenshots: ![error in std](https://github.com/user-attachments/assets/2ab9bdb9-ed81-4e45-a832-ac7d3ba1be3f) ![error in core](https://github.com/user-attachments/assets/46f46182-5642-4ac5-b92e-0b99a8e2496d)
2024-09-24rustdoc: inherit parent's stability where applicableLukas Markeffsky-1/+39
2024-09-24Fix toolsMichael Goulet-4/+4
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-91/+83