about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2020-06-23Auto merge of #73643 - Manishearth:rollup-68dr8fz, r=Manishearthbors-33/+22
Rollup of 9 pull requests Successful merges: - #72271 (Improve compiler error message for wrong generic parameter order) - #72493 ( move leak-check to during coherence, candidate eval) - #73398 (A way forward for pointer equality in const eval) - #73472 (Clean up E0689 explanation) - #73496 (Account for multiple impl/dyn Trait in return type when suggesting `'_`) - #73515 (Add second message for LiveDrop errors) - #73567 (Clarify --extern documentation.) - #73572 (Fix typos in doc comments) - #73590 (bootstrap: no `config.toml` exists regression) Failed merges: r? @ghost
2020-06-23Rollup merge of #73515 - christianpoveda:livedrop-diagnostics, r=oli-obkManish Goregaokar-7/+13
Add second message for LiveDrop errors This is an attempt to fix https://github.com/rust-lang/rust/issues/72907 by adding a second message to the `LiveDrop` diagnostics. Changing from this ``` error[E0493]: destructors cannot be evaluated at compile-time --> src/lib.rs:7:9 | 7 | let mut always_returned = None; | ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors error: aborting due to previous error ``` to this ``` error[E0493]: destructors cannot be evaluated at compile-time --> foo.rs:6:9 | 6 | let mut always_returned = None; | ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors ... 10 | always_returned = never_returned; | --------------- value is dropped here error: aborting due to previous error ``` r? @RalfJung @ecstatic-morse
2020-06-23Rollup merge of #73398 - oli-obk:const_raw_ptr_cmp, r=varkor,RalfJung,nagisaManish Goregaokar-26/+9
A way forward for pointer equality in const eval r? @varkor on the first commit and @RalfJung on the second commit cc #53020
2020-06-22Updated query for num_counters to compute from max indexRich Kadel-4/+24
Also added FIXME comments to note the possible need to accommodate counter increment calls in source-based functions that differ from the function context of the caller instance (e.g., inline functions).
2020-06-22using "mir_body" (vs "body") in InstrumentCoverageRich Kadel-2/+2
The mod uses both MIR bodies and HIR bodies, so I'm trying to maintain consistency with these names.
2020-06-22moves coverage data computation from pass to queryRich Kadel-30/+37
2020-06-23Rollup merge of #73586 - RalfJung:switch-ty, r=oli-obkDylan DPC-1/+11
switch_ty is redundant This field is redundant, but we cannot remove it currently as pretty-printing relies on it (and it does not have access to `mir::Body` to compute the type itself). Cc @oli-obk @matthewjasper @jonas-schievink
2020-06-23Rollup merge of #73578 - RalfJung:ty-ctxt-at, r=jonas-schievinkDylan DPC-11/+10
Make is_freeze and is_copy_modulo_regions take TyCtxtAt Make is_freeze and is_copy_modulo_regions take TyCtxtAt instead of separately taking TyCtxt and Span. This is consistent with is_sized.
2020-06-22Address remaining feedback itemsRich Kadel-25/+2
2020-06-22implemented query for coverage dataRich Kadel-1/+7
This commit adds a query that allows the CoverageData to be pulled from a call on tcx, avoiding the need to change the `codegen_intrinsic_call()` signature (no need to pass in the FunctionCx or any additional arguments. The commit does not change where/when the CoverageData is computed. It's still done in the `pass`, and saved in the MIR `Body`. See discussion (in progress) here: https://github.com/rust-lang/rust/pull/73488#discussion_r443825646
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-1/+0
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-22make layout check a mere sanity checkRalf Jung-4/+6
2020-06-22also use relator in interpreter assignment sanity checkRalf Jung-74/+88
2020-06-22fix typoRalf Jung-1/+1
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-06-22use a TypeRelation to compare the typesRalf Jung-18/+80
2020-06-22no need to normalize mutability any moreRalf Jung-13/+7
2020-06-22reveal_all when sanity-checking MIR assignment typesRalf Jung-3/+6
2020-06-22also normalize_erasing_regionsRalf Jung-0/+7
2020-06-22also normalize constants when comparing typesRalf Jung-33/+35
2020-06-22prepare visit_statement for checking more kinds of statementsRalf Jung-25/+28
2020-06-22MIR sanity check: validate types on assignmentRalf Jung-3/+51
2020-06-21num_counters to u32, after implementing TypeFoldableRich Kadel-3/+3
2020-06-21fmtRalf Jung-2/+1
2020-06-21MIR validation: check switch_tyRalf Jung-1/+12
2020-06-21Make is_freeze and is_copy_modulo_regions take TyCtxtAtRalf Jung-11/+10
2020-06-21Auto merge of #71911 - wesleywiser:const_prop_small_cleanups, r=oli-obkbors-26/+21
[mir-opt] Small ConstProp cleanup
2020-06-20Satisfy tidyOliver Scherer-4/+4
2020-06-20Refer just to the issue in the raw ptr cmp diagnostic instead of explaining ↵Oliver Scherer-15/+1
everything in the diagnostic
2020-06-19Rollup merge of #73359 - jonas-schievink:do-the-shimmy, r=matthewjasperManish Goregaokar-6/+4
shim.rs: avoid creating `Call` terminators calling `Self` Also contains some cleanup and doc comment additions so I could make sense of the code. Fixes https://github.com/rust-lang/rust/issues/73109 Closes https://github.com/rust-lang/rust/pull/73175 r? @matthewjasper
2020-06-19Rollup merge of #73347 - tmiasko:incompatible-sanitizers, r=nikicManish Goregaokar-19/+2
Diagnose use of incompatible sanitizers Emit an error when incompatible sanitizer are configured through command line options. Previously the last one configured prevailed and others were silently ignored. Additionally use a set to represent configured sanitizers, making it possible to enable multiple sanitizers at once. At least in principle, since currently all of them are considered to be incompatible with others.
2020-06-19add second message for livedrop errorsChristian Poveda-7/+13
2020-06-19add new error codeChristian Poveda-1/+1
2020-06-19Incorporate review suggestionsDylan MacKenzie-5/+8
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2020-06-19Look for stores between non-conflicting generator saved localsDylan MacKenzie-13/+147
This is to prevent the miscompilation in #73137 from reappearing. Only runs with `-Zvalidate-mir`.
2020-06-19Use newtype to map from `Local` to `GeneratorSavedLocal`Dylan MacKenzie-44/+64
2020-06-19code coverage foundation for hash and num_countersRich Kadel-52/+144
Replaced dummy values for hash and num_counters with computed values, and refactored InstrumentCoverage pass to simplify injecting more counters per function in upcoming versions. Improved usage documentation and error messaging.
2020-06-19update diagnostics for &mut in constantsChristian Poveda-11/+17
2020-06-19forbid mutable references in all constants except const fnsChristian Poveda-0/+6
2020-06-19Add fuzzy pointer comparison intrinsicsOliver Scherer-8/+14
2020-06-19Remove the const_raw_ptr_comparison feature gate.Oliver Scherer-25/+16
We can never supply a meaningful implementation of this. Instead, the follow up commits will create two intrinsics that approximate comparisons: * `ptr_maybe_eq` * `ptr_maybe_ne` The fact that `ptr_maybe_eq(a, b)` is not necessarily the same value as `!ptr_maybe_ne(a, b)` is a symptom of this entire problem.
2020-06-19Rollup merge of #73011 - richkadel:llvm-count-from-mir-pass, r=tmandryRalf Jung-0/+97
first stage of implementing LLVM code coverage This PR replaces #70680 (WIP toward LLVM Code Coverage for Rust) since I am re-implementing the Rust LLVM code coverage feature in a different part of the compiler (in MIR pass(es) vs AST). This PR updates rustc with `-Zinstrument-coverage` option that injects the llvm intrinsic `instrprof.increment()` for code generation. This initial version only injects counters at the top of each function, and does not yet implement the required coverage map. Upcoming PRs will add the coverage map, and add more counters and/or counter expressions for each conditional code branch. Rust compiler MCP https://github.com/rust-lang/compiler-team/issues/278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation ***[I put together some development notes here, under a separate branch.](https://github.com/richkadel/rust/blob/cfa0b21d34ee64e4ebee226101bd2ef0c6757865/src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md)***
2020-06-19Rollup merge of #73130 - wesleywiser:remove_const_prop_for_indirects, r=oli-obkRalf Jung-8/+3
Remove const prop for indirects This was only used by one mir-opt test and since it causes buggy behavior under `-Zmir-opt-level=2`, it seems like we should remove it. This was split out from #71946. Closes #72679 Closes #72372 Closes #72285
2020-06-18Rollup merge of #72814 - RalfJung:mir-visir-terminator, r=oli-obkManish Goregaokar-73/+64
remove visit_terminator_kind from MIR visitor For some reason, we had both `visit_terminator` and `visit_terminator_kind`. In contrast, for `Statement` we just have `visit_statement`. So this cleans things up by removing `visit_terminator_kind` and porting its users to `visit_terminator`.
2020-06-16Rollup merge of #73339 - jonas-schievink:unbug, r=estebankDylan DPC-1/+5
Don't run generator transform when there's a TyErr Not sure if this might cause any problems later on, but we shouldn't be hitting codegen or const eval for the produced MIR anyways, so it should be fine. cc https://github.com/rust-lang/rust/issues/72685#issuecomment-643749020
2020-06-16rename location field of Drop terminators to placeRalf Jung-51/+47
2020-06-16get rid of an unused 'span' fieldRalf Jung-6/+0
2020-06-16remove visit_terminator_kind from MIR visitorRalf Jung-18/+19
2020-06-15[const-prop] Remove `ConstPropMode::NoPropagation`Wesley Wiser-26/+21
This mode is unnecessary because it's always ok to evaluate the right-hand side of assignments even if the left-hand side should not have reads propagated.
2020-06-15Add new `fn_span` to TerminatorKind::Call instanceRich Kadel-0/+1
2020-06-15added test, Operand::const_from_scalar, require_lang_item, & commentsRich Kadel-37/+15
Addresses feedback from @oli-obk (Thanks!)