| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
|
|
Fix leak when early returning out of `box` syntax
Fixes #62289
r? @matthewjasper
|
|
Fixes #62289
|
|
With `feature(never_type)`, it's not guaranteed that any variable with
type `!` isn't ever assigned to.
|
|
|
|
|
|
|
|
|
|
|
|
[const-prop] Support Rvalue::{Ref,Len} and Deref
Also fixes an ICE I found in testing.
r? @oli-obk
~~The final commit is just for a perf run. I'll remove it after that is completed.~~
|
|
|
|
|
|
|
|
This fixes an ICE when building libcore with `-Z mir-opt-level=3`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Add match arm scopes and other scope fixes
* Add drop and lint scopes for match arms.
* Lint attributes are now respected on match arms.
* Make sure we emit a StorageDead if we diverge when initializing a temporary.
* Adjust MIR pretty printing of scopes for locals.
* Don't generate duplicate lint scopes for `let statements`.
* Add some previously missing fake borrows for matches.
closes #46525
cc @rust-lang/compiler
|
|
Preserve local scopes in generator MIR
Part of #52924, depended upon by the generator layout optimization #60187.
This PR adds `StorageDead` statements in more places in generators, so we can see when non-`Drop` locals have gone out of scope and recover their storage.
The reason this is only done for generators is compiler performance. See https://github.com/rust-lang/rust/pull/60187#issuecomment-485637811 for what happens when we do this for all functions.
For `Drop` locals, we modify the `MaybeStorageLive` analysis to use `drop` to indicate that storage is no longer live for the local. Once `drop` returns or unwinds to our function, we implicitly assume that the local is `StorageDead`.
Instead of using `drop`, it is possible to emit more `StorageDead` statements in the MIR for `Drop` locals so we can handle all locals the same. I am fine with doing it that way, but this was the simplest approach for my purposes. It is also likely to be more performant.
r? @Zoxc (feel free to reassign)
cc @cramertj @eddyb @RalfJung @rust-lang/wg-async-await
|
|
|
|
This ensures that we will correctly generate a storage-dead if the
initializing expression diverges.
|
|
Also give arms the correct lint scope in MIR.
|
|
* Don't generate an extra lint scope for each `let` statement.
* Place match guards inside the visiblility scope of the bindings for
their arm.
|
|
|
|
|
|
Use -Zborrowck=mir for NLL compare mode
closes #56993
r? @pnkfelix
|
|
Do some simple constant propagation in the ConstProp pass
r? @oli-obk
I added a few test cases. Let me know if you think there should be more.
|
|
|
|
The results aren't ideal but they represent the current state.
|
|
|
|
|
|
|
|
Clean up and add tests for slice drop shims
Adds a test for the MIR generated by `real_drop_in_place::<[T]>`. Also slightly reduces the number of statements and locals used in the shim.
r? @RalfJung
|
|
|
|
Remove TypeckMir
Fixes #60422
r? @matthewjasper
|
|
Multi-variant layouts for generators
This allows generators to overlap fields using variants, but doesn't do any such overlapping yet. It creates one variant for every state of the generator (unresumed, returned, panicked, plus one for every yield), and puts every stored local in each of the yield-point variants.
Required for optimizing generator layouts (#52924).
There was quite a lot of refactoring needed for this change. I've done my best in later commits to eliminate assumptions in the code that only certain kinds of types are multi-variant, and to centralize knowledge of the inner mechanics of generators in as few places as possible.
This change also emits debuginfo about the fields contained in each variant, as well as preserving debuginfo about stored locals while running in the generator.
Also, fixes #59972.
Future work:
- Use this change for an optimization pass that actually overlaps locals within the generator struct (#52924)
- In the type layout fields, don't include locals that are uninitialized for a particular variant, so miri and UB sanitizers can check our memory (see https://github.com/rust-lang/rust/issues/59972#issuecomment-483058172)
- Preserve debuginfo scopes across generator yield points
|
|
|
|
|
|
|
|
This allows generators to overlap fields using variants.
|
|
This avoids some unnecessary moves
|
|
Future-proof MIR for dedicated debuginfo.
This is #56231 without the last commit (the one that actually moves to `VarDebuginfo`).
Nothing should be broken, but it should no longer depend on debuginfo for anything else.
r? @nikomatsakis
|