summary refs log tree commit diff
path: root/src/librustdoc/clean
AgeCommit message (Collapse)AuthorLines
2020-09-17Ignore rustc_private items from std docsLzu Tao-9/+10
Apply suggestions from code review Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-24hir: consistent use and naming of lang itemsDavid Wood-7/+7
This commit adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. Signed-off-by: David Wood <david@davidtw.co>
2020-08-22rustdoc: Add support for associated items even outside the impl itselfJoshua Nelson-1/+10
Previously, associated items would only be available for linking directly on the `impl Trait for Type`. Now they can be used anywhere. - Make `item` for resolve mandatory - Refactor resolving associated items into a separate function - Remove broken trait_item logic - Don't skip the type namespace for associated items - Only call `variant_field` for `TypeNS` - Add test for associated items - Use exhaustive matches instead of wildcards Wildcards caused several bugs while implementing this.
2020-08-22rustdoc: Rename misleading functionJoshua Nelson-1/+1
- `is_associated` -> `is_type_alias` `is_associated` is not a good name for what this is doing. If you look at https://github.com/rust-lang/rust/pull/74489/files#diff-6a301d597807ee441a41e7237800563dR296, is_associated() and as_assoc_kind() do completely different things, but from the name it sounds like they're similar.
2020-08-19xpy fmtJoshua Nelson-4/+5
2020-08-19Use `impls` for intra doc links as wellJoshua Nelson-1/+1
2020-08-19Allow reusing the code in `collect_trait_impls`Joshua Nelson-53/+78
2020-08-19impl_for_type -> PrimitiveType::implsJoshua Nelson-57/+59
2020-08-19Return all impls, not just the primary oneJoshua Nelson-10/+31
2020-08-19Say `tcx.lang_items()` lessJoshua Nelson-20/+21
2020-08-19Refactor `impl_for_type` into a separate functionJoshua Nelson-29/+34
2020-08-17Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obkbors-6/+6
rust_ast::ast => rustc_ast Rework of #71199 which is a rework #70621 Still working on this but just made the PR to track progress r? @Dylan-DPC
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-6/+6
2020-08-16rustdoc: clean `QPath::LangItem`David Wood-0/+21
This commit adds support for cleaning `QPath::LangItem` and `hir::GenericBound::LangItemTrait` in rustdoc. `QPath::LangItem` does not require lowering, and `hir::GenericBound::LangItemTrait` is lowered to a `GenericBound::TraitBound`. Signed-off-by: David Wood <david@davidtw.co>
2020-08-14Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwcoTyler Mandry-6/+6
merge `as_local_hir_id` with `local_def_id_to_hir_id` `as_local_hir_id` was defined as just calling `local_def_id_to_hir_id` and I think that having two different ways to call the same method is somewhat confusing. Don't really care about which of these 2 methods we want to keep. Does this require an MCP, considering that these methods are fairly frequently used?
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-6/+6
2020-08-13Add Array Impl Lang Item in various placeskadmin-1/+1
Add basic test And also run fmt which is where the other changes are from Fix mut issues These only appear when running tests, so resolved by adding mut Swap order of forget Add pub and rm guard impl Add explicit type to guard Add safety note Change guard type from T to S It should never have been T, as it guards over [MaybeUninit<S>; N] Also add feature to test
2020-08-11Feature gate is always presentMark Rousskov-2/+2
2020-08-10Auto merge of #74936 - GuillaumeGomez:const-rustc_const_unstable, r=jyn514bors-5/+23
Don't print "const" keyword on non-nightly build if rustc_const_unstable is used on the item Fixes #74579.
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-1/+1
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Rollup merge of #75237 - nbdd0121:rustdoc, r=jyn514Yuki Okushi-18/+24
Display elided lifetime for non-reference type in doc In edition 2018 we encourage writing `<'_>` explicitly, so rustdoc should display like such as well. Fixes #75225 ~~Somehow when I run the compiled rustdoc using `cargo +stage2 doc` on other crates, it correctly produces `<'_>`, but I couldn't get the std doc to do the same with `./x.py doc --stage 2`. Might this be related to the recent change to x.py about how the doc is built?~~
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-1/+1
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-07Display elided lifetime for external pathsGary Guo-4/+7
2020-08-07Display elided lifetime for non-reference type in docGary Guo-14/+17
2020-08-07Auto merge of #74627 - petrochenkov:docbeauty2, r=Aaron1011bors-4/+5
rustc_ast: Stop using "string typing" for doc comment tokens Explicitly store their kind and style retrieved during lexing in the `token::DocComment`. Also don't "beautify" doc comments before converting them to `#[doc]` attributes when passing them to macros (both declarative and procedural). The trimming of empty lines, lines containing only `*`s, etc is purely a rustdoc's job as a part of its presentation of doc strings to users, rustc must not do this and must pass tokens as precisely as possible internally.
2020-08-06Rollup merge of #75079 - jyn514:disambiguator, r=ManishearthManish Goregaokar-0/+3
Disallow linking to items with a mismatched disambiguator Closes https://github.com/rust-lang/rust/issues/74851 r? @Manishearth
2020-08-06rustc_expand: Don not beautify doc comments before passing them to macrosVadim Petrochenkov-10/+7
Beautify all doc strings in rustdoc instead, including those in `#[doc]` attributes
2020-08-06rustc_ast: Stop using "string typing" for doc comment tokensVadim Petrochenkov-5/+9
Explicitly store their kind and style retrieved during lexing in the token
2020-08-04Add missing "is_min_const_fn" calls to prevent "const" to be displayed if ↵Guillaume Gomez-5/+23
the "rustc_const_unstable" attribute is present
2020-08-04rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`Vadim Petrochenkov-16/+16
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc
2020-08-02Keep the previous behavior of `register_res`Joshua Nelson-0/+3
Now that we're returning the `Res` of the associated item, not the trait itself, it got confused.
2020-07-31fix rustdoc generic param orderBastian Kauschke-28/+13
2020-07-30Auto merge of #74929 - Manishearth:rollup-z2vflrp, r=Manishearthbors-4/+4
Rollup of 10 pull requests Successful merges: - #74742 (Remove links to rejected errata 4406 for RFC 4291) - #74819 (Point towards `format_spec`; it is in other direction) - #74852 (Explain why inlining default ToString impl) - #74869 (Make closures and generators a must use types) - #74873 (symbol mangling: use ty::print::Print for consts) - #74902 (Remove deprecated unstable `{Box,Rc,Arc}::into_raw_non_null` functions) - #74904 (Fix some typos in src/librustdoc/clean/auto_trait.rs) - #74910 (fence docs: fix example Mutex) - #74912 (Fix broken link in unstable book `plugin`) - #74927 (Change the target data layout to specify more values) Failed merges: r? @ghost
2020-07-29Auto merge of #73767 - P1n3appl3:rustdoc-formats, r=tmandrybors-3/+4
Refactor librustdoc html backend This PR moves several types out of the librustdoc::html module so that they can be used by a future json backend. These changes are a re-implementation of [some work done 6 months ago](https://github.com/rust-lang/rust/compare/master...GuillaumeGomez:multiple-output-formats) by @GuillaumeGomez. I'm currently working on said json backend and will put up an RFC soon with the proposed implementation. There are a couple of changes that are more substantial than relocating structs to a different module: 1. The `Cache` is no longer part of the `html::render::Context` type and therefor it needs to be explicitly passed to any functions that access it. 2. The driving function `html::render::run` has been rewritten to use the `FormatRenderer` trait which should allow different backends to re-use the driving code. r? @GuillaumeGomez cc @tmandry @betamos
2020-07-29Fix some typos in src/librustdoc/clean/auto_trait.rsJosh Triplett-4/+4
2020-07-27Extract `Cache` and other types from `html` moduleJoseph Ryan-3/+4
2020-07-27fix rustdocBastian Kauschke-24/+14
2020-07-27introduce PredicateAtomBastian Kauschke-35/+27
2020-07-27this might be unqualified, but at least it's now quantifiedBastian Kauschke-8/+9
2020-07-27fix rustdocBastian Kauschke-12/+20
2020-07-27rustdocBastian Kauschke-31/+36
2020-07-27`PredicateKint` -> `PredicateKind`, the beginning of the endBastian Kauschke-1/+1
2020-07-20Migrate rustc_depr uses to use deprecation attributeMark Rousskov-14/+4
This should not be a change in behavior.
2020-07-19Only skip impls of foreign unstable traitsMark Rousskov-3/+5
Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.
2020-07-16Rollup merge of #74370 - Manishearth:re-spotlight, r=GuillaumeGomezManish Goregaokar-1/+6
Reintroduce spotlight / "important traits" feature (Reopened version of https://github.com/rust-lang/rust/pull/74111 because Github is broken, see discussion there) Fixes https://github.com/rust-lang/rust/issues/73785 This PR reintroduces the "spotlight" ("important traits") feature. A couple changes have been made: As there were concerns about its visibility, it has been moved to be next to the return type, as opposed to being on the side. It also no longer produces a modal, it shows the traits on hover, and it can be clicked on to pin the hover bubble. ![image](https://user-images.githubusercontent.com/1617736/86674555-a82d2600-bfad-11ea-9a4a-a1a9ffd66ae5.png) ![image](https://user-images.githubusercontent.com/1617736/86674533-a1061800-bfad-11ea-9e8a-c62ad86ed0d7.png) It also works fine on mobile: ![image](https://user-images.githubusercontent.com/1617736/86674638-bda25000-bfad-11ea-8d8d-1798b608923e.png)
2020-07-16Rollup merge of #74148 - GuillaumeGomez:doc-alias-check, r=ManishearthManish Goregaokar-28/+0
Move #[doc(alias)] check in rustc Part of #73721. r? @ollie27
2020-07-16Rollup merge of #73771 - alexcrichton:ignore-unstable, r=estebank,GuillaumeGomezManish Goregaokar-0/+10
Don't pollute docs/suggestions with libstd deps Currently dependency crates of the standard library can sometimes leak into error messages such as when traits to import are suggested. Additionally they can leak into documentation such as in the list of "all traits implemented by `u32`". The dependencies of the standard library, however, are intended to be private. The dependencies of the standard library can't actually be stabl-y imported nor is the documentation that relevant since you can't import them on stable either. This commit updates both the compiler and rustdoc to ignore unstable traits in these two scenarios. Specifically the suggestion for traits to import ignore unstable traits, and similarly the list of traits implemented by a type excludes unstable traits. This commit is extracted from #73441 where the addition of some new dependencies to the standard library was showed to leak into various error messages and documentation. The intention here is to go ahead and land these changes ahead of that since it will likely take some time to land.
2020-07-16Revert "Remove "important traits" feature"Manish Goregaokar-1/+6
This reverts commit 1244ced9580b942926afc06815e0691cf3f4a846.
2020-07-15ConstKind::UnevaluatedBastian Kauschke-4/+4
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-1/+1
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.