about summary refs log tree commit diff
path: root/compiler/rustc_mir/src
AgeCommit message (Collapse)AuthorLines
2020-09-25Rename `DefPathData::get_name()` to `DefPathData::name()`marmeladema-1/+1
2020-09-25Implement `Display` for `DisambiguatedDefPathData` and `DefPathData`marmeladema-8/+2
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-3/+14
2020-09-25No need to call `is_min_const_fn` for side-effectsDylan MacKenzie-3/+0
2020-09-25Change error in `fn_queries` to `delay_span_bug`Dylan MacKenzie-1/+1
This should be caught by the new check in `rustc_passes`. At some point, this function will be removed entirely.
2020-09-25Auto merge of #77198 - jonas-schievink:rollup-i59i41h, r=jonas-schievinkbors-4/+10
Rollup of 15 pull requests Successful merges: - #76932 (Relax promises about condition variable.) - #76973 (Unstably allow assume intrinsic in const contexts) - #77005 (BtreeMap: refactoring around edges) - #77066 (Fix dest prop miscompilation around references) - #77073 (dead_code: look at trait impls even if they don't contain items) - #77086 (Include libunwind in the rust-src component.) - #77097 (Make [].as_[mut_]ptr_range() (unstably) const.) - #77106 (clarify that `changelog-seen = 1` goes to the beginning of config.toml) - #77120 (Add `--keep-stage-std` to `x.py` for keeping only standard library artifacts) - #77126 (Invalidate local LLVM cache less often) - #77146 (Install std for non-host targets) - #77155 (remove enum name from ImplSource variants) - #77176 (Removing erroneous semicolon in transmute documentation) - #77183 (Allow multiple allow_internal_unstable attributes) - #77189 (Remove extra space from vec drawing) Failed merges: r? `@ghost`
2020-09-25Rollup merge of #77155 - lcnr:ImplSource, r=ecstatic-morseJonas Schievink-1/+1
remove enum name from ImplSource variants This is quite a lot cleaner in my opinion.
2020-09-25Rollup merge of #77066 - jonas-schievink:dest-prop-borrow, r=oli-obkJonas Schievink-1/+1
Fix dest prop miscompilation around references Closes https://github.com/rust-lang/rust/issues/77002
2020-09-25Rollup merge of #76973 - lzutao:unstably-const-assume, r=oli-obkJonas Schievink-2/+8
Unstably allow assume intrinsic in const contexts Not sure much about this usage because there are concerns about [blocking optimization][1] and [slowing down LLVM][2] when using `assme` intrinsic in inline functions. But since Oli suggested in https://github.com/rust-lang/rust/issues/76960#issuecomment-695772221, here we are. [1]: https://github.com/rust-lang/rust/pull/54995#issuecomment-429302709 [2]: https://github.com/rust-lang/rust/issues/49572#issuecomment-589615423
2020-09-25Put floating point arithmetic behind its own feature gateDylan MacKenzie-9/+22
This refactors handling of `Rvalue::{Unary,Binary}Op` in the const-checker. Now we `span_bug` if there's an unexpected type in a primitive operation. This also allows unary negation on `char` values through the const-checker because it makes the code a bit cleaner. `char` does not actually support these operations, and if it did, we could evaluate them at compile-time.
2020-09-25Add `const_fn_floating_point_arithmetic`Dylan MacKenzie-0/+24
2020-09-25Auto merge of #77157 - tmiasko:simplify-cfg-dup, r=jonas-schievinkbors-1/+0
Remove duplicated SimplifyCfg pass
2020-09-25Auto merge of #76844 - simonvandel:fix-76803, r=wesleywiserbors-23/+34
Fix #76803 miscompilation Fixes #76803 Seems like it was an oversight that the discriminant value being set was not compared to the target value from the SwitchInt, as a comment says this is a requirement for the optimization to be sound. r? `@wesleywiser` since you are probably familiar with the optimization and made #76837 to workaround the bug
2020-09-25Rollup merge of #77165 - simonvandel:do-not-fire-on-drop-and-replace, r=oli-obkJonas Schievink-2/+1
Followup to #76673 Resolves https://github.com/rust-lang/rust/pull/76673#discussion_r494426303 r? @tmiasko
2020-09-25Rollup merge of #77160 - ecstatic-morse:const-fn-transmute-suggestion, r=oli-obkJonas Schievink-1/+8
Suggest `const_fn_transmute`, not `const_fn` More fallout from #76850 in the vein of #77134. The fix is the same. I looked through the structured errors file and didn't see any more of this kind of diagnostics bug. r? @oli-obk
2020-09-25Rollup merge of #77136 - ecstatic-morse:issue-77134, r=oli-obkJonas Schievink-1/+8
Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn` Resolves #77134. Prior to #76850, most uses of `&mut` in `const fn` ~~required~~ involved two feature gates, `const_mut_refs` and `const_fn`. The first allowed all mutable borrows of locals. The second allowed only locals, arguments and return values whose types contained `&mut`. I switched the second check to the `const_mut_refs` gate. However, I forgot update the error message with the new suggestion. Alternatively, we could revert to having two different feature gates for this. OP's code never borrows anything mutably, so it didn't need `const_mut_refs` in the past, only `const_fn`. I'd prefer to keep everything under a single gate, however. r? @oli-obk
2020-09-25Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnrJonas Schievink-4/+33
Allow a unique name to be assigned to dataflow graphviz output Previously, if the same analysis were invoked multiple times in a single compilation session, the graphviz output for later runs would overwrite that of previous runs. Allow callers to add a unique identifier to each run so this can be avoided.
2020-09-24nitBastian Kauschke-1/+0
2020-09-24the two hardest things in programming, names and...Bastian Kauschke-3/+3
2020-09-24Suggest `const_fn_transmute` instead of `const_fn`Dylan MacKenzie-1/+8
2020-09-24Resolve https://github.com/rust-lang/rust/pull/76673#discussion_r494426303Simon Vandel Sillesen-2/+1
2020-09-24remove enum name from ImplSource variantsBastian Kauschke-1/+1
2020-09-24use std::mem::take(x) instead of std::mem::replace(x, Default::default()) ↵Matthias Krüger-2/+1
(clippy::mem_replace_with_default)
2020-09-24EarlyOtherwiseBranch::run_pass(): don't convert Place to Place ↵Matthias Krüger-1/+1
(clippy::useless_conversion)
2020-09-24Auto merge of #76748 - tmiasko:no-op-jumps, r=matthewjasperbors-9/+10
Fix underflow when calculating the number of no-op jumps folded When removing unwinds to no-op blocks and folding jumps to no-op blocks, remove the unwind target first. Otherwise we cannot determine if target has been already folded or not. Previous implementation incorrectly assumed that all resume targets had been folded already, occasionally resulting in an underflow: ``` remove_noop_landing_pads: removed 18446744073709551613 jumps and 3 landing pads ```
2020-09-23Suggest `const_mut_refs` for mutable references in const fnDylan MacKenzie-1/+8
2020-09-24Remove duplicated SimplifyCfg passTomasz Miąsko-1/+0
2020-09-23Auto merge of #77102 - Dylan-DPC:rollup-2jfrg3u, r=Dylan-DPCbors-5/+9
Rollup of 9 pull requests Successful merges: - #76898 (Record `tcx.def_span` instead of `item.span` in crate metadata) - #76939 (emit errors during AbstractConst building) - #76965 (Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.) - #76993 (Changing the alloc() to accept &self instead of &mut self) - #76994 (fix small typo in docs and comments) - #77017 (Add missing examples on Vec iter types) - #77042 (Improve documentation for ToSocketAddrs) - #77047 (Miri: more informative deallocation error messages) - #77055 (Add #[track_caller] to more panicking Cell functions) Failed merges: r? `@ghost`
2020-09-23Auto merge of #76673 - simonvandel:remove-unneeded-drops, r=oli-obkbors-0/+61
MIR pass to remove unneeded drops on types not needing drop This is heavily dependent on MIR inlining running to actually see the drop statement. Do we want to special case replacing a call to std::mem::drop with a goto aswell?
2020-09-23Enable const prop into operands at mir_opt_level=2Dániel Buga-5/+5
2020-09-23Rollup merge of #77047 - RalfJung:miri-dealloc, r=oli-obkDylan DPC-4/+8
Miri: more informative deallocation error messages Make sure we show the affected AllocId. r? @oli-obk
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-23Auto merge of #76659 - simonvandel:76432, r=oli-obkbors-21/+22
SimplifyComparisonIntegral: fix miscompilation Fixes #76432 Only insert StorageDeads if we actually removed one. Fixes an issue where we added StorageDead to a place with no StorageLive r? `@oli-obk`
2020-09-23merge `need_type_info_err(_const)`Bastian Kauschke-3/+3
2020-09-22cleanup cfg after optimizationSimon Vandel Sillesen-0/+9
2020-09-22The optimization should also apply for DropAndReplaceSimon Vandel Sillesen-1/+2
2020-09-22Get LocalDefId from source instead of passing inSimon Vandel Sillesen-11/+3
2020-09-22Suggestion from reviewSimon Vandel Sillesen-1/+1
Co-authored-by: Andreas Jonson <andjo403@users.noreply.github.com>
2020-09-22MIR pass to remove unneeded drops on types not needing dropSimon Vandel Sillesen-0/+59
This is heavily dependent on MIR inlining running to actually see the drop statement
2020-09-22Fix dest prop miscompilation around referencesJonas Schievink-1/+1
2020-09-22Use correct feature gate for unsizing castsDylan MacKenzie-5/+1
2020-09-22Replace missing commentDylan MacKenzie-0/+2
2020-09-22Use the same name everywhere for `is_const_stable_const_fn`Dylan MacKenzie-2/+4
2020-09-22Update const-checker to replicate `qualify_min_const_fn`Dylan MacKenzie-73/+268
2020-09-22Add structured errors for `qualify_min_const_fn` checksDylan MacKenzie-3/+220
2020-09-22Allow errors to abort const checking when emittedDylan MacKenzie-4/+22
This is a hack for parity with `qualify_min_const_fn`, which only emitted a single error.
2020-09-22Return `true` if `check_const` emits an errorDylan MacKenzie-7/+11
2020-09-22Add const-stability helpersDylan MacKenzie-10/+45
2020-09-22Useful derives on `ops::Status`Dylan MacKenzie-0/+1
2020-09-22Miri: more informative deallocation error messagesRalf Jung-4/+8