Make sure that queries have predictable symbol names.
Some recent refactorings led to query names not showing up in the corresponding symbol names. [perf-focus](https://github.com/nikomatsakis/perf-focus) and manual profiling have been broken by this. This PR makes sure that query providers always get their own symbol and that that symbol has a predictable name.
Since this adds `#[inline(never)]` to a function that wraps the provider call, let's check if this does not regress performance before merging.
r? @nikomatsakis
Rollup of 7 pull requests
Successful merges:
- #49707 (Add "the Rustc book")
- #50222 (Bump bootstrap compiler to 2018-04-24)
- #50227 (Fix ICE with erroneous `impl Trait` in a trait impl)
- #50229 (Add setting to go to item if there is only one result)
- #50231 (Add more doc aliases)
- #50246 (Make dump_{alloc,allocs,local}() no-ops when tracing is disabled.)
- #49894 (Rename InternedString to LocalInternedString and introduce a new thread-safe InternedString)
Failed merges:
This computes the transitive closure of traits that appear in the
environment and then appends their clauses. It needs some work, but
it's in the right direction.
Make OnDiskCache thread-safer
I'm not sure if `synthetic_expansion_infos` is handled correctly.
`interpret_alloc_cache` and `interpret_alloc_size` seems to be wrong though, since the code may now decode two `AllocId`s in parallel. I'd like some input on how to fix that.
cc @oli-obk
r? @michaelwoerister
traits: Implement interning for Goal and Clause
r? @nikomatsakis
Close#49054
Contains some refactoring for the interning mechanism, mainly aimed at reducing pain when changing types of interning map.
This should be mostly good, although I'm not sure with the naming of `Goal::from_poly_domain_goal`.
Ak 44493 infer predicate
**WIP** Implements #44493
Things to do:
- [x] add feature gate and appropriate tests (see [forge](https://forge.rust-lang.org/feature-guide.html) for some details)
- [x] add a unit testing system similar to `#[rustc_variance]`
- [x] to see how, maybe `rg rustc_variance` and take some notes
- [ ] add more tests:
- [x] we need to decide how to handle `struct Foo<'a, T> { x: &'a T::Item }`
- [x] handle explicit predicates on types
- [ ] handle explicit predicates on `dyn Trait` (this could be put off to a follow-up PR)
- [ ] handle explicit predicates on projections (this could be put off to a follow-up PR)
Print query stack on ICEs
ICE output is now:
```
thread 'rustc' panicked at 'no borrowck', librustc_borrowck\borrowck\mod.rs:95:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
query stack during panic:
#0 [borrowck] processing `main`
--> no-std.rs:10:1
|
10 | fn main() {}
| ^^^^^^^^^
end of query stack
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.26.0-dev running on x86_64-pc-windows-msvc
```
Fixes#42529.
r? @eddyb
Make queries thread safe
This makes queries thread safe by removing the query stack and making queries point to their parents. Queries write to the query map when starting and cycles are detected by checking if there's already an entry in the query map. This makes cycle detection O(1) instead of O(n), where `n` is the size of the query stack.
This is mostly corresponds to the method I described [here](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606).
cc @rust-lang/compiler
r? @michaelwoerister