summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2020-09-29Useful derives on `mir::LocalKind`Dylan MacKenzie-1/+1
2020-09-26Make invalid integer operation messages consistentvarkor-26/+30
2020-09-24Resolve https://github.com/rust-lang/rust/pull/76673#discussion_r494426303Simon Vandel Sillesen-0/+2
2020-09-24Auto merge of #77006 - oli-obk:🐌_const_queries, r=Mark-Simulacrumbors-1/+1
Cache `eval_to_allocation_raw` on disk https://github.com/rust-lang/rust/pull/74949#issuecomment-695833161 regressed the performance on these queries, this PR gets the perf back.
2020-09-23Rollup merge of #76994 - yuk1ty:fix-small-typo, r=estebankDylan DPC-1/+1
fix small typo in docs and comments Fixed `the the` to `the`, as far as I found.
2020-09-23Rollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obkDylan DPC-0/+6
emit errors during AbstractConst building There changes are currently still untested, so I don't expect this to pass CI :laughing: It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this. r? @oli-obk
2020-09-21reviewBastian Kauschke-0/+6
2020-09-21Cache `eval_to_allocation_raw` on diskOliver Scherer-1/+1
2020-09-21fix typo in docs and commentsyuk1ty-1/+1
2020-09-20Rollup merge of #76891 - lcnr:less-ref, r=ecstatic-morseRalf Jung-9/+9
don't take `TyCtxt` by reference small cleanup
2020-09-20Rollup merge of #76732 - camelid:mir-basic-block-docs, r=RalfJungRalf Jung-0/+20
Add docs for `BasicBlock` Fixes #76715. --- @rustbot modify labels: A-mir T-doc C-enhancement
2020-09-20Auto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJungbors-1/+1
Rollup of 15 pull requests Successful merges: - #76722 (Test and fix Send and Sync traits of BTreeMap artefacts) - #76766 (Extract some intrinsics out of rustc_codegen_llvm) - #76800 (Don't generate bootstrap usage unless it's needed) - #76809 (simplfy condition in ItemLowerer::with_trait_impl_ref()) - #76815 (Fix wording in mir doc) - #76818 (Don't compile regex at every function call.) - #76821 (Remove redundant nightly features) - #76823 (black_box: silence unused_mut warning when building with cfg(miri)) - #76825 (use `array_windows` instead of `windows` in the compiler) - #76827 (fix array_windows docs) - #76828 (use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)) - #76840 (Move to intra doc links in core/src/future) - #76845 (Use intra docs links in core::{ascii, option, str, pattern, hash::map}) - #76853 (Use intra-doc links in library/core/src/task/wake.rs) - #76871 (support panic=abort in Miri) Failed merges: r? `@ghost`
2020-09-20Rollup merge of #76815 - pickfire:patch-6, r=jonas-schievinkRalf Jung-1/+1
Fix wording in mir doc
2020-09-20Auto merge of #74949 - oli-obk:validate_const_eval_raw, r=RalfJungbors-17/+17
Validate constants during `const_eval_raw` This PR implements the groundwork for https://github.com/rust-lang/rust/issues/72396 * constants are now validated during `const_eval_raw` * to prevent cycle errors, we do not validate references to statics anymore beyond the fact that they are not dangling * the `const_eval` query ICEs if used on `static` items * as a side effect promoteds are now evaluated to `ConstValue::Scalar` again (since they are just a reference to the actual promoted allocation in most cases).
2020-09-19Rollup merge of #76636 - RalfJung:miri-size-assert, r=oli-obkRalf Jung-0/+3
assert ScalarMaybeUninit size I noticed most low-level Miri types have such an assert but `ScalarMaybeUninit` does not, so let's add that. Good t see that the `Option`-like optimization kicks in and this is no bigger than `Scalar`. :) r? @oli-obk
2020-09-19Reflect the "do not call this query directly" mentality in its nameOliver Scherer-2/+2
2020-09-19Address review commentsOliver Scherer-4/+4
2020-09-19Unify the names of const eval queries and their return typesOliver Scherer-14/+14
2020-09-19Rename const eval queries to reflect the validation changesOliver Scherer-3/+3
2020-09-18don't take `TyCtxt` by referenceBastian Kauschke-9/+9
2020-09-18support const_evaluatable_checked across crate boundariesBastian Kauschke-1/+1
2020-09-18use newtype_index for abstract_const::NodeIdBastian Kauschke-2/+7
2020-09-18initial working stateBastian Kauschke-0/+16
2020-09-17Use relative link instead of absoluteCamelid-1/+1
2020-09-17Fix wording in mir docIvan Tham-1/+1
2020-09-16Update based on review suggestionsCamelid-2/+6
2020-09-15Improve wordingCamelid-3/+3
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-14Clarify how branching works in a CFGCamelid-3/+5
2020-09-14Add docs for `BasicBlock`Camelid-0/+14
2020-09-14Minor improvements to `mir::Constant` docsCamelid-2/+2
2020-09-12also assert ScalarMaybeUninit sizeRalf Jung-0/+3
2020-09-10Auto merge of #75573 - Aaron1011:feature/const-mutation-lint, r=oli-obkbors-0/+2
Add CONST_ITEM_MUTATION lint Fixes #74053 Fixes #55721 This PR adds a new lint `CONST_ITEM_MUTATION`. Given an item `const FOO: SomeType = ..`, this lint fires on: * Attempting to write directly to a field (`FOO.field = some_val`) or array entry (`FOO.array_field[0] = val`) * Taking a mutable reference to the `const` item (`&mut FOO`), including through an autoderef `FOO.some_mut_self_method()` The lint message explains that since each use of a constant creates a new temporary, the original `const` item will not be modified.
2020-09-09Rollup merge of #76523 - tmiasko:non-use-context-coverage, r=wesleywiserTyler Mandry-2/+0
Remove unused PlaceContext::NonUse(NonUseContext::Coverage) r? @richkadel / @wesleywiser
2020-09-09Remove unused PlaceContext::NonUse(NonUseContext::Coverage)Tomasz Miąsko-2/+0
2020-09-08reviewBastian Kauschke-0/+4
2020-09-08make `ConstEvaluatable` more strictBastian Kauschke-4/+23
2020-09-07Add CONST_ITEM_MUTATION lintAaron Hill-0/+2
Fixes #74053 Fixes #55721 This PR adds a new lint `CONST_ITEM_MUTATION`. Given an item `const FOO: SomeType = ..`, this lint fires on: * Attempting to write directly to a field (`FOO.field = some_val`) or array entry (`FOO.array_field[0] = val`) * Taking a mutable reference to the `const` item (`&mut FOO`), including through an autoderef `FOO.some_mut_self_method()` The lint message explains that since each use of a constant creates a new temporary, the original `const` item will not be modified.
2020-09-06Add peephold optimization that simplifies Ne(_1, false) and Ne(false, _1) ↵Simon Vandel Sillesen-0/+9
into _1 This was observed emitted from the MatchBranchSimplification pass.
2020-09-05Rollup merge of #76254 - tmiasko:fold-len, r=wesleywiserDylan DPC-1/+1
Fold length constant in Rvalue::Repeat Fixes #76248.
2020-09-04Fix big endian read/writeJubilee Young-6/+12
Co-authored-by: matthewjasper <mjjasper1@gmail.com>
2020-09-04Explain contract of {read, write}_target_uintJubilee Young-0/+6
2020-09-04Be explicit that we're handling bytesJubilee-1/+1
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-09-04Remove reference to byteorder limitsJubilee Young-8/+4
2020-09-04Refactor byteorder to std in rustc_middleJubilee Young-7/+9
Use std::io::{Read, Write} and {to, from}_{le, be}_bytes methods in order to remove byteorder from librustc_middle's dependency graph.
2020-09-04Change ty.kind to a methodLeSeulArtichaut-3/+3
2020-09-04Auto merge of #76004 - richkadel:llvm-coverage-map-gen-6b.5, r=tmandrybors-1/+18
Tools, tests, and experimenting with MIR-derived coverage counters Leverages the new mir_dump output file in HTML+CSS (from #76074) to visualize coverage code regions and the MIR features that they came from (including overlapping spans). See example below. The `run-make-fulldeps/instrument-coverage` test has been refactored to maximize test coverage and reduce code duplication. The new tests support testing with and without `-Clink-dead-code`, so Rust coverage can be tested on MSVC (which, currently, only works with `link-dead-code` _disabled_). New tests validate coverage region generation and coverage reports with multiple counters per function. Starting with a simple `if-else` branch tests, coverage tests for each additional syntax type can be added by simply dropping in a new Rust sample program. Includes a basic, MIR-block-based implementation of coverage injection, available via `-Zexperimental-coverage`. This implementation has known flaws and omissions, but is simple enough to validate the new tools and tests. The existing `-Zinstrument-coverage` option currently enables function-level coverage only, which at least appears to generate accurate coverage reports at that level. Experimental coverage is not accurate at this time. When branch coverage works as intended, the `-Zexperimental-coverage` option should be removed. This PR replaces the bulk of PR #75828, with the remaining parts of that PR distributed among other separate and indentpent PRs. This PR depends on two of those other PRs: #76002, #76003 and #76074 Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation ![Screen-Recording-2020-08-21-at-2](https://user-images.githubusercontent.com/3827298/90972923-ff417880-e4d1-11ea-92bb-8713c6198f6d.gif) r? @tmandry FYI: @wesleywiser
2020-09-03Tools, tests, and experimenting with MIR-derived coverage countersRich Kadel-1/+18
Adds a new mir_dump output file in HTML/CSS to visualize code regions and the MIR features that they came from (including overlapping spans). See example below: Includes a basic, MIR-block-based implementation of coverage injection, available via `-Zexperimental-coverage`. This implementation has known flaws and omissions, but is simple enough to validate the new tools and tests. The existing `-Zinstrument-coverage` option currently enables function-level coverage only, which at least appears to generate accurate coverage reports at that level. Experimental coverage is not accurate at this time. When branch coverage works as intended, the `-Zexperimental-coverage` option should be removed. This PR replaces the bulk of PR #75828, with the remaining parts of that PR distributed among other separate and indentpent PRs. This PR depends on three of those other PRs: #76000, #76002, and Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation ![Screen-Recording-2020-08-21-at-2](https://user-images.githubusercontent.com/3827298/90972923-ff417880-e4d1-11ea-92bb-8713c6198f6d.gif)
2020-09-02pretty: trim paths of unique symbolsDan Aloni-1/+2
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-09-02Fold length constant in Rvalue::RepeatTomasz Miąsko-1/+1
2020-08-31Rollup merge of #76002 - richkadel:llvm-coverage-map-gen-6b.3, r=tmandryTyler Mandry-1/+1
Fix `-Z instrument-coverage` on MSVC Found that `-C link-dead-code` (which was enabled automatically under `-Z instrument-coverage`) was causing the linking error that resulted in segmentation faults in coverage instrumented binaries. Link dead code is now disabled under MSVC, allowing `-Z instrument-coverage` to be enabled under MSVC for the first time. More details are included in Issue #76038 . Note this PR makes it possible to support `Z instrument-coverage` but does not enable instrument coverage for MSVC in existing tests. It will be enabled in another PR to follow this one (both PRs coming from original PR #75828). r? @tmandry FYI: @wesleywiser