about summary refs log tree commit diff
path: root/src/librustc_mir
AgeCommit message (Collapse)AuthorLines
2019-12-02Remove BodyCache.body and rely on Deref as much as possible for ↵Paul Daniel Faria-58/+58
ReadOnlyBodyCache
2019-12-02Fix typoPaul Daniel Faria-1/+1
2019-12-02Fix tidy errorsPaul Daniel Faria-58/+167
2019-12-02Fix typos caused during rebasePaul Daniel Faria-6/+6
2019-12-02Fix remaining compilation issuesPaul Daniel Faria-36/+48
2019-12-02Simplify BodyCache impl and fix all remaining type errors in librustc_mir ↵Paul Daniel Faria-414/+419
(lifetime errors still exist)
2019-12-02Fix remaining Body -> (ReadOnly)BodyCache type errors in librustc_mir ↵Paul Daniel Faria-14/+16
outside of librustc_mir/transform
2019-12-02Add predecessors fn to ReadOnlyBodyCache, fix more Body -> ↵Paul Daniel Faria-45/+46
(ReadOnly)BodyCache type errors
2019-12-02Add read_only fn to BodyCache<&mut...> impl, fix more Body -> ↵Paul Daniel Faria-40/+39
(ReadOnly)BodyCache type errors
2019-12-02Fix a large number of Body -> (ReadOnly)BodyCache type errors, add ↵Paul Daniel Faria-162/+164
predecessor_locations fn to ReadOnlyBodyCache
2019-12-02Simplify Cache wrapper to single type, impl Deref on it, fix all compilation ↵Paul Daniel Faria-75/+26
errors in librustc_codegen_ssa
2019-12-02Move predecessors cache back to its own typePaul Daniel Faria-1/+2
This ensures that the cache can be properly ignored during encoding and decoding. Fix panics that arose due to lack of encoding
2019-12-02Address nits and remove unneeded passPaul Daniel Faria-8/+4
2019-12-02Move predecessors cache invalidation back to basic_blocks_mut, add a couple ↵Paul Daniel Faria-69/+84
more ensure_predecessors to prevent panics
2019-12-02Ensure predecessors are recomputed at critical points, fixes panicsPaul Daniel Faria-5/+22
2019-12-02Address linting errors caught by CIPaul Daniel Faria-2/+2
2019-12-02Add pass to ensure predecessors cache is generated after optimizationPaul Daniel Faria-0/+17
2019-12-02Stop invalidating predecessors cache when accessing unique basic block, ↵Paul Daniel Faria-64/+70
invalidate cache when accessing unique terminator
2019-12-02Inline cache impl into Body, rename predecessor fns, change output of ↵Paul Daniel Faria-2/+2
predecessors_for to slice
2019-12-02Remove interior mutability in mir predecessors cachePaul Daniel Faria-2/+2
2019-12-02Auto merge of #66874 - RalfJung:miri-assert-panic, r=oli-obkbors-118/+188
Miri engine: proper support for `Assert` MIR terminators This puts down the basis for https://github.com/rust-lang/miri/issues/1070, and I also did some clean-up. The Miri side of this is at https://github.com/rust-lang/miri/pull/1084. r? @oli-obk
2019-12-02Rollup merge of #66827 - RalfJung:miri-missing-ret-place, r=oli-obkRalf Jung-15/+23
handle diverging functions forwarding their return place Fixes https://github.com/rust-lang/miri/issues/1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places. This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine. r? @oli-obk
2019-12-02Rollup merge of #66654 - ecstatic-morse:check-consts-ref, r=eddyb,matthewjasperRalf Jung-129/+101
Handle const-checks for `&mut` outside of `HasMutInterior` Addresses [this comment](https://github.com/rust-lang/rust/pull/64470#discussion_r328200508). Const-checking relied on `HasMutInterior` to forbid `&mut` in a const context. This was strange because all we needed to do was look for an `Rvalue::Ref` with a certain `BorrowKind`, whereas the `Qualif` traits are specifically meant to get the qualifs for a *value*. This PR removes that logic from `HasMutInterior` and moves it into `check_consts::Validator`. As a result, we can now properly handle qualifications for `static`s, which had to be ignored previously since you can e.g. borrow a static `Cell` from another `static`. We also remove the `derived_from_illegal_borrow` logic, since it is no longer necessary; we give good errors for subsequent reborrows/borrows of illegal borrows.
2019-12-02fix init_allocation_extraRalf Jung-20/+30
2019-12-02Assert terminator is never executed in ConstPropRalf Jung-1/+1
2019-12-02fat -> wideRalf Jung-6/+6
2019-12-02make alloc_extra machine hook a bit nicerRalf Jung-17/+21
2019-12-02add and use helper method to get SourceInfo of current instruction in frameRalf Jung-14/+22
2019-12-02Miri: add helper fn to allocate string; simplify alloc_caller_locationRalf Jung-33/+36
2019-12-02Add From instances for Pointer -> ScalarMaybeUndef and Pointer -> ImmediateRalf Jung-7/+14
2019-12-02expose span to M::assert_panic, and provide helper to turn that into ↵Ralf Jung-10/+20
CallerLocation
2019-12-02Miri: add machine hook for MIR-level assertion panicsRalf Jung-39/+67
2019-12-02make use of Result::map_orLzu Tao-1/+1
2019-12-02Rollup merge of #66926 - RalfJung:miri-stop, r=oli-obkMazdak Farrokhzad-1/+1
add reusable MachineStop variant to Miri engine error enum Replace the Miri-tool-specific `Exit` error variant with something dynamically typed that all clients of the Miri engine can use. r? @oli-obk Cc https://github.com/rust-lang/rust/issues/66902
2019-12-02Rollup merge of #66789 - eddyb:mir-source-scope-local-data, r=oli-obkMazdak Farrokhzad-123/+90
rustc: move mir::SourceScopeLocalData to a field of SourceScopeData. By having one `ClearCrossCrate<SourceScopeLocalData>` for each scope, as opposed to a single `ClearCrossCrate` for all the `SourceScopeLocalData`s, we can represent the fact that some scopes have `SourceScopeLocalData` associated with them, and some don't. This is useful when doing MIR inlining across crates, because the `ClearCrossCrate` will be `Clear` for the cross-crate MIR scopes and `Set` for the local ones. Also see https://github.com/rust-lang/rust/pull/66203#issuecomment-555589574 for some context around this approach. Fixes #51314.
2019-12-01Incorporate fixes from reviewDylan MacKenzie-5/+3
2019-12-01Miri core engine: use throw_ub instead of throw_panicRalf Jung-8/+6
2019-12-01add reusable MachineStop variant to Miri engine error enumRalf Jung-1/+1
2019-12-01Rollup merge of #66832 - RalfJung:const-prop-no-alloc, r=oli-obkMazdak Farrokhzad-7/+25
const_prop: detect and avoid catching Miri errors that require allocation r? @wesleywiser @oli-obk
2019-12-01Rollup merge of #66790 - christianpoveda:check-set-discriminant, r=oli-obkMazdak Farrokhzad-3/+2
Do `min_const_fn` checks for `SetDiscriminant`s target Fixes https://github.com/rust-lang/rust/issues/66556 r? @oli-obk @ecstatic-morse
2019-12-01Rollup merge of #66726 - CAD97:miri-recursion-limit, r=RalfJungMazdak Farrokhzad-1/+1
Use recursion_limit for const eval stack limit cc https://github.com/rust-lang/miri/issues/643 @orium @RalfJung I'm really not certain how exactly to handle this change, but it looks like it's that simple. Reuse `recursion_limit` ("The maximum recursion limit for potentially infinitely recursive operations such as auto-dereference and monomorphization") which is configurable by the user for the const evaluation stack frame limit. The other option is to make `const_eval_stack_frame_limit` configurable in the same way as `recursion_limit` (but I'm not sure how to do that and it'd be a bigger change). Fixes https://github.com/rust-lang/miri/issues/643.
2019-12-01Rollup merge of #66679 - mark-i-m:fix-anon-lifetime-errors, r=matthewjasperMazdak Farrokhzad-61/+37
Improve lifetime errors with implicit trait object lifetimes r? @matthewjasper cc @estebank I still think the ideal solution would be to construct a `BrAnon`, but that seems like a more invasive change, and can be done later. This at least gets rid of the hack in `OutliveSuggestion` and is slightly more principled.
2019-11-30Merge match branchesChristian Poveda-4/+1
2019-11-30Don't repeat the `is_const_fn_raw` checkOliver Scherer-14/+12
2019-11-30`find_fn` -> `find_mir_or_eval_fn` renameOliver Scherer-5/+5
2019-11-30rustc_mir: use nicer path printing for #[rustc_regions] NLL tests.Eduard-Mihai Burtescu-12/+10
2019-11-30Rollup merge of #66895 - Centril:rustc_feature, r=oli-obkMazdak Farrokhzad-24/+24
Feature gating *declarations* => new crate `rustc_feature` This PR moves the data-oriented parts of feature gating into its own crate, `rustc_feature`. The parts consist of some data types as well as `accepted`, `active`, `removed`, and `builtin_attrs`. Feature gate checking itself remains in `syntax::feature_gate::check`. The parts which define how to emit feature gate errors could probably be moved to `rustc_errors` or to the new `rustc_session` crate introduced in #66878. The visitor itself could probably be moved as a pass in `rustc_passes` depending on how the dependency edges work out. The PR also contains some drive-by cleanup of feature gate checking. As such, the PR probably best read commit-by-commit. r? @oli-obk cc @petrochenkov cc @Mark-Simulacrum
2019-11-30Rollup merge of #66870 - tmiasko:simplify-ty, r=oli-obkMazdak Farrokhzad-1/+7
SimplifyArmIdentity only for locals with the same type Fixes #66856 Fixes #66851
2019-11-30Rollup merge of #66612 - Nadrieril:or-patterns-initial, r=varkorMazdak Farrokhzad-15/+53
Initial implementation of or-pattern usefulness checking The title says it all. I'd like to request a perf run on that, hopefully this doesn't kill performance too much. cc https://github.com/rust-lang/rust/issues/54883
2019-11-30Apply suggestions from code reviewNadrieril Feneanar-2/+2
Co-Authored-By: varkor <github@varkor.com>