Add `Item::from_def_id_and_kind` to reduce duplication in rustdoc
This makes it harder to make typos, and also makes it much more clear what's intentionally different rather than a typo (look for `what_rustc_thinks`).
Found this while working on https://github.com/rust-lang/rust/issues/76998, I really didn't want to add `const_visibility` in 20 different places.
r? `@GuillaumeGomez`
Prepare beta 1.49.0
This PR sets everything up for beta 1.49.0, and backports the following PRs to it:
* #79107 - build-manifest: strip newline from rustc version
* #78986 - Avoid installing external LLVM dylibs
* #79074 - Install CI llvm into the library directory
* #78364 - Update RELEASES.md for 1.48.0
* #77939 - Ensure that the source code display is working with DOS backline
r? `@ghost`
cc `@rust-lang/release`
- Add `Item::from_hir_id_and_kind` convenience wrapper
- Make name parameter mandatory
`tcx.opt_item_name` doesn't handle renames, so this is necessary
for any item that could be renamed, which is almost all of them.
- Override visibilities to be `Inherited` for enum variants
`tcx.visibility` returns the effective visibility, not the visibility
that was written in the source code. `pub enum E { A, B }` always has
public variants `A` and `B`, so there's no sense printing `pub` again.
- Don't duplicate handling of `Visibility::Crate`
Instead, represent it as just another `Restricted` path.
Visibility needs much less information than a full path, since modules
can never have generics. This allows constructing a Visibility from only
a DefId.
Note that this means that paths are now normalized to their DefPath.
In other words, `pub(self)` or `pub(super)` now always shows `pub(in
path)` instead of preserving the original text.
Rollup of 8 pull requests
Successful merges:
- #74293 (Rustdoc test compiler output color)
- #78702 ([self-profiling] Include the estimated size of each cgu in the profile)
- #79069 (Get rid of `highlight::Class::None`)
- #79072 (Fix exhaustiveness in case a byte string literal is used at slice type)
- #79120 (update rustfmt to v1.4.27)
- #79125 (Get rid of clean::{Method, TyMethod})
- #79126 (Remove duplicate `Trait::auto` field)
- #79130 (extend macro braces test)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Remove duplicate `Trait::auto` field
It was exactly the same as `is_auto`.
I found this while working on #78082, but it's not required for that PR.
r? `@GuillaumeGomez`
Get rid of clean::{Method, TyMethod}
They're redundant and almost the same as `clean::Function`.
I needed this for https://github.com/rust-lang/rust/pull/78082, although I forget why.
r? `@GuillaumeGomez`
Get rid of `highlight::Class::None`
This is mostly me learning the codebase for https://github.com/rust-lang/rust/pull/77939, so feel free to close the PR.
It does have the small benefit that we statically know rustdoc isn't generating useless `span`s, though.
r? `@GuillaumeGomez`
cc `@matklad`
[self-profiling] Include the estimated size of each cgu in the profile
This is helpful when looking for CGUs where the size estimate isn't a
good indicator of compilation time.
I verified that moving the profiling timer call doesn't affect the
results.
Results:
<img width="297" alt="Screen Shot 2020-11-03 at 7 25 04 AM" src="https://user-images.githubusercontent.com/831192/97985503-5901d100-1da6-11eb-9f10-f3e399702952.png">
`measureme` doesn't have support for custom arg names yet so `arg0` is the CGU name and `arg1` is the estimated size.
Rustdoc test compiler output color
Fixes#72915
We just need to be sure it doesn't break rustdoc doctests' compilation checks. Maybe some other unforeseen consequences too?
r? `@ehuss`
cc `@rust-lang/rustdoc`
Introduce `TypeVisitor::BreakTy`
Implements MCP rust-lang/compiler-team#383.
r? `@ghost`
cc `@lcnr` `@oli-obk`
~~Blocked on FCP in rust-lang/compiler-team#383.~~
If the LLVM was externally provided, then we don't currently copy artifacts into
the sysroot. This is not necessarily the right choice (in particular, it will
require the LLVM dylib to be in the linker's load path at runtime), but the
common use case for external LLVMs is distribution provided LLVMs, and in that
case they're usually in the standard search path (e.g., /usr/lib) and copying
them here is going to cause problems as we may end up with the wrong files and
isn't what distributions want.
This behavior may be revisited in the future though.
Rollup of 9 pull requests
Successful merges:
- #77939 (Ensure that the source code display is working with DOS backline)
- #78138 (Upgrade dlmalloc to version 0.2)
- #78967 (Make codegen tests compatible with extra inlining)
- #79027 (Limit storage duration of inlined always live locals)
- #79077 (document that __rust_alloc is also magic to our LLVM fork)
- #79088 (clarify `span_label` documentation)
- #79097 (Code block invalid html tag lint)
- #79105 (std: Fix test `symlink_hard_link` on Windows)
- #79107 (build-manifest: strip newline from rustc version)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup