about summary refs log tree commit diff
path: root/src/librustc_mir
AgeCommit message (Collapse)AuthorLines
2020-05-02Rollup merge of #71772 - cjgillot:ensure, r=petrochenkovDylan DPC-1/+1
Mark query function as must_use. And use the `ensure()` version when the result is not needed.
2020-05-02Rollup merge of #69274 - LeSeulArtichaut:target-feature-11, r=hanna-kruppeDylan DPC-1/+25
Implement RFC 2396: `#[target_feature]` 1.1 Tracking issue: #69098 r? @nikomatsakis cc @gnzlbg @joshtriplett
2020-05-02Move ensure_sufficient_stack to data_structuresSimonas Kazlauskas-2/+2
We anticipate this to have uses in all sorts of crates and keeping it in `rustc_data_structures` enables access to it from more locations without necessarily pulling in the large `librustc` crate.
2020-05-02Prevent stack overflow for deeply recursive codeOliver Scherer-2/+6
2020-05-02fix miri-unleash delayed sanity checkingRalf Jung-0/+2
2020-05-02explain why we use def_spanRalf Jung-0/+1
2020-05-02make sure the miri-unleash-flag is not used to circumvent feature gatesRalf Jung-0/+3
2020-05-02Report cannot move errors in promoted MIRMatthew Jasper-6/+42
2020-05-02Rollup merge of #71738 - RalfJung:pointer-no-alloc-id, r=oli-obkRalf Jung-24/+22
remove AllocId generalization of Pointer This was only needed for the "snapshot" machinery, which is gone. r? @oli-obk
2020-05-02Rollup merge of #71712 - RalfJung:error-backtrace, r=oli-obkRalf Jung-1/+1
Miri: port error backtraces to std::backtrace No need to pull in an external dependency if libstd already includes this feature (using the same dependency internally, but... still). r? @oli-obk
2020-05-02fix rustdoc warningsTshepang Lekhonkhobe-4/+8
2020-05-02Added MIR constant propagation of Scalars into function call argumentsFélix Fischer-5/+51
- Documented rationale of current solution - Polished documentation
2020-05-01Remove leftover chalk typesJack Huey-5/+0
2020-05-01Remove a comment that made only sense in the original position of this cycle ↵Oliver Scherer-3/+1
check.
2020-05-01Mark query function as must_use.Camille GILLOT-1/+1
2020-05-01Prevent calls to functions with `#[target_feature]` in safe contextsLeSeulArtichaut-1/+25
2020-05-01Move recursion check for zsts back to read site instead of access check site.Oliver Scherer-12/+10
2020-05-01Note that try_validation_pat can take a format str directly.jumbatm-0/+9
2020-05-01Manually format macro to not go over text width.jumbatm-2/+8
2020-05-01Expect at least one expr for p, what_fmt and expected_fmt.jumbatm-2/+2
2020-05-01Also make expected param wrapped in format_args.jumbatm-3/+3
2020-05-01Wrap try_validation_pat! args in format_args!jumbatm-3/+3
2020-05-01Update try_validation_pat! doc comment.jumbatm-2/+13
2020-05-01Apply suggestions for try_validation_pat!.jumbatm-12/+11
2020-05-01Fix comment to reflect error handling behaviour.jumbatm-1/+1
2020-05-01Allow unreachable_patterns instead of using `if true`jumbatm-1/+2
2020-05-01Match kind in try_validation_pat!.jumbatm-3/+3
Avoids having to repeat InterpErrorInfo { .. }
2020-05-01Add FIXME about replacing all usages of try_validation.jumbatm-0/+1
2020-05-01Apply suggestions from code reviewjumbatm-5/+5
Co-Authored-By: Ralf Jung <post@ralfj.de> Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-05-01Partially unrevert #70566.jumbatm-5/+5
This partially reverts commit 4b5b6cbe60a8dd1822cfa46c41cf1ad58c113e18, reversing some changes made to 62b362472dbf8bdf43b252ac5ea53b527a8dbee3.
2020-05-01Throw validation failure for InvalidUndefBytes.jumbatm-1/+2
2020-05-01Don't fail for UndefinedBehaviourInfo in validation.jumbatm-2/+5
2020-05-01Don't duplicate body of try_validation.jumbatm-6/+3
2020-05-01Add try_validation_pat.jumbatm-1/+21
2020-05-01Don't duplicate macro for optional arg.jumbatm-24/+6
2020-05-01fmtRalf Jung-2/+2
2020-05-01remove AllocId generalization of PointerRalf Jung-23/+21
2020-05-01rename InvalidIntPtrUsageRalf Jung-6/+6
2020-05-01InterpError printing really is more Display than DebugRalf Jung-2/+2
also tweak InvalidDiscriminant message
2020-05-01Auto merge of #70674 - cjgillot:query-arena-all, r=matthewjasperbors-15/+15
Have the per-query caches store the results on arenas This PR leverages the cache for each query to serve as storage area for the query results. It introduces a new cache `ArenaCache`, which moves the result to an arena, and only stores the reference in the hash map. This allows to remove a sizeable part of the usage of the global `TyCtxt` arena. I only migrated queries that already used arenas before.
2020-04-30Rollup merge of #71691 - ecstatic-morse:const-unreachable, r=oli-obk,RalfJungTyler Mandry-7/+3
Allow `Unreachable` terminators unconditionally in const-checking If we ever actually reach an `Unreachable` terminator while executing, the MIR is ill-formed or the user's program is UB due to something like `unreachable_unchecked`. I don't think we need to forbid these in `qualify_min_const_fn`. r? @oli-obk
2020-04-30Rollup merge of #71688 - ecstatic-morse:const-downcast, r=oli-obkTyler Mandry-18/+2
Allow `Downcast` projections unconditionally in const-checking `ProjectionElem::Downcast` sounds scary, but it's really just the projection we use to access a particular enum variant. They usually appear in the lowering of a `match` statement, so they have been associated with control flow in const-checking, but they don't do any control flow by themselves. We already have a HIR pass that looks for `if` and `match` (even ones that have 1 or fewer reachable branches). That pass is double-checked by a MIR pass that looks for `SwitchInt`s and `FakeRead`s for match scrutinees. In my opinion, there's no need to look for `Downcast` as well. r? @oli-obk
2020-04-30Rollup merge of #71590 - RalfJung:mir-dump-pointers, r=oli-obkTyler Mandry-14/+23
MIR dump: print pointers consistently with Miri output This makes MIR allocation dump pointer printing consistent with Miri output: both use hexadecimal offsets with a `0x` prefix. To save some space, MIR dump replaces the `alloc` prefix by `a` when necessary. I also made AllocId/Pointer printing more consistent in their Debug/Display handling, and adjusted Display printing for Scalar a bit to avoid using decimal printing when we do not know the sign with which to interpret the value (IMO using decimal then is misleading).
2020-04-30Rollup merge of #71465 - oli-obk:is_thread_local_cleanup, r=matthewjasperTyler Mandry-5/+3
Add a convenience method on `TyCtxt` for checking for thread locals This PR extracts the cleanup part of #71192 r? @bjorn3
2020-04-30Rollup merge of #71449 - ecstatic-morse:free-region-cleanup, r=Mark-SimulacrumDylan DPC-1/+1
Move `{Free,}RegionRelations` and `FreeRegionMap` to `rustc_infer` ...and out of `rustc_middle`. This is to further #65031, albeit in a very minor way r? @Mark-Simulacrum
2020-04-30Rollup merge of #70950 - nikomatsakis:leak-check-nll-2, r=matthewjasperDylan DPC-52/+118
extend NLL checker to understand `'empty` combined with universes This PR extends the NLL region checker to understand `'empty` combined with universes. In particular, it means that the NLL region checker no longer considers `exists<R2> { forall<R1> { R1: R2 } }` to be provable. This is work towards https://github.com/rust-lang/rust/issues/59490, but we're not all the way there. One thing in particular it does not address is error messages. The modifications to the NLL region inference code turned out to be simpler than expected. The main change is to require that if `R1: R2` then `universe(R1) <= universe(R2)`. This constraint follows from the region lattice (shown below), because we assume then that `R2` is "at least" `empty(Universe(R2))`, and hence if `R1: R2` (i.e., `R1 >= R2` on the lattice) then `R1` must be in some universe that can name `'empty(Universe(R2))`, which requires that `Universe(R1) <= Universe(R2)`. ``` static ----------+-----...------+ (greatest) | | | early-bound and | | free regions | | | | | scope regions | | | | | empty(root) placeholder(U1) | | / | | / placeholder(Un) empty(U1) -- / | / ... / | / empty(Un) -------- (smallest) ``` I also made what turned out to be a somewhat unrelated change to add a special region to represent `'empty(U0)`, which we use (somewhat hackily) to indicate well-formedness checks in some parts of the compiler. This fixes #68550. I did some investigation into fixing the error message situation. That's a bit trickier: the existing "nice region error" code around placeholders relies on having better error tracing than NLL currently provides, so that it knows (e.g.) that the constraint arose from applying a trait impl and things like that. I feel like I was hoping *not* to do such fine-grained tracing in NLL, and it seems like we...largely...got away with that. I'm not sure yet if we'll have to add more tracing information or if there is some sort of alternative. It's worth pointing out though that I've not kind of shifted my opinion on whose job it should be to enforce lifetimes: I tend to think we ought to be moving back towards *something like* the leak-check (just not the one we *had*). If we took that approach, it would actually resolve this aspect of the error message problem, because we would be resolving 'higher-ranked errors' in the trait solver itself, and hence we wouldn't have to thread as much causal information back to the region checker. I think it would also help us with removing the leak check while not breaking some of the existing crates out there. Regardless, I think it's worth landing this change, because it was relatively simple and it aligns the set of programs that NLL accepts with those that are accepted by the main region checker, and hence should at least *help* us in migration (though I guess we still also have to resolve the existing crates that rely on leak check for coherence). r? @matthewjasper
2020-04-30deduplicate warningsRalf Jung-1/+1
2020-04-30unleashed Miri: open all the gatesRalf Jung-3/+3
2020-04-30Miri: port error backtraces to std::backtraceRalf Jung-1/+1
2020-04-30Add a convenience function for testing whether a static is `#[thread_local]`Oliver Scherer-5/+3