Try fast_reject::simplify_type in coherence before doing full check
This is a reattempt at landing #69010 (by `@jonas-schievink).` The change adds a fast path for coherence checking to see if there's no way for types to unify since full coherence checking can be somewhat expensive.
This has big effects on code generated by the [`windows`](https://github.com/microsoft/windows-rs) which in some cases spends as much as 20% of compilation time in the `specialization_graph_of` query. In local benchmarks this took a compilation that previously took ~500 seconds down to ~380 seconds.
This is surely not going to make a difference on much smaller crates, so the question is whether it will have a negative impact. #69010 was closed because some of the perf suite crates did show small regressions.
Additional discussion of this issue is happening [here](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf).
Rollup of 16 pull requests
Successful merges:
- #79983 (fix indefinite article in cell.rs)
- #81831 (Don't display `mut` in arguments for functions documentation)
- #81947 (Relax ItemCtxt::to_ty lifetime)
- #81954 (RELEASES.md 1.50: Group platform support notes together)
- #81955 (bootstrap: Locate llvm-dwp based on llvm-config bindir)
- #81959 (Fix assosiated typo)
- #81964 (Fix documentation not showing on localStorage error)
- #81968 (bootstrap: fix wrong docs installation path)
- #81990 (Make suggestion of changing mutability of arguments broader)
- #81994 (Improve long explanation for E0542 and E0546)
- #81997 (dist: include src/build_helper as part of the crate graph for rustc-dev)
- #82003 (Stack probes: fix error message)
- #82004 (clean up clean::Static struct)
- #82011 (Fix private intra-doc warnings on associated items)
- #82013 (Tell user how to fix CI file being not up to date)
- #82017 (Fix typo in mod.rs)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Fix private intra-doc warnings on associated items
The issue was that the `kind, id` override was previously only being
considered for the disambiguator check, not the privacy check. This uses
the same ID for both.
Fixes https://github.com/rust-lang/rust/issues/81981.
r? ``@max-heller``
clean up clean::Static struct
Having a `String` for the expression didn't make much sense, and even less when it's actually not used (except in json so I kept it).
r? ``@jyn514``
dist: include src/build_helper as part of the crate graph for rustc-dev
The build_helper dependency is used to build the compiler/rustc_llvm build script.
Since it was missing, it wasn't possible to really use rustc-dev to
build, see for instance: https://github.com/rust-analyzer/rust-analyzer/issues/7589.
Make suggestion of changing mutability of arguments broader
Fix#81421
Previously rustc tries to emit the suggestion of changing mutablity unless `!trait_ref.has_infer_types_or_consts() && self.predicate_can_apply(obligation.param_env, trait_ref)` and this led to some false negatives to occur.
bootstrap: Locate llvm-dwp based on llvm-config bindir
Fixes#81949.
Tested by successfully building 1.50.0 pre-release, which is where I originally hit the issue (https://internals.rust-lang.org/t/rust-1-50-0-pre-release-testing/14012/4?u=dtolnay). Tested both with and without prebuilt LLVM. The check for dry_run is necessary in the non-prebuilt case because the llvm-config built by bootstrap won't exist yet.
BTreeMap: disentangle Drop implementation from IntoIter
No longer require every `BTreeMap` to dig up its last leaf edge before dying. This speeds up the `clone_` benchmarks by 25% for normal keys and values (far less for huge values).
r? `@Mark-Simulacrum`
The issue was that the `kind, id` override was previously only being
considered for the disambiguator check, not the privacy check. This uses
the same ID for both.
Reduce log level used by tracing instrumentation from info to debug
Restore log level to debug to avoid make info log level overly verbose (the uses of instrument attribute modified there, were for the most part a replacement for `debug!`; one use was novel).
Optimize Vec::retain
Use `copy_non_overlapping` instead of `swap` to reduce memory writes, like what we've done in #44355 and `String::retain`.
#48065 already tried to do this optimization but it is reverted in #67300 due to bad codegen of `DrainFilter::drop`.
This PR re-implement the drop-then-move approach. I did a [benchmark](https://gist.github.com/oxalica/3360eec9376f22533fcecff02798b698) on small-no-drop, small-need-drop, large-no-drop elements with different predicate functions. It turns out that the new implementation is >20% faster in average for almost all cases. Only 2/24 cases are slower by 3% and 5%. See the link above for more detail.
I think regression in may-panic cases is due to drop-guard preventing some optimization. If it's permitted to leak elements when predicate function of element's `drop` panic, the new implementation should be almost always faster than current one.
I'm not sure if we should leak on panic, since there is indeed an issue (#52267) complains about it before.
resolve: Cleanup visibility resolution for enum variants and trait items
by always delegating it to `fn resolve_visibility`.
Also remove some special treatment of visibility on enum variants and trait items remaining from pre-`pub(restricted)` times.
Special treatment like this was necessary before `pub(restricted)` had been implemented and only two visibilities existed - `pub` and non-`pub`.
Now it's no longer necessary and the desired behavior follows from `pub(restricted)`-style visibilities naturally assigned to enum variants and trait items.
update RLS and rustfmt
Fixes#81582 and fixes#81583
r? `@Xanewok`
I was originally surprised by the size of lockfile diff, though after looking at the RLS changes it makes a bit more sense to me now
Allow unstable features in some PGO benchmarks
Some of the benchmarks we're using for PGO require unstable features (such as compiling the standard library and some rustc-perf benchmarks), breaking CI on the beta and stable branches. For the past two releases we cherry-picked a commit directly onto the beta branch that unconditionally sets `RUSTC_BOOTSTRAP=1`, and this PR backports a similar change to the master branch.
The difference between this commit and the one we backported previously (483c1a83ca7cf53fd8f3432edb32cbe70ba39d45) is that this is more scoped in which benchmarks we allow unstable features, to prevent unintentionally enabling unstable features.
r? `@Mark-Simulacrum`