about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2025-06-21Rollup merge of #142801 - compiler-errors:gen-blocks, r=oli-obkMatthias Krüger-59/+52
Use gen blocks in the compiler instead of `from_coroutine` r? oli-obk
2025-06-20Rollup merge of #142384 - celinval:chores-rayon-mv, r=oli-obkTrevor Gross-1/+1
Bringing `rustc_rayon_core` in tree as `rustc_thread_pool` This PR moves [`rustc_rayon_core`](https://github.com/rust-lang/rustc-rayon/tree/5fadf44/rayon-core) from commit `5fadf44` as suggested in [this zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Bringing.20.60rustc_rayon_core.60.20in.20tree). I tried to split the work into separate commits so it is easy to review. The first commit is a simple copy and paste from the fork, and subsequent changes were made to use the new crate and to ensure the new crate complies with different format and lint expectations. **Call-out:** I was also wondering if I need to make any further changes to accommodate licensing requirements. r? oli-obk
2025-06-20Use gen blocks in the compiler instead of from_coroutineMichael Goulet-59/+52
2025-06-20Auto merge of #142316 - compiler-errors:cache-param-env, r=lcnrbors-0/+8
[perf] Cache the canonical *instantiation* of param-envs r? lcnr
2025-06-20Rollup merge of #142687 - cjgillot:less-hir_crate, r=oli-obkTrevor Gross-22/+13
Reduce uses of `hir_crate`. I tried rebasing my old incremental-HIR branch. This is a by-product, which is required if we want to get rid of `hir_crate` entirely. The second commit is a drive-by cleanup. It can be pulled into its own PR. r? ````@oli-obk````
2025-06-19Apply impl_super_outlives optimization to new trait solverMichael Goulet-0/+7
2025-06-19Cache instantiation of canonical binderMichael Goulet-0/+8
2025-06-18Rollup merge of #140247 - BoxyUwU:iats_no_query_cycles, r=lcnrTrevor Gross-7/+3
Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs Fixes rust-lang/rust#108491 Fixes rust-lang/rust#125879 This was due to updating inhabited predicate stuff which I had to do to make constructing ADTs with IATs in fields not ICE Fixes rust-lang/rust#136678 (but no test added, I don't rly care about weird IAT edge cases under GCE) Fixes rust-lang/rust#138131 Avoids doing "fully correct" candidate selection for IATs during hir ty lowering when in item signatures as it almost always leads to a query cycle from trying to build a `ParamEnv`. I replaced it with a use `DeepRejectCtxt` which should be able to handle this kind of conservative "could these types unify" while in a context where we don't want to do type equality. This is a relatively simple scheme and should be forwards compatible with doing something more complex/powerful. I'm not really sure how this interacts with rust-lang/rust#126651, though I'm also not really sure its super important to support projecting IATs from IAT self types given we don't even support `T::Assoc::Other` for trait-associated types so didn't give much thought to how this might fit in with that. r? `@compiler-errors` cc `@fmease`
2025-06-18Make feature suggestion more consistent.Camille GILLOT-21/+12
2025-06-18Reduce uses of `hir_crate`.Camille GILLOT-1/+1
2025-06-17Don't build `ParamEnv` and do trait solving in `ItemCtxt`sBoxy-7/+3
2025-06-16trait_sel: extend fast path with sized hierarchyDavid Wood-10/+20
Extend the fast path for `Sized` traits to include constness and `MetaSized`.
2025-06-16middle: print `{Meta,Pointee}Sized` in opaquesDavid Wood-5/+31
When `sized_hierarchy` is enabled, rustc should print `MetaSized` or `PointeeSized` instead of `?Sized` in opaques.
2025-06-16hir_analysis: add `{Meta,Pointee}Sized` boundsDavid Wood-5/+6
Opting-out of `Sized` with `?Sized` is now equivalent to adding a `MetaSized` bound, and adding a `MetaSized` or `PointeeSized` bound is equivalent to removing the default `Sized` bound - this commit implements this change in `rustc_hir_analysis::hir_ty_lowering`. `MetaSized` is also added as a supertrait of all traits, as this is necessary to preserve backwards compatibility. Unfortunately, non-global where clauses being preferred over item bounds (where `PointeeSized` bounds would be proven) - which can result in errors when a `PointeeSized` supertrait/bound/predicate is added to some items. Rather than `PointeeSized` being a bound on everything, it can be the absence of a bound on everything, as `?Sized` was.
2025-06-16library/compiler: add `PointeeSized` boundsDavid Wood-6/+7
As core uses an extern type (`ptr::VTable`), the default `?Sized` to `MetaSized` migration isn't sufficient, and some code that previously accepted `VTable` needs relaxed to continue to accept extern types. Similarly, the compiler uses many extern types in `rustc_codegen_llvm` and in the `rustc_middle::ty::List` implementation (`OpaqueListContents`) some bounds must be relaxed to continue to accept these types. Unfortunately, due to the current inability to relax `Deref::Target`, some of the bounds in the standard library are forced to be stricter than they ideally would be.
2025-06-16trait_sel: `{Meta,Pointee}Sized` on `?Sized` typesDavid Wood-7/+17
Expand the automatic implementation of `MetaSized` and `PointeeSized` so that it is also implemented on non-`Sized` types, just not `ty::Foreign` (extern type).
2025-06-16trait_sel: `{Meta,Pointee}Sized` on `Sized` typesDavid Wood-0/+2
Introduce the `MetaSized` and `PointeeSized` traits as supertraits of `Sized` and initially implement it on everything that currently implements `Sized` to isolate any changes that simply adding the traits introduces.
2025-06-15Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, ↵León Orell Valerian Liehr-17/+8
r=workingjubilee,saethlin Move metadata object generation for dylibs to the linker code This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time. Prerequisite of https://github.com/rust-lang/rust/issues/96708.
2025-06-15Rollup merge of #133952 - bjorn3:remove_wasm_legacy_abi, r=alexcrichtonLeón Orell Valerian Liehr-15/+1
Remove wasm legacy abi Closes https://github.com/rust-lang/rust/issues/122532 Closes https://github.com/rust-lang/rust/issues/138762 Fixes https://github.com/rust-lang/rust/issues/71871 https://github.com/rust-lang/rust/issues/88152 Fixes https://github.com/rust-lang/rust/issues/115666 Fixes https://github.com/rust-lang/rust/issues/129486
2025-06-14Auto merge of #142289 - fmease:maybe-perf-gen-args, r=compiler-errorsbors-4/+4
[perf] `GenericArgs`-related: Change asserts to debug asserts & use more slice interning over iterable interning 1. The 1st commit yields the following perf gains: [#142289 (comment)](https://github.com/rust-lang/rust/pull/142289#issuecomment-2964041303). 2. The 2nd commit might also have a minor positive perf impact, however that one wasn't tested in isolation. For reference, the initial approach https://github.com/rust-lang/rust/commit/c7e6accd79d91fe5dec01a81499a08f9db280440 (results: https://github.com/rust-lang/rust/pull/142289#issuecomment-2961076587) had a lot more changes (apart from what's now contained in commit 1 and 2) which seemed to be perf irrelevant (cf. the partial countercheck in https://github.com/rust-lang/rust/commit/6f82bf1cfece61d32714fbfeecf8c5cf1356b3ae (results: https://github.com/rust-lang/rust/pull/142289#issuecomment-2968393647).
2025-06-14Remove all support for wasm's legacy ABIbjorn3-15/+1
2025-06-14Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errorsMatthias Krüger-1/+1
Unimplement unsized_locals Implements https://github.com/rust-lang/compiler-team/issues/630 Tracking issue here: https://github.com/rust-lang/rust/issues/111942 Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`. There may be more that should be removed (possibly in follow up prs) - the `forget_unsized` function and `forget` intrinsic. - the `unsized_locals` test directory; I've just fixed up the tests for now - various codegen support for unsized values and allocas cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3`` ``@rustbot`` label F-unsized_locals Fixes rust-lang/rust#79409
2025-06-13Rollup merge of #142441 - compiler-errors:lazier-binder-value-folding, r=lcnrJubilee-8/+34
Delay replacing escaping bound vars in `FindParamInClause` By uplifting the `BoundVarReplacer`, which is used by (e.g.) normalization to replace escaping bound vars that are encountered when folding binders, we can use a similar strategy to delay the instantiation of a binder's contents in the `FindParamInClause` used by the new trait solver. This should alleviate the recently added requirement that `Binder<T>: TypeVisitable` only if `T: TypeFoldable`, which was previously required b/c we were calling `enter_forall` so that we could structurally normalize aliases that we found within the predicates of a param-env clause. r? lcnr
2025-06-13TypeVisiting binders no longer requires TypeFolding its interiorMichael Goulet-2/+2
2025-06-13Uplift BoundVarReplacerMichael Goulet-0/+8
2025-06-13Make connection between Placeholder and Bound a bit more clear in the type ↵Michael Goulet-6/+24
abstraction
2025-06-13Rollup merge of #140770 - folkertdev:custom-abi, r=tgross35Matthias Krüger-0/+1
add `extern "custom"` functions tracking issue: rust-lang/rust#140829 previous discussion: https://github.com/rust-lang/rust/issues/140566 In short, an `extern "custom"` function is a function with a custom ABI, that rust does not know about. Therefore, such functions can only be defined with `#[unsafe(naked)]` and `naked_asm!`, or via an `extern "C" { /* ... */ }` block. These functions cannot be called using normal rust syntax: calling them can only be done from inline assembly. The motivation is low-level scenarios where a custom calling convention is used. Currently, we often pick `extern "C"`, but that is a lie because the function does not actually respect the C calling convention. At the moment `"custom"` seems to be the name with the most support. That name is not final, but we need to pick something to actually implement this. r? `@traviscross` cc `@tgross35` try-job: x86_64-apple-2
2025-06-13Unimplement unsized_localsmejrs-1/+1
2025-06-13Use more slicing and slice interning over iterable interningLeón Orell Valerian Liehr-1/+1
2025-06-13[perf] Change asserts to debug ones in trait_ref_and_own_argsLeón Orell Valerian Liehr-3/+3
2025-06-12add `extern "custom"` functionsFolkert de Vries-0/+1
2025-06-12introduce new lint infraJana Dönszelmann-3/+15
lint on duplicates during attribute parsing To do this we stuff them in the diagnostic context to be emitted after hir is constructed
2025-06-11Use `rustc_thread_pool` instead of `rustc-rayon-core`Celina G. Val-1/+1
2025-06-11Auto merge of #142358 - matthiaskrgr:rollup-fxe6m7k, r=matthiaskrgrbors-5/+2
Rollup of 9 pull requests Successful merges: - rust-lang/rust#141967 (Configure bootstrap backport nominations through triagebot) - rust-lang/rust#142042 (Make E0621 missing lifetime suggestion verbose) - rust-lang/rust#142272 (tests: Change ABIs in tests to more future-resilient ones) - rust-lang/rust#142282 (Only run `citool` tests on the `auto` branch) - rust-lang/rust#142297 (Implement `//@ needs-target-std` compiletest directive) - rust-lang/rust#142298 (Make loongarch-none target maintainers more easily pingable) - rust-lang/rust#142306 (Dont unwrap and re-wrap typing envs) - rust-lang/rust#142324 (Remove unneeded `FunctionCx` from some codegen methods) - rust-lang/rust#142328 (feat: Add `bit_width` for unsigned integer types) Failed merges: - rust-lang/rust#141639 (Expose discriminant values in stable_mir) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-11Auto merge of #141763 - lcnr:fixme-gamer, r=BoxyUwUbors-0/+4
`FIXME(-Znext-solver)` triage r? `@BoxyUwU`
2025-06-10Dont unwrap and re-wrap typing envsMichael Goulet-5/+2
2025-06-08add `param_env` cache to canonicalizationlcnr-0/+14
2025-06-06Rollup merge of #142112 - ada4a:patch-1, r=wesleywiserGuillaume Gomez-1/+1
fix typo
2025-06-06fix typoAda Alakbarova-1/+1
2025-06-05Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of NoneOli Scherer-16/+16
2025-06-04Rollup merge of #142005 - scottmcm:fieldidx-in-variantsmultiple, ↵Matthias Krüger-3/+5
r=workingjubilee Change `tag_field` to `FieldIdx` in `Variants::Multiple` It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field. This is a first part of pulling smaller pieces out of rust-lang/rust#138759, so r? workingjubilee
2025-06-03Change `tag_field` to `FieldIdx` in `Variants::Multiple`Scott McMurray-3/+5
It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field.
2025-06-03Ensure query keys are printed with reduced queriesMichael Goulet-1/+1
2025-06-03`FIXME(-Znext-solver)` triagelcnr-0/+4
Co-authored-by: Michael Goulet <michael@errs.io>
2025-06-03Move metadata object generation for dylibs to the linker codebjorn3-17/+8
This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time.
2025-06-01Auto merge of #141731 - compiler-errors:tweak-fast-path-trait, r=lcnrbors-4/+2
Tweak fast path trait handling (1.) Make it more sound by considering polarity (lol) (2.) Make it more general, by considering higher-ranked size/copy/clone (2.) Make it less observable, by only doing copy/clone fast path if there are no regions involved r? lcnr
2025-05-30Rollup merge of #141507 - RalfJung:atomic-intrinsics, r=bjorn3Matthias Krüger-3/+35
atomic_load intrinsic: use const generic parameter for ordering We have a gazillion intrinsics for the atomics because we encode the ordering into the intrinsic name rather than making it a parameter. This is particularly bad for those operations that take two orderings. Let's fix that! This PR only converts `load`, to see if there's any feedback that would fundamentally change the strategy we pursue for the const generic intrinsics. The first two commits are preparation and could be a separate PR if you prefer. `@BoxyUwU` -- I hope this is a use of const generics that is unlikely to explode? All we need is a const generic of enum type. We could funnel it through an integer if we had to but an enum is obviously nicer... `@bjorn3` it seems like the cranelift backend entirely ignores the ordering?
2025-05-29Tweak fast path trait handlingMichael Goulet-4/+2
2025-05-29Auto merge of #141716 - jhpratt:rollup-9bjrzfi, r=jhprattbors-0/+4
Rollup of 16 pull requests Successful merges: - rust-lang/rust#136429 (GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants) - rust-lang/rust#138139 (Emit warning while outputs is not exe and prints linkage info) - rust-lang/rust#141104 (Test(fs): Fix `test_eq_windows_file_type` for Windows 7) - rust-lang/rust#141477 (Path::with_extension: show that it adds an extension where one did no…) - rust-lang/rust#141533 (clean up old rintf leftovers) - rust-lang/rust#141612 (Call out possibility of invariant result in variance markers) - rust-lang/rust#141638 (Use `builtin_index` instead of hand-rolling it) - rust-lang/rust#141643 (ci: verify that codebuild jobs use ghcr.io) - rust-lang/rust#141675 (Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.) - rust-lang/rust#141680 (replace TraitRef link memory.md) - rust-lang/rust#141682 (interpret/allocation: Fixup type for `alloc_bytes`) - rust-lang/rust#141683 (Handle ed2021 precise capturing of unsafe binder) - rust-lang/rust#141684 (rustbook: Bump versions of `onig` and `onig_sys`) - rust-lang/rust#141687 (core: unstably expose atomic_compare_exchange so stdarch can use it) - rust-lang/rust#141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods) - rust-lang/rust#141702 (Add eholk to compiler reviewer rotation) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-29Rollup merge of #141683 - compiler-errors:unsafe-binder-capture, r=oli-obkJacob Pratt-0/+4
Handle ed2021 precise capturing of unsafe binder Missing pieces from last pr. r? oli-obk Fixes https://github.com/rust-lang/rust/issues/141655