about summary refs log tree commit diff
path: root/src/librustc_mir
AgeCommit message (Collapse)AuthorLines
2020-06-22moves coverage data computation from pass to queryRich Kadel-30/+37
2020-06-23Rollup merge of #73600 - Aaron1011:fix/move-in-macro, r=ecstatic-morseDylan DPC-1/+1
Fix spurious 'value moved here in previous iteration of loop' messages Fixes #46099 Previously, we would check the 'move' and 'use' spans to see if we should emit this message. However, this can give false positives when macros are involved, since two distinct expressions may end up with the same span. Instead, we check the actual MIR `Location`, which eliminates false positives.
2020-06-23Rollup merge of #73586 - RalfJung:switch-ty, r=oli-obkDylan DPC-10/+14
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-15/+14
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-22fix subtle bug in NLL type checkerNiko Matsakis-1/+1
The bug was revealed by the behavior of the old-lub-glb-hr-noteq1.rs test. The old-lub-glb-hr-noteq2 test shows the current 'order dependent' behavior of coercions around higher-ranked functions, at least when running with `-Zborrowck=mir`. Also, run compare-mode=nll.
2020-06-22Point at the call spawn when overflow occurs during monomorphizationAaron Hill-57/+80
This improves the output for issue #72577, but there's still more work to be done. Currently, an overflow error during monomorphization results in an error that points at the function we were unable to monomorphize. However, we don't point at the call that caused the monomorphization to happen. In the overflow occurs in a large recursive function, it may be difficult to determine where the issue is. This commit tracks and `Span` information during collection of `MonoItem`s, which is used when emitting an overflow error. `MonoItem` itself is unchanged, so this only affects `src/librustc_mir/monomorphize/collector.rs`
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-205/+30
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-22Rollup merge of #73582 - RalfJung:miri-span-bug, r=oli-obkDylan DPC-28/+61
Miri: replace many bug! by span_bug! r? @oli-obk
2020-06-22make layout check a mere sanity checkRalf Jung-22/+13
2020-06-22expand a commentRalf Jung-1/+3
2020-06-22also use relator in interpreter assignment sanity checkRalf Jung-103/+109
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/+36
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-21Fix spurious 'value moved here in previous iteration of loop' messagesAaron Hill-1/+1
Fixes #46099 Previously, we would check the 'move' and 'use' spans to see if we should emit this message. However, this can give false positives when macros are involved, since two distinct expressions may end up with the same span. Instead, we check the actual MIR `Location`, which eliminates false positives.
2020-06-21fmtRalf Jung-10/+2
2020-06-21MIR validation: check switch_tyRalf Jung-1/+12
2020-06-21remove switch_ty reliance in codegenRalf Jung-2/+3
2020-06-21Update src/librustc_mir/monomorphize/collector.rs Youngsuk Kim-1/+1
typo fix Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-06-21Miri: replace many bug! by span_bug!Ralf Jung-28/+61
2020-06-21Make is_freeze and is_copy_modulo_regions take TyCtxtAtRalf Jung-15/+14
2020-06-21Auto merge of #71911 - wesleywiser:const_prop_small_cleanups, r=oli-obkbors-26/+21
[mir-opt] Small ConstProp cleanup
2020-06-20Fix typos in doc commentsYoungsuk Kim-3/+3
This commit fixes typos in the doc comments of 'librustc_mir/monomorphize/collector.rs'
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 #73442 - ↵Manish Goregaokar-9/+15
davidtwco:issue-72181-pretty-print-const-val-enum-no-variants, r=oli-obk pretty/mir: const value enums with no variants Fixes #72181. This PR modifies the pretty printer and const eval in the MIR so that `destructure_const` (used in `pretty_print_const_value`) can handle enums with no variants (or types containing enums with no variants). I'm not convinced that this is the correct approach, folks more familiar with `destructure_const` would be able to say - happy to adjust the PR. Looking through `destructure_const` and the functions that it invokes, it didn't seem like it was written to handle zero-variant-enums - I assume that case is handled earlier in some way so `destructure_const` doesn't need to under normal circumstances. It didn't seem like it would be straightforward to make `destructure_const` handle this case in a first-class-feeling way (e.g. adding a `Variants::None` variant), so this PR makes some minimal changes to avoid ICEs.
2020-06-19Rollup merge of #73359 - jonas-schievink:do-the-shimmy, r=matthewjasperManish Goregaokar-21/+53
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/+19
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-19pretty/mir: const value enums with no variantsDavid Wood-9/+15
This commit modifies the pretty printer and const eval in the MIR so that `destructure_const` (used in `pretty_print_const_value`) can handle enums with no variants (or types containing enums with no variants). Signed-off-by: David Wood <david@davidtw.co>
2020-06-19Rollup merge of #73136 - alexcrichton:thinlto-compiler-builtins, ↵Ralf Jung-8/+1
r=Mark-Simulacrum Change how compiler-builtins gets many CGUs This commit intends to fix an accidental regression from #70846. The goal of #70846 was to build compiler-builtins with a maximal number of CGUs to ensure that each module in the source corresponds to an object file. This high degree of control for compiler-builtins is desirable to ensure that there's at most one exported symbol per CGU, ideally enabling compiler-builtins to not conflict with the system libgcc as often. In #70846, however, only part of the compiler understands that compiler-builtins is built with many CGUs. The rest of the compiler thinks it's building with `sess.codegen_units()`. Notably the calculation of `sess.lto()` consults `sess.codegen_units()`, which when there's only one CGU it disables ThinLTO. This means that compiler-builtins is built without ThinLTO, which is quite harmful to performance! This is the root of the cause from #73135 where intrinsics were found to not be inlining trivial functions. The fix applied in this commit is to remove the special-casing of compiler-builtins in the compiler. Instead the build system is now responsible for special-casing compiler-builtins. It doesn't know exactly how many CGUs will be needed but it passes a large number that is assumed to be much greater than the number of source-level modules needed. After reading the various locations in the compiler source, this seemed like the best solution rather than adding more and more special casing in the compiler for compiler-builtins. Closes #73135
2020-06-19Rollup merge of #73011 - richkadel:llvm-count-from-mir-pass, r=tmandryRalf Jung-0/+99
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-14/+9
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