| Age | Commit message (Collapse) | Author | Lines |
|
|
|
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.
|
|
Lint overflowing integer casts in const prop
This extends the invalid cases we catch in const prop to include
overflowing integer casts using the same machinery as the overflowing
binary and unary operation logic.
r? @oli-obk
|
|
|
|
|
|
|
|
|
|
This extends the invalid cases we catch in const prop to include
overflowing integer casts using the same machinery as the overflowing
binary and unary operation logic.
|
|
Work around a resolve bug in const prop
r? @wesleywiser @anp
This isn't exposed right now, but further changes to rustc may start causing bugs without this.
|
|
Allocate HIR on an arena 3/4 -- Ty
This is the third PR in the series started by #66931 and #66936
Once again, commits don't really make sense on their own.
They are mostly split by type of compile error.
The additional diff is here: https://github.com/cjgillot/rust/compare/hirene-expr...hirene-ty
|
|
more constants during const prop
|
|
Use the correct type for static qualifs
Closes #67609
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
Allocate HIR on an arena 1/4
This PR is the first in a series of 4, aiming at allocating the HIR on an arena, as a memory optimisation.
1. This first PR lays the groundwork and migrates some low-hanging fruits.
2. The second PR will migrate `hir::Expr`, `hir::Pat` and related.
3. The third PR will migrate `hir::Ty` and related.
4. The final PR will be dedicated to eventual cleanups.
In order to make the transition as gradual as possible, some lowering routines receive `Box`-allocated data and move it into the arena. This is a bit wasteful, but hopefully temporary.
Nonetheless, special care should be taken to avoid double arena allocations.
Work mentored by @Zoxc.
|
|
|
|
[mir-opt] Fix `Inline` pass to handle inlining into `box` expressions
r? @oli-obk
Before, the test case just ICE'd here:
https://github.com/rust-lang/rust/blob/a605441e049f0b6d5f7715b94b8ac4662fd7fcf6/src/librustc_mir/transform/inline.rs#L668
|
|
Merge `ast::Mutability` and `mir::Mutability`
r? @oli-obk
|
|
|
|
2. mir::Mutability -> ast::Mutability.
|
|
Const prop should finish propagation into user defined variables
Fixes #66638
~~Temporarily rebased on top of #67015 to get those fixes.~~
r? @oli-obk
|
|
This operator creates a raw pointer to a Place directly, without first
creating a reference. See RFC #2582 for motivation.
The Rvalue is currently unused.
|
|
stabilize Result::map_or
r? @SimonSapin
Closes #66293
|
|
|
|
|
|
Fixes #66638
|
|
features
|
|
Remove uniform array move MIR passes
This PR fixes a number of bugs caused by limitations of this pass
* Projections from constant indexes weren't being canonicalized
* Constant indexes from the start weren't being canonicalized (they could have different min_lengths)
* It didn't apply to non-moves
This PR makes the following changes to support removing this pass:
* ConstantIndex of arrays are now generated in a canonical form (from the start, min_length is the actual length).
* Subslices are now split when generating move paths and when checking subslices have been moved.
Additionally
* The parent move path of a projection from an array element is now calculated correctly
closes #66502
|
|
Fix constant propagation for scalar pairs
We now only propagate a scalar pair if the Rvalue is a tuple with two scalars. This for example avoids propagating a (u8, u8) value when Rvalue has type `((), u8, u8)` (see the regression test). While this is a correct thing to do, implementation is tricky and will be done later.
Fixes #66971
Fixes #66339
Fixes #67019
|
|
Ensure that we get a hard error on generic ZST constants if their bod…
…y causes an error during evaluation
cc #67083 (does not fix because we still need the beta backport)
r? @wesleywiser
cc @RalfJung
|
|
These passes were buggy, MIR building is now responsible for
canonicalizing `ConstantIndex` projections and `MoveData` is responsible
for splitting `Subslice` projections.
|
|
* `min_length` is now exact for const index elements.
* const index elements are always from the start.
* make array `Subslice` `PlaceElems` count both `from` and `to` from the
start.
|
|
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
|
|
causes an error during evaluation
|
|
Implement #[track_caller] attribute. (RFC 2091 4/N)
Implements the `#[track_caller]` attribute in both const and codegen contexts.
The const implementation walks up the stack to find the nearest untracked callsite.
The codegen implementation adds an implicit argument to tracked function calls, and populates it with either a call to the previously-landed intrinsic or if the caller has `#[track_caller]` with a copy of the location passed to the current function.
Also includes a little cleanup and a few comments in the other caller location areas.
[Depends on: 65664](https://github.com/rust-lang/rust/pull/65664)
[RFC 2091 text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md)
[Tracking issue](https://github.com/rust-lang/rust/issues/47809)
[Tracking doc](https://paper.dropbox.com/doc/track_rfc_2091_impl-notes--Anf1NwnIb0xcRv31YLIadyj0Ag-rwCdRc2fi2yvRZ7syGZ9q#:uid=863513134494965680023183&h2=TODO-actually-pass-location-to)
|
|
Add feature gate for mut refs in const fn
r? @oli-obk
|
|
We now only propagate a scalar pair if the Rvalue is a tuple with two
scalars. This for example avoids propagating a (u8, u8) value when
Rvalue has type `((), u8, u8)` (see the regression test). While this is
a correct thing to do, implementation is tricky and will be done later.
Fixes #66971
Fixes #66339
Fixes #67019
|
|
|
|
|
|
|
|
|
|
Index impl, remove body fn
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
|
|
|
|
the unstables ones in libcore, with the unstable feature disabled, were not checked
|