about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2018-03-08Nuke the entire ctfe from orbit, it's the only way to be sureOliver Schneider-10/+10
2018-03-08Produce instead of pointersOliver Schneider-5/+17
2018-03-06Replace attr::contains_name(..., "cold")Wesley Wiser-5/+5
Part of #47320
2018-03-06Add `inline` to `TransFnAttrs`Wesley Wiser-1/+1
Part of #47320
2018-03-06Rollup merge of #48727 - leodasvacas:refactor-contrived-match, r=rkruppekennytm-13/+6
Refactor contrived match.
2018-03-05Turn features() into a query.Michael Woerister-2/+2
2018-03-04Refactor contrived match.leonardo.yvens-13/+6
2018-03-02Perform manual fixupsManish Goregaokar-1/+1
2018-03-02Run Rustfix on librustc_mirManish Goregaokar-2/+2
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-11/+11
2018-02-28Rollup merge of #48355 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakisManish Goregaokar-11/+188
Fixes #47311. r? @nrc
2018-02-25restore Subslice move out from array after elaborate drops and borrowckMikhail Modin-11/+188
2018-02-24Rollup merge of #48452 - varkor:unpacked-kind, r=eddybManish Goregaokar-3/+3
Introduce UnpackedKind This adds an `UnpackedKind` type as a typesafe counterpart to `Kind`. This should make future changes to kinds (such as const generics!) more resilient, as the type-checker will be able to catch more potential issues. r? @eddyb cc @yodaldevoid
2018-02-24Rollup merge of #48317 - ExpHP:unused-unsafe-is-no-fn, r=estebankManish Goregaokar-2/+5
unused_unsafe: don't label irrelevant fns Fixes #48131 Diagnostic bugfix to remove an errant note. Stops the search for an enclosing unsafe scope at the first safe fn encountered. ```rust pub unsafe fn outer() { fn inner() { unsafe { /* unnecessary */ } } inner() } ``` **Before:** ``` warning: unnecessary `unsafe` block --> src/main.rs:3:9 | 1 | pub unsafe fn outer() { | --------------------- because it's nested under this `unsafe` fn 2 | fn inner() { 3 | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | = note: #[warn(unused_unsafe)] on by default ``` **After:** ``` warning: unnecessary `unsafe` block --> src/main.rs:3:9 | 3 | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | = note: #[warn(unused_unsafe)] on by default ```
2018-02-23Introduce UnpackedKindvarkor-3/+3
This adds an `UnpackedKind` type as a typesafe counterpart to `Kind`. This should make future changes to kinds (such as const generics!) more resilient, as the type-checker should catch more potential issues.
2018-02-20rustc_mir: optimize the deaggregator's expansion of statements.Eduard-Mihai Burtescu-43/+26
2018-02-20rustc_mir: don't run the deaggregator on arrays for now.Eduard-Mihai Burtescu-1/+5
2018-02-20rustc_mir: always run the deaggregator.Eduard-Mihai Burtescu-6/+5
2018-02-20rustc_mir: do not remove dead user variables if debuginfo needs them.Eduard-Mihai Burtescu-4/+13
2018-02-20rustc_mir: handle all aggregate kinds in the deaggregator.Eduard-Mihai Burtescu-81/+68
2018-02-20rustc_mir: use the "idiomatic" optimization gating in the deaggregator.Eduard-Mihai Burtescu-11/+16
2018-02-17unused_unsafe: don't label irrelevant fnsMichael Lamparski-2/+5
2018-02-17Auto merge of #47408 - eddyb:deref-danger, r=nikomatsakisbors-2/+34
Don't promote to 'static the result of dereferences. This is a **breaking change**, removing copies out of dereferences from rvalue-to-`'static` promotion. With miri we won't easily know whether the dereference itself would see the same value at runtime as miri (e.g. after mutating a `static`) or even if it can be interpreted (e.g. integer pointers). One alternative to this ban is defining at least *some* of those situations as UB, i.e. you shouldn't have a reference in the first place, and you should work through raw pointers instead, to avoid promotion. **EDIT**: The other *may seem* to be to add some analysis which whitelists references-to-constant-values and assume any values produced by arbitrary computation to not be safe to promote dereferences thereof - but that means producing a reference from an associated constant or `const fn` would necessarily obscure it, and in the former case, this could still impact code that runs on stable today. What we do today to track "references to statics" only works because we restrict taking a reference to a `static` at all to other `static`s (which, again, are currently limited in that they can't be read at compile-time) and to runtime-only `fn`s (*not* `const fn`s). I'm primarily opening this PR with a conservative first approximation (e.g. `&(*r).a` is not allowed, only reborrows are, and in the old borrow only implicit ones from adjustments, at that) for cratering. r? @nikomatsakis
2018-02-17Auto merge of #47926 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakisbors-0/+156
add transform for uniform array move out reworked second step for fix #34708 previous try #46686 r? @nikomatsakis
2018-02-12Auto merge of #47843 - estebank:teach, r=nikomatsakisbors-30/+138
Add `-Zteach` documentation Add extra inline documentation to E0019, E0016, E0013, E0396, E0017, E0018, E0010, E0022, E0030, E0029, E0033, E0026 and E0027. Follow up to #47652.
2018-02-09Auto merge of #47802 - bobtwinkles:loop_false_edge, r=nikomatsakisbors-3/+12
[NLL] Add false edges out of infinite loops Resolves #46036 by adding a `cleanup` member to the `FalseEdges` terminator kind. There's also a small doc fix to one of the other comments in `into.rs` which I can pull out in to another PR if desired =) This PR should pass CI but the test suite has been relatively unstable on my system so I'm not 100% sure. r? @nikomatsakis
2018-02-09Auto merge of #47489 - pnkfelix:limit-2pb-issue-46747, r=nikomatsakisbors-3/+3
NLL: Limit two-phase borrows to autoref-introduced borrows This imposes a restriction on two-phase borrows so that it only applies to autoref-introduced borrows. The goal is to ensure that our initial deployment of two-phase borrows is very conservative. We want it to still cover the `v.push(v.len());` example, but we do not want it to cover cases like `let imm = &v; let mu = &mut v; mu.push(imm.len());` (Why do we want it to be conservative? Because when you are not conservative, then the results you get, at least with the current analysis, are tightly coupled to details of the MIR construction that we would rather remain invisible to the end user.) Fix #46747 I decided, for this PR, to add a debug-flag `-Z two-phase-beyond-autoref`, to re-enable the more general approach. But my intention here is *not* that we would eventually turn on that debugflag by default; the main reason I added it was that I thought it was useful for writing tests to be able to write source that looks like desugared MIR.
2018-02-08add transform for uniform array move outMikhail Modin-0/+156
2018-02-08Encode (in MIR) whether borrows are explicit in source or arise due to autoref.Felix S. Klock II-3/+3
This is foundation for issue 46747 (limit two-phase borrows to method-call autorefs).
2018-02-07Add `-Zteach` documentationEsteban Küber-30/+138
Add extra inline documentation to E0019, E0016, E0013, E0396, E0017, E0018, E0010, E0022, E0030, E0029, E0033, E0026 and E0027.
2018-02-05mir: Add TerminatorKind::FalseUnwindbobtwinkles-3/+12
Sometimes a simple goto misses the cleanup/unwind edges. Specifically, in the case of infinite loops such as those introduced by a loop statement without any other out edges. Analogous to TerminatorKind::FalseEdges; this new terminator kind is used when we want borrowck to consider an unwind path, but real control flow should never actually take it.
2018-02-05rustc: Add `#[rustc_args_required_const]`Alex Crichton-11/+53
This commit adds a new unstable attribute to the compiler which requires that arguments to a function are always provided as constants. The primary use case for this is SIMD intrinsics where arguments are defined by vendors to be constant and in LLVM they indeed must be constant as well. For now this is mostly just a semantic guarantee in rustc that an argument is a constant when invoked, phases like trans don't actually take advantage of it yet. This means that we'll be able to use this in stdsimd but we won't be able to remove the `constify_*` macros just yet. Hopefully soon though!
2018-02-05Rollup merge of #47892 - Badel2:const_type_id_of, r=oli-obkkennytm-1/+1
Turn `type_id` into a constant intrinsic https://github.com/rust-lang/rust/issues/27745 The method `get_type_id` in `Any` is intended to support reflection. It's currently unstable in favor of using an associated constant instead. This PR makes the `type_id` intrinsic a constant intrinsic, the same as `size_of` and `align_of`, allowing `TypeId::of` to be a `const fn`, which will allow using an associated constant in `Any`.
2018-02-04Auto merge of #47915 - eddyb:layout-of, r=nikomatsakisbors-2/+1
rustc: prefer ParamEnvAnd and LayoutCx over tuples for LayoutOf. This PR provides `tcx.layout_of(param_env.and(ty))` as the idiomatic replacement for the existing `(tcx, param_env).layout_of(ty)` and removes fragile (coherence-wise) layout-related tuple impls. r? @nikomatsakis
2018-02-03Auto merge of #47845 - Zoxc:gen-fixes, r=nikomatsakisbors-17/+51
Generator bugfixes r? @nikomatsakis
2018-02-01Turn `type_id` into a constant intrinsicBadel2-1/+1
Add rustc_const_unstable attribute for `any::TypeId::of` Add test for `const fn TypeId::of`
2018-02-01rustc: prefer ParamEnvAnd and LayoutCx over tuples for LayoutOf.Eduard-Mihai Burtescu-2/+1
2018-01-30Force locals to be live after they are borrowed for immovable generators. ↵John Kåre Alsaker-17/+51
Fixes #47736
2018-01-29rustc: replace "lvalue" terminology with "place" in the code.Eduard-Mihai Burtescu-10/+10
2018-01-23Make immovable generators unsafeJohn Kåre Alsaker-2/+10
2018-01-23Adds support for immovable generators. Move checking of invalid borrows ↵John Kåre Alsaker-16/+61
across suspension points to borrowck. Fixes #44197, #45259 and #45093.
2018-01-16remove noop landing pads in cleanup shimsAriel Ben-Yehuda-6/+13
These are already removed in the normal optimization pipeline - so this should slightly improve codegen performance, as these cleanup blocks are known to hurt LLVM. This un-regresses and is therefore a fix for #47442. However, the reporter of that issue should try using `-C panic=abort` instead of carefully avoiding panics.
2018-01-13Don't promote to 'static the result of dereferences.Eduard-Mihai Burtescu-2/+34
2018-01-11Don't track local_needs_drop separately in qualify_consts (fixes #47351).Alexander Regueiro-23/+31
2018-01-03Auto merge of #46984 - arielb1:pre-statement-effect, r=nikomatsakisbors-2/+9
NLL fixes First, introduce pre-statement effects to dataflow to fix #46875. Edge dataflow effects might make that redundant, but I'm not sure of the best way to integrate them with liveness etc., and if this is a hack, this is one of the cleanest hacks I've seen. And I want a small fix to avoid the torrent of bug reports. Second, fix linking of projections to fix #46974 r? @pnkfelix
2017-12-24Auto merge of #46896 - arielb1:shadow-scope, r=eddybbors-3/+3
fix debuginfo scoping of let-statements r? @eddyb
2017-12-24add pre-statement-effect to dataflowAriel Ben-Yehuda-2/+9
2017-12-21fix debuginfo scoping of let-statementsAriel Ben-Yehuda-3/+3
2017-12-21Mir: Add Terminatorkind::AbortDavid Henningsson-0/+4
The Abort Terminatorkind will cause an llvm.trap function call to be emitted. Signed-off-by: David Henningsson <diwic@ubuntu.com>
2017-12-20Rollup merge of #46852 - scottmcm:asm-placecontext, r=arielb1kennytm-0/+2
Split PlaceContext::Store into Store & AsmOutput Outputs in InlineAsm can be read-write, so splitting it out is useful for things like Store-Store folding, as that's unsound for a Store-AsmOutput. This PR is intended to make no changes, just be the mechanical split of the enum. Future changes can use the split, like a MIR pass I'm working on and perhaps two-phase borrows (see this FIXME: https://github.com/rust-lang/rust/pull/46852/files#diff-74dcd7740ab2104cd2b9a3b68dd4f208R543)