about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-05-25Auto merge of #97345 - lcnr:fast_reject, r=nnethercotebors-0/+221
add a deep fast_reject routine continues the work on #97136. r? `@nnethercote` Actually agree with you on the match structure :laughing: let's see how that impacted perf :sweat_smile:
2022-05-25try to cache region_scope_tree as a queryDing Xiang Fei-8/+7
2022-05-25add a deep fast_reject routinelcnr-0/+221
2022-05-24Add dead store elimination passJakob Degen-0/+17
2022-05-24Make Lazy not care about lifetimes until decodeMichael Goulet-0/+122
2022-05-24Add the transmute and asm checks to typeck as deferred checksOli Scherer-7/+0
2022-05-24Remove the check_mod_intrinsics queryOli Scherer-4/+0
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-41/+33
2022-05-23Fix precise field capture of univariant enumsTomasz Miąsko-2/+4
When constructing a MIR from a THIR field expression, introduce an additional downcast projection before accessing a field of an enum. When rebasing a place builder on top of a captured place, account for the fact that a single HIR enum field projection corresponds to two MIR projection elements: a downcast element and a field element.
2022-05-23Rollup merge of #97292 - compiler-errors:tcxify-rustc, r=davidtwcoDylan DPC-36/+41
Lifetime variance fixes for rustc #97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime. This is doable, since many lifetimes are already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`. Split out from #97287 so the compiler team can review independently.
2022-05-22Lifetime variance fixes for rustcMichael Goulet-36/+41
2022-05-22Do leak check after function ptr coercionJack Huey-5/+4
2022-05-22Auto merge of #95563 - dingxiangfei2009:dxf-rfc66-refactor, r=nikomatsakisbors-53/+108
Move the extended lifetime resolution into typeck context Related to #15023 This PR is based on the [idea](https://github.com/rust-lang/rust/issues/15023#issuecomment-1070931433) of #15023 by `@nikomatsakis.` This PR specifically proposes to - Delay the resolution of scopes of rvalues to a later stage, so that enough type information is available to refine those scopes based on relationships of lifetimes. - Highlight relevant parts that would help future reviews on the next installments of works to fully implement a solution to RFC 66.
2022-05-22factor out the rvalue lifetime ruleDing Xiang Fei-53/+108
remove region_scope_tree from RegionCtxt Apply suggestions from code review Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2022-05-22Auto merge of #97177 - oli-obk:const-stability, r=davidtwcobors-1/+16
Implement proper stability check for const impl Trait, fall back to unstable const when undeclared Continuation of #93960 `@jhpratt` it looks to me like the test was simply not testing for the failure you were looking for? Your checks actually do the right thing for const traits?
2022-05-22Rollup merge of #97259 - jyn514:fix-typo, r=JohnTitorYuki Okushi-1/+1
Fix typo in Mir phase docs
2022-05-21Auto merge of #96515 - lcnr:user-types-in-pat, r=nikomatsakisbors-43/+12
correctly deal with user type ascriptions in pat supersedes #93856 `thir::PatKind::AscribeUserType` previously resulted in `CanonicalUserTypeAnnotations` where the inferred type already had a subtyping relation according to `variance` to the `user_ty`. The bug can pretty much be summarized as follows: - during mir building - `user_ty -> inferred_ty`: considers variance - `StatementKind::AscribeUserType`: `inferred_ty` is the type of the place, so no variance needed - during mir borrowck - `user_ty -> inferred_ty`: does not consider variance - `StatementKind::AscribeUserType`: applies variance This mostly worked fine. The lifetimes in `inferred_ty` were only bound by its relation to `user_ty` and to the `place` of `StatementKind::AscribeUserType`, so it doesn't matter where exactly the subtyping happens. It does however matter when having higher ranked subtying. At this point the place where the subtyping happens is forced, causing this mismatch between building and borrowck to result in unintended errors. cc #96514 which is pretty much the same issue r? `@nikomatsakis`
2022-05-21Fix typo in Mir phase docsJoshua Nelson-1/+1
2022-05-21Auto merge of #97239 - jhpratt:remove-crate-vis, r=joshtriplettbors-9/+11
Remove `crate` visibility modifier FCP to remove this syntax is just about complete in #53120. Once it completes, this should be merged ASAP to avoid merge conflicts. The first two commits remove usage of the feature in this repository, while the last removes the feature itself.
2022-05-21update mir user type printing and apparently fix an ICElcnr-2/+3
2022-05-21correctly deal with user type ascriptions in patlcnr-41/+9
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-9/+11
2022-05-20Auto merge of #95418 - cjgillot:more-disk, r=davidtwcobors-39/+71
Cache more queries on disk One of the principles of incremental compilation is to allow saving results on disk to avoid recomputing them. This PR investigates persisting a lot of queries whose result are to be saved into metadata. Some of the queries are cheap reads from HIR, but we may also want to get rid of these reads for incremental lowering.
2022-05-20Auto merge of #97211 - GuillaumeGomez:rollup-jul7x7e, r=GuillaumeGomezbors-4/+7
Rollup of 6 pull requests Successful merges: - #96565 (rustdoc: show implementations on `#[fundamental]` wrappers) - #97179 (Add new lint to enforce whitespace after keywords) - #97185 (interpret/validity: separately control checking numbers for being init and non-ptr) - #97188 (Remove unneeded null pointer asserts in ptr2int casts) - #97189 (Update .mailmap) - #97192 (Say "last" instead of "rightmost" in the documentation for `std::str:rfind`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-20Rollup merge of #97185 - RalfJung:number-validity, r=oli-obkGuillaume Gomez-4/+7
interpret/validity: separately control checking numbers for being init and non-ptr This lets Miri control this in a more fine-grained way. r? `@oli-obk`
2022-05-20`bool` to custom enumlcnr-9/+14
2022-05-20move unique param check into `rustc_middle`lcnr-32/+87
2022-05-19interpret/validity: separately control checking numbers for being init and ↵Ralf Jung-4/+7
non-ptr
2022-05-19Auto merge of #97024 - lcnr:simplify_type-sus, r=<try>bors-65/+48
`simplify_type` improvements and cursed docs the existing `TreatParams` enum pretty much mixes everything up. Not sure why this looked right to me in #94057 This also includes two changes which impact perf: - `ty::Projection` with inference vars shouldn't be treated as a rigid type, even if fully normalized - `ty::Placeholder` only unifies with itself, so actually return `Some` for them r? `@nikomatsakis`
2022-05-19Proper const stability check, default to unstableJacob Pratt-0/+15
Rather than deferring to const eval for checking if a trait is const, we now check up-front. This allows the error to be emitted earlier, notably at the same time as other stability checks. Also included in this commit is a change of the default const stability level to UNstable. Previously, an item that was `const` but did not explicitly state it was unstable was implicitly stable.
2022-05-19Add and use stability helper methodsJacob Pratt-1/+1
This avoids an ambiguity (when reading) where `.level.is_stable()` is not immediately clear whether it is general stability or const stability.
2022-05-18Auto merge of #97019 - b-naber:transition-to-valtrees-pt1, r=oli-obkbors-27/+119
Transition to valtrees pt1 Compartmentalising https://github.com/rust-lang/rust/pull/96591 as much as possible. r? `@oli-obk`
2022-05-18fix `simplify_type`lcnr-65/+48
2022-05-18Rollup merge of #95979 - lcnr:coherence-docs, r=compiler-errorsDylan DPC-0/+3
update coherence docs, fix generator + opaque type ICE the world is confusing, this makes it slightly less so
2022-05-17Auto merge of #96959 - nbdd0121:unwind, r=Amanieubors-0/+8
Prevent unwinding when `-C panic=abort` is used regardless declared ABI Ensures that Rust code will abort with `-C panic=abort` regardless ABI used. ```rust extern "C-unwind" { fn may_unwind(); } // Will be nounwind with `-C panic=abort`, despite `C-unwind` ABI. pub unsafe extern "C-unwind" fn rust_item_that_can_unwind() { may_unwind(); } ``` Current behaviour is that unwind will propagate through. While the current behaviour won't cause unsoundness it is inconsistent with the text reading of [RFC2945](https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html). I tweaked `fn_can_unwind` instead of tweaking `AbortUnwindingCalls` because this approach would allow Rust (non-direct) callers to also see that this function is nounwind, so it can prevent excessive landing pads generation. For more discussions: https://rust-lang.zulipchat.com/#narrow/stream/210922-project-ffi-unwind/topic/soundness.20in.20mixed.20panic.20mode. cc `@alexcrichton,` `@BatmanAoD` r? `@Amanieu` `@rustbot` label: T-compiler T-lang F-c_unwind
2022-05-17Auto merge of #97111 - JohnTitor:rollup-x3vjf6u, r=JohnTitorbors-35/+34
Rollup of 7 pull requests Successful merges: - #96329 (Add a couple tests for #90887 fixes) - #97009 (Allow `unused_macro_rules` in path tests) - #97075 (Add regression test for #81804) - #97079 (Change `Successors` to `impl Iterator<Item = BasicBlock>`) - #97080 (remove the `RelateResultCompare` trait) - #97093 (Migrate `maybe_recover_from_bad_type_plus` diagnostic) - #97102 (Update function pointer call error message) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-17Rollup merge of #97079 - SparrowLii:successors, r=lcnrYuki Okushi-35/+34
Change `Successors` to `impl Iterator<Item = BasicBlock>` This PR fixes the FIXME in `compiler\rustc_middle\src\mir\mod.rs`. This can omit several `&`, `*` or `cloned` operations on Successros' generated elements
2022-05-17Auto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwcobors-1/+13
Add a query for checking whether a function is an intrinsic. work towards #93145 This will reduce churn when we add more ways to declare intrinsics r? `@scottmcm`
2022-05-17Auto merge of #96825 - kckeiks:remove-item-like-visitor-trait, r=cjgillotbors-14/+20
Retire `ItemLikeVisitor` trait Issue #95004 cc `@cjgillot`
2022-05-17Auto merge of #96892 - oli-obk:🐌_obligation_cause_code_🐌, r=estebankbors-35/+75
Clean up derived obligation creation r? `@estebank` working on fixing the perf regression from https://github.com/rust-lang/rust/pull/91030#issuecomment-1083360210
2022-05-17Change `Successors` to `impl Iterator<Item = BasicBlock>`SparrowLii-35/+34
2022-05-16use GlobalId in eval_to_valtree query and introduce query for ↵b-naber-27/+119
valtree_to_const_val
2022-05-16Force inline InternedObligationCauseCode creationOli Scherer-4/+4
2022-05-16Add a query for checking whether a function is an intrinsic.Oli Scherer-1/+13
2022-05-14Auto merge of #96883 - jackh726:early-binder-2, r=oli-obkbors-38/+174
Add EarlyBinder Chalk has no concept of `Param` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L579) or `ReEarlyBound` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L1308). Everything is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk. Either way, tracking when we have or haven't already substituted out these in rustc can be helpful. As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted. r? `@nikomatsakis`
2022-05-14use opt_item_name to pattern match items with namesMiguel Guarniz-1/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-14Add rustc_on_unimplemented to SubstJack Huey-0/+1
2022-05-14Add bound_explicit_item_bounds and bound_item_boundsJack Huey-6/+42
2022-05-14Auto merge of #95826 - carbotaniuman:miri-permissive-provenance, r=RalfJungbors-5/+8
Initial work on Miri permissive-exposed-provenance Rustc portion of the changes for portions of a permissive ptr-to-int model for Miri. The main changes here are changing `ptr_get_alloc` and `get_alloc_id` to return an Option, and also making ptr-to-int casts have an expose side effect.
2022-05-13Add bound_impl_trait_refJack Huey-4/+8