This commit adds some new `LocalDecl` methods:
- `with_source_info`, a most general constructor.
- `new`, a variant of `with_source_info` which represents the most
common use case.
- `internal` a modifying method (like the already present `immutable`).
It removes some old `LocalDecl` methods:
- `new_internal` and `new_local`, because they're subsumed by the new
methods.
- `new_return_place`, because it was identical to `new_temp`.
Finally, it cleans up all the use sites.
Detect mistyped associated consts in `Instance::resolve`.
*Based on #71049 to prevent redundant/misleading downstream errors.*
Fixes#70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
Update the mir inline costs
handle that when mir is lowered to llvm-ir more code is generated.
Landingpads generates 10 llvm-ir instructions
and resume 9 llvm-ir instructions.
r? @wesleywiser
Fixes#67710
Previously, we were not calling `super_place`, which resulted in us
failing to update any local references that occur in
ProjectionElem::Index. This caused the post-inlining MIR to contain a
reference to a local ID from the inlined callee, leading to an ICE
due to a type mismatch.
We only want to return specializations when `Reveal::All` is passed, not
when `Reveal::UserFacing` is. Resolving this fixes several issues with
the `ConstProp`, `SimplifyBranches`, and `Inline` MIR optimization
passes.
Fixes#66901
Cleanup BodyCache
After this PR:
- `BodyCache` is renamed to `BodyAndCache`
- `ReadOnlyBodyCache` is renamed to `ReadOnlyBodyAndCache`
- `ReadOnlyBodyAndCache::body` fn is removed and all calls to it are replaced by a deref (possible due to fix of its `Deref` imp in #65947)
cc @eddyb @oli-obk
rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence
rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
This prepares the code base for when projection is interned. Place's
projection field is going to be `&List<PlaceElem<'tcx>>` so we won't be
able to pattern match against it.