about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2025-09-18Rollup merge of #146566 - cjgillot:mir-overlap-lint, r=saethlinStuart Cook-0/+17
Lint more overlapping assignments in MIR. In an effort to make bugs like https://github.com/rust-lang/rust/issues/146383 more easily discovered, this PR extends the "overlapping assignment" MIR lint. I had to whitelist some rvalues, as they are actually allowed to alias, like `a = a + 1`.
2025-09-17Remove ImplSubjectCameron Steffen-38/+1
2025-09-17Lint overlapping assignments in MIR.Camille Gillot-0/+17
2025-09-17Rollup merge of #146647 - jdonszelmann:move-coherence-is-core, r=urgauJana Dönszelmann-1/+1
Move `#[rustc_coherence_is_core]` to the `crate_level` file I implemented this one without realizing it already was since it was (in my opinion) in the wrong file and implemented in a batch of all non-crate-level attributes. This commit just cleans it up slightly and moves it. Should be trivial r? `@oli-obk`
2025-09-17port `#[rustc_coherence_is_core]` to the new attribute parsing infrastructureJana Dönszelmann-1/+1
2025-09-17Auto merge of #146331 - RalfJung:copy-prov-repeat, r=oli-obkbors-60/+60
interpret: copy_provenance: avoid large intermediate buffer for large repeat counts Copying provenance worked in this odd way where the "preparation" phase (which is supposed to just extract the necessary information from the source range) already did all the work of repeating the result N times for the target range. This was needed to use the existing `insert_presorted` function on `SortedMap`. This PR generalizes `insert_presorted` so that we can avoid this odd structure on copy-provenance, and maybe even improve performance.
2025-09-17Rollup merge of #146564 - cjgillot:mir-nolen, r=scottmcmStuart Cook-21/+0
Remove Rvalue::Len again. Now that we have `RawPtrKind::FakeForPtrMetadata`, we can reimplement `Rvalue::Len` using `PtrMetadata(&raw const (fake) place)`. r? ``@scottmcm``
2025-09-17Rollup merge of #146552 - cjgillot:resume-noremap, r=jackh726Stuart Cook-2/+2
StateTransform: Do not renumber resume local. MIR parameters are not explicitly assigned-to when entering the MIR body. If we want to save their values inside the coroutine state, we need to do so explicitly. This was done by renaming the `_2` local, and introducing an explicit assignment pre-transform. This particular trick confuses me. This version makes explicit that we are assigning parameters to saved locals. r? ``@dingxiangfei2009``
2025-09-17Rollup merge of #145660 - jbatez:darwin_objc, r=jdonszelmann,madsmtm,tmandryStuart Cook-0/+6
initial implementation of the darwin_objc unstable feature Tracking issue: https://github.com/rust-lang/rust/issues/145496 This feature makes it possible to reference Objective-C classes and selectors using the same ABI used by native Objective-C on Apple/Darwin platforms. Without it, Rust code interacting with Objective-C must resort to loading classes and selectors using costly string-based lookups at runtime. With it, these references can be loaded efficiently at dynamic load time. r? ```@tmandry``` try-job: `*apple*` try-job: `x86_64-gnu-nopt`
2025-09-17Rollup merge of #145181 - Borgerr:remove-fixme-from-has-sigdrop, r=lcnrStuart Cook-8/+1
remove FIXME block from `has_significant_drop`, it never encounters inference variables The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference. https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389 Closes rust-lang/rust#86868 (other places mentioned in the issue have been resolved, or moved to other issues) r? types
2025-09-17Remove `DynKind`León Orell Valerian Liehr-25/+19
2025-09-16Add test.Camille Gillot-2/+2
2025-09-16Remove Rvalue::Len.Camille Gillot-21/+0
2025-09-16Add span for struct tail recursion limit errorTawan Muadmuenwai-5/+19
2025-09-16Rollup merge of #146402 - RalfJung:aggregate-init, r=saethlinStuart Cook-3/+5
interpret: fix overlapping aggregate initialization This fixes the problem pointed out by ````@saethlin```` in https://github.com/rust-lang/rust/issues/146383#issuecomment-3273224645. Also clarify when exactly current de-facto MIR semantics allow overlap of the LHS and RHS in an assignment.
2025-09-15remove FIXME from `has_significant_drop`, replaced with checking ↵ash-8/+1
non_region_infer
2025-09-13initial implementation of the darwin_objc unstable featureJo Bates-0/+6
2025-09-12Don't store defaultness for inherent impl itemsCameron Steffen-1/+5
2025-09-12Split AssocContainer::{InherentImpl,TraitImpl}Cameron Steffen-47/+59
2025-09-12Introduce hir::ImplItemImplKindCameron Steffen-16/+10
2025-09-12Rename AssocItemContainer -> AssocContainerCameron Steffen-13/+13
2025-09-12Introduce trait_item_ofCameron Steffen-0/+9
2025-09-12Auto merge of #146329 - lcnr:opaque-type-infer-alias-candidates, r=BoxyUwUbors-1/+5
consider item bounds for non-yet-defined opaque types Based on rust-lang/rust#140405. fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/182 fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/196 fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/205 there's some jank here, see https://github.com/rust-lang/trait-system-refactor-initiative/issues/229 ## Design If the self type is an inference variable which has been sub-unified with am opaque type, we need to incompletely guide inference to avoid breakage. In this case, we - look at the item bounds of all sub-unified opaque types, and - blanket impls which do not constrain the self type Even if there are applicable candidates, we always force their certainty to be `Maybe`, so they will always have to be reproven once we've constrained the inference variable. This is a bit iffy, see the added tests. r? `@BoxyUwU`
2025-09-12Auto merge of #146328 - zetanumbers:fix-141951, r=lcnrbors-4/+1
Skip typeck for items w/o their own typeck context Skip items which forward typeck to their ancestor. Should remove some potential but unnecessary typeck query waits, hence might improve performance for the parallel frontend. Thanks to `@ywxt` for a fix suggestion Fixes rust-lang/rust#141951
2025-09-11incompletely prefer opaque type bounds when self type bottoms out in inferMichael Goulet-1/+5
2025-09-11c-variadic: allow trait methods to be c-variadicFolkert de Vries-0/+6
but a C-variadic method makes a trait dyn-incompatible. That is because methods from dyn traits, when cast to a function pointer, create a shim. That shim can't really forward the c-variadic arguments.
2025-09-10clarify current MIR semantics re: overlapping assignmentRalf Jung-3/+5
and double-check that we match it in codegen
2025-09-10Rollup merge of #146391 - beepster4096:trimnt, r=saethlinMatthias Krüger-5/+7
Trim paths less in MIR dumping With this PR, the paths MIR dump filters and that are printed at the start of a dump file are no longer trimmed. They don't include the crate that is being compiled, however.
2025-09-10Rollup merge of #146178 - folkertdev:static-align, ↵Matthias Krüger-1/+10
r=jdonszelmann,ralfjung,traviscross Implement `#[rustc_align_static(N)]` on `static`s Tracking issue: https://github.com/rust-lang/rust/issues/146177 ```rust #![feature(static_align)] #[rustc_align_static(64)] static SO_ALIGNED: u64 = 0; ``` We need a different attribute than `rustc_align` because unstable attributes are tied to their feature (we can't have two unstable features use the same unstable attribute). Otherwise this uses all of the same infrastructure as `#[rustc_align]`. r? `@traviscross`
2025-09-10avoid calling insert_presorted more than onceRalf Jung-10/+16
2025-09-10interpret: copy_provenance: avoid large intermediate buffer for large repeat ↵Ralf Jung-60/+54
counts
2025-09-09don't trim paths in mir dumping when filtering and at the top of the filebeepster4096-5/+7
2025-09-09allow `#[rustc_align_static(N)]` on `static`sFolkert de Vries-1/+10
We need a different attribute than `rustc_align` because unstable attributes are tied to their feature (we can't have two unstable features use the same unstable attribute). Otherwise this uses all of the same infrastructure as `#[rustc_align]`.
2025-09-09Auto merge of #145717 - BoxyUwU:erase_regions_rename, r=lcnrbors-35/+41
rename erase_regions to erase_and_anonymize_regions I find it consistently confusing that `erase_regions` does more than replacing regions with `'erased`. it also makes some code look real goofy to be writing manual folders to erase regions with a comment saying "we cant use erase regions" :> or code that re-calls erase_regions on types with regions already erased just to anonymize all the bound regions. r? lcnr idk how i feel about the name being almost twice as long now
2025-09-09Driveby fixesBoxy-3/+2
2025-09-09erase_regions to erase_and_anonymize_regionsBoxy-34/+41
2025-09-09Rollup merge of #146324 - RalfJung:no-ptr-fragment, r=oli-obkStuart Cook-2/+19
const-eval: disable pointer fragment support This fixes https://github.com/rust-lang/rust/issues/146291 by disabling pointer fragment support for const-eval. I want to properly fix this eventually, but won't get to it in the next few weeks, so this is an emergency patch to prevent the buggy implementation from landing on stable. The beta cutoff is on Sep 12th so if this PR lands after that, we'll need a backport.
2025-09-09Rollup merge of #145819 - jdonszelmann:convert-limits, r=fmeaseStuart Cook-5/+7
Port limit attributes to the new attribute parsing infrastructure Doesn't pass tests, to be rebased on https://github.com/rust-lang/rust/pull/145792 which will solve that r? `@fmease`
2025-09-08fixup limit handling codeJana Dönszelmann-5/+7
2025-09-08Auto merge of #140375 - lcnr:subrelations-infcx, r=BoxyUwUbors-1/+0
eagerly compute `sub_unification_table` again Previously called `sub_relations`. We still only using them for diagnostics right now. This mostly reverts rust-lang/rust#119989. Necessary for type inference guidance due to not-yet defined opaque types, cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/182. We could use them for cycle detection in generalization and it seems desirable to do so in the future. However, this is unsound with the old trait solver as its cache does not track these `sub_unification_table` in any way. We now properly track the `sub_unification_table` when canonicalizing so using them in the new solver is totally sound and the performance impact is far more manageable than I thought back in rust-lang/rust#119989. r? `@compiler-errors`
2025-09-08Rollup merge of #146313 - nnethercote:rustc_middle-ty-cleanups-2, r=lcnrMatthias Krüger-82/+13
Some `rustc_middle` cleanups Minor improvements I found while looking through this code. r? `@BoxyUwU`
2025-09-08Rollup merge of #146111 - ChayimFriedman2:more-ns-specific-defid, r=lcnrMatthias Krüger-1/+27
Migrate more things in the new solver to specific `DefId`s Continuation of https://github.com/rust-lang/rust/pull/145377. I migrated the rest of the types, except aliases. Aliases are problematic because opaques and associated types share the same type in the new solver. `@jackh726,` `@lcnr,` `@ShoyuVanilla` I'd like to hear ideas here. Anyway, even if we do nothing with them we already got a substantial improvement. r? types
2025-09-08inline `CanonicalTyVarKind`lcnr-1/+0
2025-09-08Skip typeck for items w/o their own typeck contextDaria Sukhonina-4/+1
More details on about this fix: https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/ICE.3A.20typecks.20AnonConst.20under.20parallel.20rustc.28.23141951.29/with/538200980 Co-authored-by: ywxt <ywxtcwh@gmail.com>
2025-09-08const-eval: disable pointer fragment supportRalf Jung-2/+19
2025-09-08Move `describe_as_module` from `rustc_middle::print` to `rustc:middle::query`.Nicholas Nethercote-12/+11
That way it doesn't need to be exported.
2025-09-08Move `rustc_middle::MaxUniverse` to `rustc_infer`.Nicholas Nethercote-40/+0
Because `rust_infer` is the only crate that uses it.
2025-09-08Make some matches non-exhaustive.Nicholas Nethercote-30/+2
Exhaustive match isn't necessary for these trivial cases, and some similar nearby methods are non-exhaustive.
2025-09-07Rollup merge of #146297 - cjgillot:may-observe-address, r=saethlinMatthias Krüger-0/+18
Introduce PlaceContext::may_observe_address. A small utility method to avoid open-coding the logic in several MIR opts.
2025-09-07Introduce PlaceContext::may_observe_address.Camille GILLOT-0/+18