about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2020-11-04Move ZST constant to the top of the impl blockoli-2/+2
2020-11-04Do not raise interp errors from the scalar int moduleoli-2/+8
2020-11-04Add helper for getting an `int` out of a `Scalar`oli-0/+8
2020-11-04Replace `Scalar::zst` with a `Scalar::ZST` constantoli-4/+1
2020-11-04No need for a `zst` constructor method when we can have a constantoli-1/+1
2020-11-04s/Scalar::Raw/Scalar::Intoli-23/+23
2020-11-04Split the "raw integer bytes" part out of `Scalar`Oliver Scherer-91/+25
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-12/+12
2020-10-30Use `ControlFlow::is{break,continue}`LeSeulArtichaut-1/+1
2020-10-30TypeVisitor: use `std::ops::ControlFlow` instead of `bool`LeSeulArtichaut-43/+64
2020-10-28Rollup merge of #78351 - RalfJung:validity-unsafe-cell, r=oli-obkDylan DPC-12/+0
Move "mutable thing in const" check from interning to validity This moves the check for mutable things (such as `UnsafeCell` or `&mut`) in a`const` from interning to validity. That means we can give more targeted error messages (pointing out *where* the problem lies), and we can simplify interning a bit. Also fix the interning mode used for promoteds in statics. r? @oli-obk
2020-10-26Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obkbors-7/+49
rustc_mir: track inlined callees in SourceScopeData. We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates. This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default. Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).` Fixes #76997. r? `@rust-lang/wg-mir-opt`
2020-10-26interning cleanup: we no longer need to distinguish Const and ConstInner; we ↵Ralf Jung-12/+0
no longer need the ignore_interior_mut_in_const hack
2020-10-21Lift: take self by valueBastian Kauschke-4/+4
2020-10-21Rollup merge of #78101 - RalfJung:foreign-static, r=oli-obkYuki Okushi-8/+9
fix static_ptr_ty for foreign statics Cc https://github.com/rust-lang/rust/issues/74840 This does not fix that issue but fixes a problem in `static_ptr_ty` that we noticed while discussing that issue. I also added and updated a few comments. The one about `internal` locals being ignored does not seem to have been true [even in the commit that introduced it](https://github.com/rust-lang/rust/pull/44700/files#diff-ae2f3c7e2f9744f7ef43e96072b10e98d4e3fe74a3a399a3ad8a810fbe56c520R139). r? @oli-obk
2020-10-21rustc_mir: support MIR-inlining #[track_caller] functions.Eduard-Mihai Burtescu-0/+9
2020-10-21rustc_mir: track inlined callees in SourceScopeData.Eduard-Mihai Burtescu-7/+40
2020-10-19fix Rvalue::ty for ThreadLocalRefRalf Jung-5/+9
2020-10-19remove what seems to be an outdated commentRalf Jung-3/+0
Even in the PR that introduced this comment, it does not seem like these locals are actually ignored -- just their `source_info` is adjusted: https://github.com/rust-lang/rust/pull/44700/files#diff-ae2f3c7e2f9744f7ef43e96072b10e98d4e3fe74a3a399a3ad8a810fbe56c520R139
2020-10-18Move orphan module-name/mod.rs files into module-name.rs filesest31-0/+0
2020-10-17Note that `BasicBlock` is just an indexCamelid-1/+4
2020-10-14Remove unused code from rustc_middleest31-86/+1
2020-10-13Replace absolute paths with relative onesest31-4/+4
Modern compilers allow reaching external crates like std or core via relative paths in modules outside of lib.rs and main.rs.
2020-10-13Auto merge of #77796 - jonas-schievink:switchint-refactor, r=oli-obkbors-27/+90
Refactor how SwitchInt stores jump targets Closes https://github.com/rust-lang/rust/issues/65693
2020-10-13Rollup merge of #77550 - lcnr:ty-dep-path-ct-cleanup, r=ecstatic-morseYuki Okushi-2/+34
add shims for WithOptConstParam query calls r? @ecstatic-morse @eddyb
2020-10-11Use SmallVec in SwitchTargetsJonas Schievink-9/+10
This allows building common SwitchTargets (eg. for `if`s) without allocation.
2020-10-10Refactor how SwitchInt stores jump targetsJonas Schievink-27/+89
2020-10-08Suggest removing &mut from borrow of &mutLzu Tao-1/+1
Fix a typo: minding -> binding Add test for &mut &mut
2020-10-06Rollup merge of #76995 - LingMan:middle_matches, r=varkorYuki Okushi-95/+59
Reduce boilerplate with the matches! macro Replaces simple bool `match`es of the form match $expr { $pattern => true _ => false } and their inverse with invocations of the matches! macro. Limited to rustc_middle for now to get my feet wet.
2020-10-05Updates to experimental coverage counter injectionRich Kadel-1/+20
This is a combination of 18 commits. Commit #2: Additional examples and some small improvements. Commit #3: fixed mir-opt non-mir extensions and spanview title elements Corrected a fairly recent assumption in runtest.rs that all MIR dump files end in .mir. (It was appending .mir to the graphviz .dot and spanview .html file names when generating blessed output files. That also left outdated files in the baseline alongside the files with the incorrect names, which I've now removed.) Updated spanview HTML title elements to match their content, replacing a hardcoded and incorrect name that was left in accidentally when originally submitted. Commit #4: added more test examples also improved Makefiles with support for non-zero exit status and to force validation of tests unless a specific test overrides it with a specific comment. Commit #5: Fixed rare issues after testing on real-world crate Commit #6: Addressed PR feedback, and removed temporary -Zexperimental-coverage -Zinstrument-coverage once again supports the latest capabilities of LLVM instrprof coverage instrumentation. Also fixed a bug in spanview. Commit #7: Fix closure handling, add tests for closures and inner items And cleaned up other tests for consistency, and to make it more clear where spans start/end by breaking up lines. Commit #8: renamed "typical" test results "expected" Now that the `llvm-cov show` tests are improved to normally expect matching actuals, and to allow individual tests to override that expectation. Commit #9: test coverage of inline generic struct function Commit #10: Addressed review feedback * Removed unnecessary Unreachable filter. * Replaced a match wildcard with remining variants. * Added more comments to help clarify the role of successors() in the CFG traversal Commit #11: refactoring based on feedback * refactored `fn coverage_spans()`. * changed the way I expand an empty coverage span to improve performance * fixed a typo that I had accidently left in, in visit.rs Commit #12: Optimized use of SourceMap and SourceFile Commit #13: Fixed a regression, and synched with upstream Some generated test file names changed due to some new change upstream. Commit #14: Stripping out crate disambiguators from demangled names These can vary depending on the test platform. Commit #15: Ignore llvm-cov show diff on test with generics, expand IO error message Tests with generics produce llvm-cov show results with demangled names that can include an unstable "crate disambiguator" (hex value). The value changes when run in the Rust CI Windows environment. I added a sed filter to strip them out (in a prior commit), but sed also appears to fail in the same environment. Until I can figure out a workaround, I'm just going to ignore this specific test result. I added a FIXME to follow up later, but it's not that critical. I also saw an error with Windows GNU, but the IO error did not specify a path for the directory or file that triggered the error. I updated the error messages to provide more info for next, time but also noticed some other tests with similar steps did not fail. Looks spurious. Commit #16: Modify rust-demangler to strip disambiguators by default Commit #17: Remove std::process::exit from coverage tests Due to Issue #77553, programs that call std::process::exit() do not generate coverage results on Windows MSVC. Commit #18: fix: test file paths exceeding Windows max path len
2020-10-05query_name_of_opt_const_arg -> query_name_opt_const_argBastian Kauschke-3/+3
2020-10-04cleanup WithOptConstParam queriesBastian Kauschke-1/+33
2020-10-04Remember the `MirSource` for each `Body`Dylan MacKenzie-1/+6
2020-10-04Move `MirSource` to `rustc_middle`Dylan MacKenzie-0/+32
2020-10-04Miscellaneous import formattingDylan MacKenzie-5/+4
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-21Reduce boilerplate with the matches! macroLingMan-95/+59
Replaces simple bool `match`es of the form match $expr { $pattern => true _ => false } and their inverse with invocations of the matches! macro.
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).