about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2019-11-15Fix spurious CI filures due to OOMWesley Wiser-3/+8
Fixes #66342
2019-11-15Fix nits from reviewDylan MacKenzie-13/+13
2019-11-15Use `mir::QualifSet` to store qualifsDylan MacKenzie-22/+23
2019-11-15Use a bespoke type for the result of `mir_const_qualif`Dylan MacKenzie-4/+4
2019-11-15Remove unnecessary `fmt::Debug` boundDylan MacKenzie-3/+2
2019-11-15Remove remaining validator mismatch codeDylan MacKenzie-16/+1
2019-11-15Move `delay_span_bug` into `emit_error` for if/loopDylan MacKenzie-19/+22
2019-11-15Remove `qualify_consts` completelyDylan MacKenzie-1487/+3
2019-11-15Use new const-checker for `mir_const_qualif`Dylan MacKenzie-2/+37
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.
2019-11-15Enable standalone const-checking with `Validator`Dylan MacKenzie-1/+126
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`.
2019-11-15Allow `Validator` to get qualifs for the return placeDylan MacKenzie-1/+45
2019-11-15Remove `requires_sync`Dylan MacKenzie-10/+0
2019-11-15Remove `QUALIF_ERROR_BIT` checkingDylan MacKenzie-25/+4
2019-11-15Rollup merge of #66435 - JohnTitor:fix-spelling, r=CentrilTyler Mandry-1/+1
Correct `const_in_array_repeat_expressions` feature name Fixes #66433 r? @estebank
2019-11-15Rollup merge of #66306 - spastorino:remove-error-handled-by-miri, r=oli-obkYuki Okushi-24/+1
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.
2019-11-15Correct `const_in_array_repeat_expressions` feature nameYuki Okushi-1/+1
2019-11-14Update to use new librustc_error_codes libraryGuillaume Gomez-0/+6
2019-11-14Auto merge of #66233 - cjgillot:constkind, r=oli-obkbors-6/+3
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
2019-11-13Change control flow error to delay span bugDylan MacKenzie-4/+20
2019-11-12Rename in librustc_mir.Camille GILLOT-6/+3
2019-11-12check-consts remove cannot mutate statics in initializer of another static errorSantiago Pastorino-11/+1
2019-11-12qualify-const remove cannot mutate statics in initializer of another static ↵Santiago Pastorino-13/+0
error
2019-11-11[mir-opt] Turn on the `ConstProp` pass by defaultWesley Wiser-14/+27
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.
2019-11-11Remove trampoline, pass `ret` and `unwind` when handling intrinsicsAaron Hill-0/+2
2019-11-11Fix unwinding logicAaron Hill-10/+1
2019-11-11More fixes for rustc changesAaron Hill-4/+8
2019-11-10Merge hir::GeneratorMovability into ast::Movability.Camille GILLOT-1/+1
2019-11-10Merge hir::Mutability into ast::Mutability.Camille GILLOT-7/+7
2019-11-10Auto merge of #66259 - JohnTitor:rollup-x9nk1e2, r=JohnTitorbors-14/+47
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
2019-11-10Rollup merge of #66216 - wesleywiser:const_prop_codegen_improvements, r=oli-obkYuki Okushi-13/+45
[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
2019-11-10Rollup merge of #65831 - matthewjasper:array-ptr-cast, r=oli-obkYuki Okushi-1/+2
Don't cast directly from &[T; N] to *const T Split out from #64588 r? @oli-obk
2019-11-09Auto merge of #65694 - wesleywiser:uninhabited_enum_variants_pass, r=oli-obkbors-0/+129
[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
2019-11-08[mir-opt] Handle aggregates in SimplifyLocals passWesley Wiser-8/+15
2019-11-08[mir-opt] Handle const-prop for the return placeWesley Wiser-5/+30
2019-11-08Clean up dead code in `qualify_consts`Dylan MacKenzie-21/+0
We don't do promotion here anymore, so `Checker` will never even visit the body of a non-const `fn`.
2019-11-08Use new `PromoteTemps` for promotionDylan MacKenzie-42/+21
2019-11-08Add a `PromoteTemps` passDylan MacKenzie-35/+137
`remove_storage_dead_and_drop` has been copied to `promote_temps` and now operates on an array of `Candidate`s instead of a bitset.
2019-11-08Stop returning promotables from `mir_const_qualif`Dylan MacKenzie-57/+11
2019-11-08Rollup merge of #66188 - Centril:fnsig, r=davidtwcoMazdak Farrokhzad-2/+2
`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
2019-11-08Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obkMazdak Farrokhzad-28/+15
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
2019-11-08hir::ItemKind::Fn: use hir::MethodSigMazdak Farrokhzad-2/+2
2019-11-08Auto merge of #66066 - ecstatic-morse:remove-promotion-from-qualify-consts, ↵bors-439/+62
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
2019-11-06Implement pass to remove branches on uninhabited variantsWesley Wiser-0/+129
2019-11-06Auto merge of #65728 - ecstatic-morse:promotion-const-proj, r=eddybbors-19/+10
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
2019-11-06Remove `IsNotPromotable` and `IsNotImplicitlyPromotable`Dylan MacKenzie-235/+11
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.
2019-11-06Remove `promotion_candidates` from `Checker`Dylan MacKenzie-131/+12
Also removes any code used only to populate `promotion_candidates` during const checking.
2019-11-06Remove `valid_promotion_candidates`Dylan MacKenzie-73/+39
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.
2019-11-06safe_extern_static -> errorMazdak Farrokhzad-28/+15
2019-11-06Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, ↵Mazdak Farrokhzad-9/+9
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
2019-11-05Rollup merge of #66047 - ecstatic-morse:issue-66016, r=eddybPietro Albini-0/+2
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.