| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
Remove -Z no-landing-pads flag
Since #67502, `-Z no-landing-pads` will cause all attempted unwinds to abort since we don't generate a `try` / `catch`. This previously worked because `__rust_try` was located in libpanic_unwind which is always compiled with `-C panic=unwind`, but `__rust_try` is now directly inline into the crate that uses `catch_unwind`.
As such, `-Z no-landing-pads` is now mostly useless and people should use `-C panic=abort` instead.
|
|
|
|
|
|
Const qualification for `StructuralEq`
Furthers #62411. Resolves #62614.
The goal of this PR is to implement the logic in #67088 on the MIR instead of the HIR. It uses the `Qualif` trait to track `StructuralPartialEq`/`StructuralEq` in the final value of a `const`. Then, if we encounter a constant during HAIR lowering whose value may not be structurally matchable, we emit the `indirect_structural_match` lint.
This PR contains all the tests present in #67088 and emits the proper warnings for the corner cases. This PR does not handle #65466, which would require that we be [more aggressive](https://github.com/rust-lang/rust/blob/42abbd8878d3b67238f3611b0587c704ba94f39c/src/librustc_mir_build/hair/pattern/const_to_pat.rs#L126-L130) when checking matched types for `PartialEq`. I think that should be done separately.
Because this works on MIR and uses dataflow, this PR should accept more cases than #67088. Notably, the qualifs in the final value of a const are encoded cross-crate, so matching on a constant whose value is defined in another crate to be `Option::<TyWithCustomEqImpl>::None` should work. Additionally, if a `const` has branching/looping, we will only emit the warning if any possible control flow path could result in a type with a custom `PartialEq` impl ending up as the final value of a `const`. I'm not sure how #67088 handled this.
AFAIK, it's not settled that these are the semantics we actually want: it's just how the `Qualif` framework happens to work. If the cross-crate part is undesirable, it would be quite easy to change the result of `mir_const_qualif().custom_eq` to `true` before encoding it in the crate metadata. This way, other crates would have to assume that all publicly exported constants may not be safe for matching.
r? @pnkfelix
cc @eddyb
|
|
r=wesleywiser
Const-prop bugfix: only add propagation inside own block for user variables
A testing spinoff of #71298. This one only adds the const-prop for locals that are user variables.
|
|
|
|
|
|
|
|
share some common code for compile-time miri instances
Fixes https://github.com/rust-lang/rust/issues/71129
r? @oli-obk
|
|
|
|
|
|
doc comments in `mir/transform/const_prop.rs`
|
|
|
|
`LocalKind::Temp`. Added a cache of `LocalKind`s to `CanConstProp`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Remove some `Vec` allocations to improve performance
This claws back most of the performance lost in https://github.com/rust-lang/rust/pull/69745.
r? @eddyb
|
|
Don't run various MIR optimizations at mir-opt-level=0
Add missing checks for mir-opt-level to non-essential MIR passes.
I verified that this can still bootstrap even with these passes disabled.
r? @oli-obk cc @RalfJung
|
|
Minor refactoring around IndexVec usage in generator transformation
Replace hash map with IndexVec for liveness data.
Utilize IndexVec::push return value to avoid redundant object creation.
r? @eddyb
|
|
fix more clippy warnings
clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
r? @Dylan-DPC
|
|
clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
|
|
Add all remaining `DefKind`s.
r? @eddyb or @Centril
~~I'm not sure if this is what you were thinking of. There are also a few places where I'm not sure what the correct choice is because I don't fully understand the meaning of some variants.~~
~~In general, it feels a bit odd to add some of these as `DefKind`s (e.g. `Arm`) because they don't feel like definitions. Are there things that it makes sense not to add?~~
|
|
Replace filter_map().next() calls with find_map()
These are semantically the same, but `find_map()` is more concise.
|
|
Utilize IndexVec::push to avoid redundant object creation.
|
|
r=Dylan-DPC
Revert PR 70566 for const validation fix
This is a port of PR #71441 but ported to the master branch, as discussed in [yesterday's T-compiler meeting](https://zulip-archive.rust-lang.org/131828tcompiler/88751weeklymeeting2020042354818.html#195065903)
|
|
These are semantically the same, but `find_map()` is more concise.
|
|
Miscellaneous cleanup in `check_consts`
Just changes `RUSTC_LOG` output.
|
|
Only run dataflow for const qualification if type-based check would fail
This is the optimization discussed in https://github.com/rust-lang/rust/issues/49146#issuecomment-614012476. We wait for `Qualif::in_any_value_of_ty` to return `true` before running dataflow. For bodies that deal mostly with primitive types, this will avoid running dataflow at all during const qualification.
This also removes the `BitSet` used to cache `in_any_value_of_ty` for each local, which was only necessary for an old version of #64470 that also handled promotability.
|
|
This reverts commit 99492e41b60f21f2f461e8131605e054020d328e.
|
|
|
|
|
|
|
|
Add missing checks for mir-opt-level to non-essential MIR passes.
|
|
Replace fragile erroneous const sys
Closes #67191
r? @oli-obk
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Avoid exercising unevaluated constants and go straight to visit the
blocks.
|
|
|
|
|