about summary refs log tree commit diff
path: root/src/librustdoc/clean
AgeCommit message (Collapse)AuthorLines
2021-03-24Split clean::Constant enum into a struct and an enumGuillaume Gomez-44/+44
2021-03-24Rename clean::Constant did fields to def_idGuillaume Gomez-18/+18
2021-03-24Improve new Constant variants' nameGuillaume Gomez-20/+21
2021-03-24Rework rustdoc const typeGuillaume Gomez-46/+86
2021-03-24Rollup merge of #83415 - camelid:remove-crate-module-option, r=jyn514Dylan DPC-3/+3
Remove unnecessary `Option` wrapping around `Crate.module` I'm wondering if it was originally there so that we could `take` the module which enables `after_krate` to take an `&Crate`. However, the two impls of `after_krate` only use `Crate.name`, so we can pass just the name instead.
2021-03-23Remove another unnecessary `Option`Camelid-1/+1
The previous changes mean that we can now remove this `Option`.
2021-03-23Remove unnecessary `Option` wrapping around `Crate.module`Camelid-2/+2
I'm wondering if it was originally there so that we could `take` the module which enables `after_krate` to take an `&Crate`. However, the two impls of `after_krate` only use `Crate.name`, so we can pass just the name instead.
2021-03-23Tweak docsCamelid-1/+3
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-03-21Remove redundant docsCamelid-5/+7
...and add docs to the types instead of the fields that hold the types.
2021-03-21Rename `clean::Span::span()` to `clean::Span::inner()`Camelid-4/+4
Otherwise you get a lot of instances of `item.span.span()`, which is just plain confusing. `item.span.inner()` conveys the correct meaning of "get the type that `clean::Span` wraps".
2021-03-21Rename `clean::Item.source` to `span`Camelid-11/+17
Its type is called `clean::Span`, and also the name in the rest of rustdoc and rustc for this kind of field is `span`.
2021-03-20update `const_eval_resolve`lcnr-1/+1
2021-03-19Rollup merge of #82846 - GuillaumeGomez:doc-alias-list, r=jyn514Dylan DPC-6/+17
rustdoc: allow list syntax for #[doc(alias)] attributes Fixes https://github.com/rust-lang/rust/issues/81205. It now allows to have: ```rust #[doc(alias = "x")] // and: #[doc(alias("y", "z"))] ``` cc ``@jplatte`` r? ``@jyn514``
2021-03-18hir: Preserve used syntax in `TyKind::TraitObject`Vadim Petrochenkov-1/+1
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-1/+1
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.
2021-03-11Improve code by removing similar function calls and using loops instead for ↵Guillaume Gomez-17/+16
collecting iterators
2021-03-10Auto merge of #82960 - camelid:masked_crates, r=jyn514bors-5/+1
Remove `masked_crates` from `clean::Crate` Previously, `masked_crates` existed both on `Cache` and on `clean::Crate`. During cache population, the `clean::Crate` version was `take`n and moved to `Cache`. This change removes the version on `clean::Crate` and instead directly mutates `Cache.masked_crates` to initialize it. This has the advantage of avoiding duplication and avoiding unnecessary allocation, as well as making the flow of information through rustdoc less confusing. The one downside I see is that `clean::utils::krate()` now uses the side effect of mutating `DocContext.cache` instead of returning the data directly, but it already mutated the `Cache` for other things (e.g., `deref_trait_did`) so it's not really new behavior. Also, `clean::utils::krate()` is only called once (and is meant to only be called once since it performs expensive and potentially destructive operations) so the mutation shouldn't be an issue. Follow-up to https://github.com/rust-lang/rust/pull/82018#discussion_r584197747. cc `@jyn514`
2021-03-10Allow doc alias attributes to use both list and valueGuillaume Gomez-2/+14
2021-03-09Remove `masked_crates` from `clean::Crate`Camelid-5/+1
Previously, `masked_crates` existed both on `Cache` and on `clean::Crate`. During cache population, the `clean::Crate` version was `take`n and moved to `Cache`. This change removes the version on `clean::Crate` and instead directly mutates `Cache.masked_crates` to initialize it. This has the advantage of avoiding duplication and avoiding unnecessary allocation, as well as making the flow of information through rustdoc less confusing. The one downside I see is that `clean::utils::krate()` now uses the side effect of mutating `DocContext.cache` instead of returning the data directly, but it already mutated the `Cache` for other things (e.g., `deref_trait_did`) so it's not really new behavior. Also, `clean::utils::krate()` is only called once (and is meant to only be called once since it performs expensive and potentially destructive operations) so the mutation shouldn't be an issue.
2021-03-09Remove hir::Item::attrs.Camille GILLOT-10/+12
2021-03-09Rollup merge of #82841 - hvdijk:x32, r=joshtriplettMara Bos-1/+1
Change x64 size checks to not apply to x32. Rust contains various size checks conditional on target_arch = "x86_64", but these checks were never intended to apply to x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the conditions.
2021-03-07Rollup merge of #82803 - jyn514:unversioned-files, r=GuillaumeGomezYuki Okushi-18/+0
rustdoc: Add an unstable option to print all unversioned files This allows sharing those files between different doc invocations without having to know their names ahead of time. Helps with https://github.com/rust-lang/docs.rs/issues/1302. r? ````@GuillaumeGomez```` cc ````@pietroalbini```` ````@Nemo157````
2021-03-06Change x64 size checks to not apply to x32.Harald van Dijk-1/+1
Rust contains various size checks conditional on target_arch = "x86_64", but these checks were never intended to apply to x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the conditions.
2021-03-05Store `UNVERSIONED_FILES` in a data structureJoshua Nelson-18/+0
This allows querying it programatically.
2021-03-05Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make ↵Guillaume Gomez-4/+7
transition over hir::ItemKind simpler
2021-03-03Pass `CrateNum` by value instead of by referenceCamelid-3/+3
It's more idiomatic to pass a small Copy type by value and `CrateNum` is half the size of `&CrateNum` on 64-bit systems. The memory use change is almost certainly insignificant, but why not!
2021-03-02Rollup merge of #82597 - noslaver:fix-82137, r=nagisaYuki Okushi-15/+12
Get TyCtxt from self instead of passing as argument in AutoTraitFinder First contribution :crab:, let me know if anything is amiss. Fix #82137.
2021-03-02Rollup merge of #82593 - sunfishcode:wasi-docs, r=alexcrichtonYuki Okushi-0/+5
Teach rustdoc how to display WASI. As a followup to [this comment] in #82420, this patch teaches rustdoc how to display WASI. [this comment]: https://github.com/rust-lang/rust/pull/82420#issuecomment-784523826 r? `@alexcrichton`
2021-03-01Get TyCtxt from self instead of passing as argument in AutoTraitFinderNoam Koren-15/+12
methods
2021-03-01Remove `krate.version`; fix `crate_version` in JSONJoshua Nelson-2/+0
Previously, `JsonRenderer::after_krate` called `krate.version.clone()`. The problem was it did that after the version was already moved into the cache, so it would always be None. The fix was to get the version from the cache instead.
2021-03-01Remove the dummy cache in `DocContext`Joshua Nelson-14/+15
The same information is available everywhere; the only reason the dummy cache was needed is because it waas previously stored in three different places. This consolidates the info a bit so the cache in `DocContext` is used throughout. As a bonus, it means `renderinfo` is used much much less. - Return a `Cache` from `run_global_ctxt`, not `RenderInfo` - Remove the unused `render_info` from `run_renderer` - Remove RefCell around `inlined` - Add intra-doc links
2021-02-28Auto merge of #81349 - jyn514:blanket-impls-cleanup, r=lcnrbors-40/+31
Remove unnecessary `self_ty` parameter to `get_blanket_impls` It can be calculated when necessary at the callsite, there's no need to pass it separately. This also renames `param_env_def_id` to `item_def_id`. cc `@eddyb`
2021-02-28Remove unnecessary `self_ty` parameter to `get_blanket_impls`Joshua Nelson-40/+31
It can be calculated when necessary at the callsite, there's no need to pass it separately. This also renames `param_env_def_id` to `item_def_id`.
2021-02-27Remove the x86_64-rumprun-netbsd targetSimonas Kazlauskas-1/+0
Closes #81514
2021-02-27Teach rustdoc how to display WASI.Dan Gohman-0/+5
As a followup to [this comment] in #82420, this patch teaches rustdoc how to display WASI. [this comment]: https://github.com/rust-lang/rust/pull/82420#issuecomment-784523826
2021-02-25Auto merge of #82265 - GuillaumeGomez:cleanup-attrs-twice, r=jyn514bors-6/+23
Prevent to compute Item attributes twice I came across this case when working on another part of rustdoc. Not a game changer but a nice little improvement. cc `@camelid` r? `@jyn514`
2021-02-24Make DocContext &mut for cleanGuillaume Gomez-1/+1
2021-02-24Prevent to compute Item attributes twiceGuillaume Gomez-6/+23
2021-02-23Improve code readabilityGuillaume Gomez-9/+7
2021-02-23* Fix some typoGuillaume Gomez-5/+6
* Improve documentation * Add a test to ensure that spotlighted traits from dependencies are taken into account as expected
2021-02-23Put clean::Trait extra information into a new struct to make it more coherentGuillaume Gomez-4/+15
2021-02-23Use a qualified path to make it more clear where `list_contains_name` ↵Guillaume Gomez-2/+1
function comes from
2021-02-23Remove is_spotlight field from `Trait`Guillaume Gomez-9/+21
2021-02-22Remove many RefCells from DocContextCamelid-29/+27
I left some of them so this change doesn't balloon in size and because removing the RefCell in `DocContext.resolver` would require compiler changes. Thanks to `@jyn514` for making this a lot easier with #82020!
2021-02-20rustdoc: Remove unnecessary `Cell` around `param_env`Camelid-1/+1
2021-02-20Don't render [src] link on dummy spansGuillaume Gomez-0/+4
2021-02-19Show negative implementation of Sized traitGuillaume Gomez-90/+114
2021-02-16Make `Clean` take &mut DocContextJoshua Nelson-217/+203
- Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics` - Take `&mut DocContext` in most of `clean` - Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad. - Changes `fn sess` to properly return a borrow with the lifetime of `'tcx`, not the mutable borrow.
2021-02-16Auto merge of #81611 - cjgillot:meowner, r=estebankbors-34/+28
Only store a LocalDefId in some HIR nodes Some HIR nodes are guaranteed to be HIR owners: Item, TraitItem, ImplItem, ForeignItem and MacroDef. As a consequence, we do not need to store the `HirId`'s `local_id`, and we can directly store a `LocalDefId`. This allows to avoid a bit of the dance with `tcx.hir().local_def_id` and `tcx.hir().local_def_id_to_hir_id` mappings.
2021-02-16Rollup merge of #82163 - matthiaskrgr:slice, r=jyn514Guillaume Gomez-2/+2
avoid full-slicing slices If we already have a slice, there is no need to get another full-range slice from that, just use the original. clippy::redundant_slicing