about summary refs log tree commit diff
path: root/compiler/rustc_mir/src
AgeCommit message (Collapse)AuthorLines
2021-01-18Fix ICE with `ReadPointerAsBytes` validation errorCamelid-1/+5
2021-01-18Combine instructions immediatelyTomasz Miąsko-147/+79
No functional changes intended
2021-01-18Remove disabled transformation from instcombineTomasz Miąsko-142/+3
2021-01-18Rollup merge of #81142 - wcampbell0x2a:replace-Some-with-is-some, ↵Ashley Mannix-1/+1
r=jonas-schievink Replace let Some(..) = with .is_some()
2021-01-18Rollup merge of #81121 - tmiasko:simplify-cfg-no-dbg, r=jonas-schievinkAshley Mannix-1/+1
Avoid logging the whole MIR body in SimplifyCfg
2021-01-18Rollup merge of #81116 - bugadani:body-span, r=wesleywiserAshley Mannix-1/+1
ConstProp: Copy body span instead of querying it
2021-01-18Only inherit const stability for methods of `impl const Trait` blocksoli-1/+1
2021-01-18Auto merge of #80865 - oliviacrain:proj_based, r=RalfJungbors-124/+103
Use PlaceRef projection abstractions more consistently in rustc_mir PlaceRef contains abstractions for dealing with the `projections` array. This PR uses these abstractions more consistently within the `rustc_mir` crate. See associated issue: rust-lang/rust#80647. r? `@RalfJung`
2021-01-17Replace let Some(..) = with .is_some()wcampbell-1/+1
Signed-off-by: wcampbell <wcampbell1995@gmail.com>
2021-01-18Visit only terminators when removing landing padsTomasz Miąsko-24/+9
No functional changes intended
2021-01-17Auto merge of #80679 - jackh726:predicate-kind-take2, r=lcnrbors-22/+22
Remove PredicateKind and instead only use Binder<PredicateAtom> Originally brought up in https://github.com/rust-lang/rust/pull/76814#discussion_r546858171 r? `@lcnr`
2021-01-17Fix `unused_unsafe` label with `unsafe_block_in_unsafe_fnLeSeulArtichaut-8/+9
2021-01-17Avoid logging the whole MIR body in SimplifyCfgTomasz Miąsko-1/+1
2021-01-17Copy body span instead of querying itDániel Buga-1/+1
2021-01-17Add regression testoli-5/+15
2021-01-17Remove an unnecessary field from a `NonConstOp`oli-3/+3
2021-01-17Rollup merge of #81084 - LingMan:map, r=oli-obkMara Bos-16/+12
Use Option::map instead of open-coding it r? ```@oli-obk``` ```@rustbot``` modify labels +C-cleanup +T-compiler
2021-01-17Rollup merge of #80635 - sexxi-goose:use-place-instead-of-symbol, ↵Mara Bos-4/+4
r=nikomatsakis` Improve diagnostics when closure doesn't meet trait bound Improves the diagnostics when closure doesn't meet trait bound by modifying `TypeckResuts::closure_kind_origins` such that `hir::Place` is used instead of `Symbol`. Using `hir::Place` to describe which capture influenced the decision of selecting a trait a closure satisfies to (Fn/FnMut/FnOnce, Copy) allows us to show precise path in the diagnostics when `capture_disjoint_field` feature is enabled. Closes rust-lang/project-rfc-2229/issues/21 r? ```@nikomatsakis```
2021-01-17Rollup merge of #79298 - lcnr:new-elysium, r=matthewjasperMara Bos-4/+4
correctly deal with late-bound lifetimes in anon consts adds support for using late bound lifetimes of the parent context in anon consts. ```rust #![feature(const_generics)] const fn inner<'a>() -> usize where &'a (): Sized { 3 } fn test<'a>() { let _: [u8; inner::<'a>()]; } ``` The lifetime `'a` is late bound in `test` so it's not included in its generics but is instead dealt with separately in borrowck. This didn't previously work for anon consts as they have to use the late bound lifetimes of their parent which has to be explicitly handled. r? ```@matthewjasper``` cc ```@varkor``` ```@eddyb```
2021-01-17Visit only terminators when removing unneeded dropsTomasz Miąsko-41/+20
No functional changes intended
2021-01-16Review changesJack Huey-22/+22
2021-01-16Auto merge of #81089 - m-ou-se:rollup-z7iac6i, r=m-ou-sebors-6/+18
Rollup of 17 pull requests Successful merges: - #78455 (Introduce {Ref, RefMut}::try_map for optional projections in RefCell) - #80144 (Remove giant badge in README) - #80614 (Explain why borrows can't be held across yield point in async blocks) - #80670 (TrustedRandomAaccess specialization composes incorrectly for nested iter::Zips) - #80681 (Clarify what the effects of a 'logic error' are) - #80764 (Re-stabilize Weak::as_ptr and friends for unsized T) - #80901 (Make `x.py --color always` apply to logging too) - #80902 (Add a regression test for #76281) - #80941 (Do not suggest invalid code in pattern with loop) - #80968 (Stabilize the poll_map feature) - #80971 (Put all feature gate tests under `feature-gates/`) - #81021 (Remove doctree::Import) - #81040 (doctest: Reset errors before dropping the parse session) - #81060 (Add a regression test for #50041) - #81065 (codegen_cranelift: Fix redundant semicolon warn) - #81069 (Add sample code for Rc::new_cyclic) - #81081 (Add test for #34792) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-01-16Use Option::map instead of open-coding itLingMan-16/+12
2021-01-16correctly deal with late-bound lifetimes in anon constsBastian Kauschke-4/+4
2021-01-16Rollup merge of #80941 - JohnTitor:ref-mut-pat-in-loops, r=varkorMara Bos-1/+4
Do not suggest invalid code in pattern with loop Fixes #80913
2021-01-16Rollup merge of #80614 - 1000teslas:issue-78938-fix, r=tmandryMara Bos-5/+14
Explain why borrows can't be held across yield point in async blocks For https://github.com/rust-lang/rust/issues/78938.
2021-01-16Auto merge of #80290 - RalfJung:less-intrinsic-write, r=lcnrbors-8/+0
implement ptr::write without dedicated intrinsic This makes `ptr::write` more consistent with `ptr::write_unaligned`, `ptr::read`, `ptr::read_unaligned`, all of which are implemented in terms of `copy_nonoverlapping`. This means we can also remove `move_val_init` implementations in codegen and Miri, and its special handling in the borrow checker. Also see [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/ptr.3A.3Aread.20vs.20ptr.3A.3Awrite).
2021-01-16Use PlaceRef more consistently in rustc_mirOlivia Crain-124/+103
2021-01-16PlaceRef::ty: use method call syntaxRalf Jung-6/+8
2021-01-16Update compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs1000teslas-3/+1
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-01-15Rollup merge of #80944 - LingMan:map_or, r=nagisaYuki Okushi-9/+7
Use Option::map_or instead of `.map(..).unwrap_or(..)` ``@rustbot`` modify labels +C-cleanup +T-compiler
2021-01-15inline: Round word-size cost estimates upTomasz Miąsko-1/+1
2021-01-14Use Option::map_or instead of `.map(..).unwrap_or(..)`LingMan-9/+7
2021-01-14Rollup merge of #80969 - camelid:monomorph-ice-msg, r=nagisaMara Bos-1/+1
Use better ICE message when no MIR is available The ICE message is somewhat confusing and overly specific - the issue is that there's no MIR available. This should make debugging these ICEs easier since the error tells you what's actually wrong, not what it was trying to do when it failed. cc https://github.com/rust-lang/rust/pull/80952#issuecomment-759198841 cc `````@jyn514`````
2021-01-13Use unsigned_abs throughout repositoryJacob Pratt-2/+2
2021-01-13Move help link to error index1000teslas-3/+1
2021-01-12Use better ICE message when no MIR is availableCamelid-1/+1
The ICE message is somewhat confusing and overly specific - the issue is that there's no MIR available. This should make debugging these ICEs easier since the error tells you what's actually wrong, not what it was trying to do when it failed. cc https://github.com/rust-lang/rust/pull/80952#issuecomment-759198841
2021-01-13Auto merge of #79322 - jyn514:refactor-impl, r=estebankbors-4/+4
Separate out a `hir::Impl` struct This makes it possible to pass the `Impl` directly to functions, instead of having to pass each of the many fields one at a time. It also simplifies matches in many cases. See `rustc_save_analysis::dump_visitor::process_impl` or `rustdoc::clean::clean_impl` for a good example of how this makes `impl`s easier to work with. r? `@petrochenkov` maybe?
2021-01-12Separate out a `hir::Impl` structJoshua Nelson-4/+4
This makes it possible to pass the `Impl` directly to functions, instead of having to pass each of the many fields one at a time. It also simplifies matches in many cases.
2021-01-12Auto merge of #78407 - oli-obk:ub_checkable_ctfe, r=RalfJung,pnkfelixbors-48/+189
Make CTFE able to check for UB... ... by not doing any optimizations on the `const fn` MIR used in CTFE. This means we duplicate all `const fn`'s MIR now, once for CTFE, once for runtime. This PR is for checking the perf effect, so we have some data when talking about https://github.com/rust-lang/const-eval/blob/master/rfcs/0000-const-ub.md To do this, we now have two queries for obtaining mir: `optimized_mir` and `mir_for_ctfe`. It is now illegal to invoke `optimized_mir` to obtain the MIR of a const/static item's initializer, an array length, an inline const expression or an enum discriminant initializer. For `const fn`, both `optimized_mir` and `mir_for_ctfe` work, the former returning the MIR that LLVM should use if the function is called at runtime. Similarly it is illegal to invoke `mir_for_ctfe` on regular functions. This is all checked via appropriate assertions and I don't think it is easy to get wrong, as there should be no `mir_for_ctfe` calls outside the const evaluator or metadata encoding. Almost all rustc devs should keep using `optimized_mir` (or `instance_mir` for that matter).
2021-01-12Coverage computation needs access to the MIR, toooli-6/+13
2021-01-12Auto merge of #80499 - matthiaskrgr:red_clos, r=estebankbors-6/+6
remove redundant closures (clippy::redundant_closure)
2021-01-12Do not suggest invalid code in pattern with loopYuki Okushi-1/+4
2021-01-12Rollup merge of #80324 - Aaron1011:loop-move-fn-self, r=oli-obkYuki Okushi-74/+68
Explain method-call move errors in loops PR #73708 added a more detailed explanation of move errors that occur due to a call to a method that takes `self`. This PR extends that logic to work when a move error occurs due to a method call in the previous iteration of a loop.
2021-01-11--emit=mir now emits both `mir_for_ctfe` and `optimized_mir` for `const fn`oli-11/+21
2021-01-10Add ABI argument to `find_mir_or_eval_fn`Nym Seddon-5/+14
Add ABI argument for called function in `find_mir_or_eval_fn` and `call_extra_fn`. Useful for comparing with expected ABI in interpreters. Related to [miri/1631](https://github.com/rust-lang/miri/issues/1631)
2021-01-10Remove trailing whitespace1000teslas-3/+5
2021-01-10Revise async block error message1000teslas-16/+15
2021-01-10Fix location of error message explanation1000teslas-10/+12
2021-01-10Explain why borrows can't be held across yield point in async blocks1000teslas-0/+10