| Age | Commit message (Collapse) | Author | Lines |
|
Fixes #66342
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Now `mir_const_qualif` must be called for `static`s and `const fn`s as
well as `const`s since it is responsible for const-checking. We return
the qualifs in the return place for everything, even though they will
only be used for `const`s.
|
|
Unlike the original pass, we check *every* non-cleanup basic block
instead of stopping at `SwitchInt`. We use the `is_cfg_cyclic` function
to check for loops unlike the original checker which could not differentiate
between true cycles and basic blocks with more than two predecessors.
The last three functions are all copied verbatim from `qualify_consts`.
|
|
|
|
|
|
|
|
Correct `const_in_array_repeat_expressions` feature name
Fixes #66433
r? @estebank
|
|
Remove cannot mutate statics in initializer of another static error
r? @oli-obk
This is just a refactoring. As the removed code itself said, it only a heuristic catching a few cases early instead of leaving it all to const eval. It's easy to work around the static check and then run into the miri-engine check.
|
|
|
|
|
|
Split ConstValue into two enums
Hello,
Issue #59210 appeared abandoned, so I gave it a go.
Some further cleanup and refactoring may be mandated.
I did not test beyond `x.py check`, since my home computer dies compiling librustc.
Fixes #59210
|
|
|
|
|
|
|
|
error
|
|
perf.rlo shows that running the `ConstProp` pass results in
across-the-board wins regardless of debug or opt complilation mode. As a
result, we're turning it on to get the compile time benefits.
`ConstProp` doesn't currently intern the memory used by its `Machine` so
we can't yet propagate allocations which is why
`ConstProp::should_const_prop()` checks if the value being propagated is
a scalar or not.
|
|
|
|
|
|
|
|
|
|
|
|
Rollup of 7 pull requests
Successful merges:
- #65719 (Refactor sync::Once)
- #65831 (Don't cast directly from &[T; N] to *const T)
- #66048 (Correct error in documentation for Ipv4Addr method)
- #66058 (Correct deprecated `is_global` IPv6 documentation)
- #66216 ([mir-opt] Handle return place in ConstProp and improve SimplifyLocals pass)
- #66217 (invalid_value lint: use diagnostic items)
- #66235 (rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files.)
Failed merges:
r? @ghost
|
|
[mir-opt] Handle return place in ConstProp and improve SimplifyLocals pass
Temporarily rebased on top of #66074. The top 2 commits are new.
r? @oli-obk
|
|
Don't cast directly from &[T; N] to *const T
Split out from #64588
r? @oli-obk
|
|
[mir-opt] Implement pass to remove branches on uninhabited variants
Based on discussion [here](https://github.com/rust-lang/rust/pull/64890#discussion_r333612125), this is a pass to eliminate dead code that is caused by branching on an enum with uninhabited variants.
r? @oli-obk
|
|
|
|
|
|
We don't do promotion here anymore, so `Checker` will never even visit
the body of a non-const `fn`.
|
|
|
|
`remove_storage_dead_and_drop` has been copied to `promote_temps` and
now operates on an array of `Candidate`s instead of a bitset.
|
|
|
|
`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`
In both AST & HIR, rename `MethodSig` to `FnSig` and then proceed to use it in `ItemKind::Fn` so that the overall structure is more regular.
r? @davidtwco
|
|
Transition future compat lints to {ERROR, DENY} - Take 2
Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992.
- `legacy_ctor_visibility` (ERROR) -- closes #39207
- `legacy_directory_ownership` (ERROR) -- closes #37872
- `safe_extern_static` (ERROR) -- closes #36247
- `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238
- `duplicate_macro_exports` (ERROR)
- `nested_impl_trait` (ERROR) -- closes #59014
- `ill_formed_attribute_input` (DENY) -- transitions #57571
- `patterns_in_fns_without_body` (DENY) -- transitions #35203
r? @varkor
cc @petrochenkov
|
|
|
|
r=eddyb
Remove promotion candidate gathering and checking from `qualify_consts.rs`
This makes promotion candidate gathering and checking the exclusive domain of `promote_consts`, but the `QualifyAndPromoteConsts` pass is still responsible for both const-checking and creating promoted MIR fragments.
This should not be merged until the beta branches on Nov. 5.
r? @eddyb
|
|
|
|
Fix promotion in a `const` when projections are present
Resolves #65727.
This marks the entire local as "needs promotion" when only a projection of that local appears in a promotable context. This should only affect promotion in a `const` or `static`, not in a `fn` or `const fn`, which is handled in `promote_consts.rs`.
r? @eddyb
|
|
The former was cleared from `qualifs_in_return_place`, and the latter
was never checked. `QUALIF_ERROR_BIT` no longer corresponds to a real
`Qualif`, however.
|
|
Also removes any code used only to populate `promotion_candidates`
during const checking.
|
|
We no longer compare the results of
`promote_consts::validate_candidates` with
`checker.promotion_candidates`, and `promote_consts` becomes the
canonical source for determining promotability.
|
|
|
|
r=estebank
Rename `LocalInternedString` and more
This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses.
r? @estebank
|
|
Don't double-count `simd_shuffle` promotion candidates
Resolves #66016.
The `#[rustc_args_required_const]` attribute was added to `simd_shuffle*` in rust-lang/stdarch#825. This caused `promote_consts` to double-count its second argument when recording promotion candidates, which caused the promotion candidate compatibility check to fail.
Once `stdarch` is updated in-tree to include rust-lang/stdarch#825, all special logic around `simd_shuffle` can and should be removed.
|