about summary refs log tree commit diff
path: root/src/librustc_mir
AgeCommit message (Collapse)AuthorLines
2020-04-09Use new utility in `eval_context`Dylan MacKenzie-9/+10
2020-04-09Make `MaybeStorageLive` correct for all kinds of MIR bodiesDylan MacKenzie-5/+17
Before, it ignored the first argument and marked all variables without `Storage*` annotations as dead.
2020-04-09Add utility to find locals that don't use `Storage*` annotationsDylan MacKenzie-0/+43
2020-04-09Normalize MIR locals' types for generator layout computation.Oliver Scherer-1/+4
2020-04-09tighten CTFE safety net for accesses to globalsRalf Jung-8/+23
2020-04-09Auto merge of #70860 - lcnr:has_local_value, r=nikomatsakisbors-3/+3
remove `KEEP_IN_LOCAL_TCX` flag closes #70285 I did not rename `needs_infer` here as this complex enough as is. Will probably open a followup for that. r? @eddyb
2020-04-08Use `PredicateObligation`s instead of `Predicate`sEsteban Küber-1/+1
Keep more information about trait binding failures.
2020-04-08replace `has_local_value` with `needs_infer`Bastian Kauschke-3/+3
2020-04-08Suggest move for closures and async blocks in more cases.Alex Aktsipetrov-39/+24
2020-04-08Replace "rc"/"arc" lang items with Rc/Arc diagnostic items.Eduard-Mihai Burtescu-17/+20
2020-04-07Rollup merge of #70846 - tmiasko:compiler-builtins-codegen-units, r=alexcrichtonDylan DPC-1/+8
Keep codegen units unmerged when building compiler builtins Make it possible to control how mono items are partitioned into code generation units, when compiling the compiler builtins, by retaining the original partitioning. Helps with #48625, #61063, #67960, #70489. r? @alexcrichton
2020-04-07Rollup merge of #70762 - RalfJung:miri-leak-check, r=oli-obkDylan DPC-76/+116
Miri leak check: memory reachable through globals is not leaked Also make Miri memory dump prettier by sharing more code with MIR dumping, and fix a bug where the Miri memory dump would print some allocations twice. r? @oli-obk Miri PR: https://github.com/rust-lang/miri/pull/1301
2020-04-06ty: switch `Ty::walk` from `Ty` to `GenericArg`.Eduard-Mihai Burtescu-10/+22
2020-04-06Auto merge of #70771 - RalfJung:ctfe-loop, r=oli-obkbors-31/+49
Miri terminator handling: only do progress sanity check for 'Call' terminator This will still catch mistakes in bad intrinsic/foreign-item shims, which is the main source of errors here. Fixes https://github.com/rust-lang/rust/issues/70723 r? @oli-obk
2020-04-06Rollup merge of #70827 - estebank:shorten-sugg-span-add-lt, r=ecstatic-morseMazdak Farrokhzad-27/+16
Use smaller span for suggestion restricting lifetime
2020-04-06Keep codegen units unmerged when building compiler builtinsTomasz Miąsko-1/+8
2020-04-05Use smaller span for suggestion restricting lifetimeEsteban Küber-27/+16
2020-04-05make set_span public, as all the fields it touches are public alreadyRalf Jung-1/+1
2020-04-05set span more accurately during const_propRalf Jung-7/+13
2020-04-05Miri engine: use span_bug in a few placesRalf Jung-20/+32
2020-04-05Miri terminator handling: only do progress sanity check for 'Call' terminatorRalf Jung-5/+5
2020-04-05Rollup merge of #70777 - faern:use-assoc-int-consts2, r=dtolnayDylan DPC-1/+1
Don't import integer and float modules, use assoc consts Stop importing the standard library integer and float modules to reach the `MIN`, `MAX` and other constants. They are available directly on the primitive types now. This PR is a follow up of #69860 which made sure we use the new constants in documentation. This type of change touches a lot of files, and previously all my assoc int consts PRs had collisions and were accepted only after a long delay. So I'd prefer to do it in smaller steps now. Just removing these imports seem like a good next step. r? @dtolnay
2020-04-05Remove Arcs in queries.Camille GILLOT-9/+9
2020-04-05Rollup merge of #70806 - RalfJung:miri-assignment-check, r=eddybDylan DPC-19/+39
fix Miri assignment sanity check Thanks @eddyb for pointing me to the right APIs! r? @eddyb Fixes https://github.com/rust-lang/rust/issues/70804
2020-04-05fix commentRalf Jung-3/+3
2020-04-05miri assignment check: compare types after normalizing all late-bound ↵Ralf Jung-19/+39
regions away
2020-04-05Stop importing int/float modules in librustc_*Linus Färnstrand-1/+1
2020-04-04Miri: remove an outdated FIXMERalf Jung-1/+0
2020-04-04indicate better which kind of memory got leakedRalf Jung-12/+16
2020-04-04share more alloc printing code between Miri and MIR dumpingRalf Jung-63/+78
2020-04-04avoid printing allocations twiceRalf Jung-9/+11
2020-04-04Miri leak_report: do not report leaks of allocations that are reachable from ↵Ralf Jung-5/+24
globals
2020-04-03Auto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakisbors-24/+60
Make the rustc respect the `-C codegen-units` flag in incremental mode. This PR implements (the as of yet unapproved) major change proposal at https://github.com/rust-lang/compiler-team/issues/245. See the description there for background and rationale. The changes are pretty straightforward and should be easy to rebase if the proposal gets accepted at some point. r? @nikomatsakis cc @pnkfelix
2020-04-03Rollup merge of #70707 - ecstatic-morse:dataflow-graphviz-cleanup, ↵Mazdak Farrokhzad-277/+0
r=nikomatsakis Remove unused graphviz emitter This was only used by the old dataflow framework that was removed in #69644.
2020-04-03Minor follow-up after renaming librustc(_middle)Yuki Okushi-2/+2
2020-04-03Rollup merge of #70532 - RalfJung:miri-assign, r=eddybMazdak Farrokhzad-52/+69
Miri engine: stronger type-based sanity check for assignments r? @oli-obk @eddyb Fixes https://github.com/rust-lang/rust/issues/70405 That issue says > be sure to also add appropriate mutability checks to the patterns (mutable for the source, immutable for the dest) I decided not to do that because I see no good reason to do it. The engine does not care either way, the assignment will happen correctly.
2020-04-03Rollup merge of #70595 - wesleywiser:remove_unused_discriminant_reads, r=oli-obkMazdak Farrokhzad-11/+15
Remove unused discriminant reads from MIR bodies Allow the `SimplifyLocals` pass to remove reads of discriminants if the read is never used. Fixes #70531 r? @oli-obk
2020-04-02switch assignment check back to testing layout equalityRalf Jung-18/+23
2020-04-02also use mir_assign_valid_types in from_known_layout checkRalf Jung-63/+58
2020-04-02also accept fn-ptr-type-changing assignmentsRalf Jung-2/+7
2020-04-02Miri engine: stronger type-based sanity check for assignmentsRalf Jung-5/+17
2020-04-02Remove unused graphviz visualizationDylan MacKenzie-277/+0
This was used by the old framework that was removed in #69644.
2020-04-02Remove unused discriminant reads from MIR bodiesWesley Wiser-11/+15
Allow the `SimplifyLocals` pass to remove reads of discriminants if the read is never used.
2020-04-02direct imports for langitem stuffMazdak Farrokhzad-5/+5
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-89/+84
2020-04-01Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obkDylan DPC-7/+7
rustc_target::abi: rename FieldPlacement to FieldsShape. Originally suggested by @eddyb.
2020-04-01Rollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obkDylan DPC-74/+35
Miri: make backtrace function names and spans match up Currently, Miri backtraces are a bit confusing: ``` error: Undefined Behavior: entering unreachable code --> tests/compile-fail/never_transmute_void.rs:10:11 | 10 | match v {} //~ ERROR entering unreachable code | ^ entering unreachable code | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information note: inside call to `f` at tests/compile-fail/never_transmute_void.rs:17:5 --> tests/compile-fail/never_transmute_void.rs:17:5 | 17 | f(v); //~ inside call to `f` | ^^^^ = note: inside call to `main` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34 = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73 = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5 ``` When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is *where the main function is called*. This is not how backtraces are usually rendered (including e.g. with `RUST_BACKTRACE=1`). Usually we print next to each function name where inside that function the frame is currently executing, not where the *parent* frame is executing. With this PR and the Miri side at https://github.com/rust-lang/miri/pull/1283, the backtrace now looks as follows: ``` error: Undefined Behavior: entering unreachable code --> tests/compile-fail/never_transmute_void.rs:10:11 | 10 | match v {} //~ ERROR entering unreachable code | ^ entering unreachable code | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: inside `f` at tests/compile-fail/never_transmute_void.rs:10:11 note: inside `main` at tests/compile-fail/never_transmute_void.rs:17:5 --> tests/compile-fail/never_transmute_void.rs:17:5 | 17 | f(v); //~ inside `main` | ^^^^ = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:67:34 = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:52:73 = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6034 ~ std[87db]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc/src/libstd/sys_common/backtrace.rs:130:5 ``` Now function name and printed line numbers match up in the notes. This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside. With this, we can also remove the `span` field from Miri's stack frames (which used to track the *caller span* of that frame, quite confusing), and then get of a whole lot of `span` arguments that ultimately just served to fill that field (and as a fallback for `caller_location`, which however was never actually used). r? @oli-obk
2020-04-01Rollup merge of #70627 - spastorino:use-place-directly-its-copy, r=oli-obkMazdak Farrokhzad-295/+286
Use place directly its copy r? @oli-obk
2020-04-01Rollup merge of #70511 - ecstatic-morse:mir-dataflow-graphviz, r=davidtwcoMazdak Farrokhzad-7/+26
Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization Previously, to visualize the results of a MIR dataflow pass, one had to add a `#[rustc_mir(borrowck_graphviz_postflow)]` attribute to functions of interest. However, there is no way to specify this attribute on closures and generators, so it was impossible to view results for these MIR bodies. This PR adds a flag, `-Z dump-mir-dataflow`, which will output the dataflow results for any functions specified in `-Z dump-mir` to the output directory specified by `-Z dump-mir-dir`. This behavior is modeled on the `-Z dump-mir-graphviz` flag.
2020-03-31Use Place directly in apply_call_return_effect on framework/tests, it's CopySantiago Pastorino-1/+1