summary refs log tree commit diff
path: root/compiler/rustc_ty_utils
AgeCommit message (Collapse)AuthorLines
2025-07-31Extract borrowck coroutine drop-liveness hackMichael Goulet-17/+26
2025-07-28Rename trait_of_item -> trait_of_assocCameron Steffen-1/+1
2025-07-28Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLiibors-9/+9
Some `let chains` clean-up Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one r? compiler
2025-07-28use let chains in mir, resolve, targetKivooeo-9/+9
2025-07-26Rollup merge of #144448 - camsteffen:defaultness-impl-trait-only, ↵Matthias Krüger-2/+5
r=compiler-errors Limit defaultness query to impl of trait I separated this out from https://github.com/rust-lang/rust/pull/144386.
2025-07-25Limit defaultness to impl of traitCameron Steffen-2/+5
2025-07-24Remove dead code and extend test coverage and diagnostics around itOli Scherer-8/+0
We lost the following comment during refactorings: The current code for niche-filling relies on variant indices instead of actual discriminants, so enums with explicit discriminants (RFC 2363) would misbehave.
2025-07-17Rollup merge of #143793 - fmease:lta-opaq-inf-recur, r=oli-obkMatthias Krüger-4/+7
Opaque type collection: Guard against endlessly recursing free alias types See test description for technical details. Fixes https://github.com/rust-lang/rust/issues/131994. r? oli-obk (sry, your queue is large, so no rush & feel free to reassign)
2025-07-13Retire hir::*ItemRef.Camille GILLOT-7/+7
2025-07-13Remove hir::AssocItemKind.Camille GILLOT-2/+2
2025-07-13Move trait_item_def_id from ImplItemRef to ImplItem.Camille GILLOT-62/+51
2025-07-13Remove usused depth.Camille GILLOT-4/+1
2025-07-12Clean up implementation of RPITIT assoc item loweringMichael Goulet-115/+75
2025-07-13query RPITIT in a trait or implbohan-112/+104
2025-07-13compute all rpitit of a traitbohan-56/+56
2025-07-11Opaque type collection: Guard against endlessly recursing free alias typesLeón Orell Valerian Liehr-4/+7
2025-07-08Rollup merge of #143570 - bvanjoi:issue-143560, r=compiler-errorsMatthias Krüger-10/+24
consider nested cases for duplicate RPITIT Fixes rust-lang/rust#143560 r? `@compiler-errors` cc `@Zoxc`
2025-07-07Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubileebors-2/+2
Allow custom default address spaces and parse `p-` specifications in the datalayout string Some targets, such as CHERI, use as default an address space different from the "normal" default address space `0` (in the case of CHERI, [200 is used](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-877.pdf)). Currently, `rustc` does not allow to specify custom address spaces and does not take into consideration [`p-` specifications in the datalayout string](https://llvm.org/docs/LangRef.html#langref-datalayout). This patch tries to mitigate these problems by allowing targets to define a custom default address space (while keeping the default value to address space `0`) and adding the code to parse the `p-` specifications in `rustc_abi`. The main changes are that `TargetDataLayout` now uses functions to refer to pointer-related informations, instead of having specific fields for the size and alignment of pointers in the default address space; furthermore, the two `pointer_size` and `pointer_align` fields in `TargetDataLayout` are replaced with an `FxHashMap` that holds info for all the possible address spaces, as parsed by the `p-` specifications. The potential performance drawbacks of not having ad-hoc fields for the default address space will be tested in this PR's CI run. r? workingjubilee
2025-07-07consider nested cases for duplicate RPITITbohan-10/+24
2025-07-07compiler: Parse `p-` specs in datalayout string, allow definition of custom ↵Edoardo Marangoni-2/+2
default data address space
2025-07-06Rollup merge of #143484 - bvanjoi:issue-140796, r=compiler-errorsMatthias Krüger-2/+29
distinguish the duplicate item of rpitit Fixes rust-lang/rust#140796 r? compiler cc `@Zoxc`
2025-07-06distinguish the duplicate item of rpititbohan-2/+29
2025-07-05use `is_multiple_of` instead of manual moduloFolkert de Vries-1/+1
2025-07-03Rollup merge of #134006 - klensy:typos, r=nnethercoteJana Dönszelmann-1/+1
setup typos check in CI This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying? Also includes commits with actual typo fixes. MCP: https://github.com/rust-lang/compiler-team/issues/817 typos check currently turned for: * ./compiler * ./library * ./src/bootstrap * ./src/librustdoc After merging, PRs which enables checks for other crates (tools) can be implemented too. Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr. Check typos: `python x.py test tidy --extra-checks=spellcheck` Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo) Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-07-02Rollup merge of #143258 - compiler-errors:disambiguator-state, r=oli-obkMatthias Krüger-30/+28
Don't recompute `DisambiguatorState` for every RPITIT in trait definition The `associated_type_for_impl_trait_in_trait` currently needs to rerun the `RPITVisitor` for every RPITIT to compute its disambiguator. Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the `associated_types_for_impl_traits_in_associated_fn` query. There we can just share the same `DisambiguatorState` for all the RPITITs in one function signature. r? ``````@Zoxc`````` or ``````@oli-obk`````` cc rust-lang/rust#140453
2025-07-01Remove support for dyn*Michael Goulet-12/+2
2025-06-30Don't recompute DisambiguatorState for every RPITIT in trait definitionMichael Goulet-30/+28
2025-06-30Introduce `ByteSymbol`.Nicholas Nethercote-1/+1
It's like `Symbol` but for byte strings. The interner is now used for both `Symbol` and `ByteSymbol`. E.g. if you intern `"dog"` and `b"dog"` you'll get a `Symbol` and a `ByteSymbol` with the same index and the characters will only be stored once. The motivation for this is to eliminate the `Arc`s in `ast::LitKind`, to make `ast::LitKind` impl `Copy`, and to avoid the need to arena-allocate `ast::LitKind` in HIR. The latter change reduces peak memory by a non-trivial amount on literal-heavy benchmarks such as `deep-vector` and `tuple-stress`. `Encoder`, `Decoder`, `SpanEncoder`, and `SpanDecoder` all get some changes so that they can handle normal strings and byte strings. This change does slow down compilation of programs that use `include_bytes!` on large files, because the contents of those files are now interned (hashed). This makes `include_bytes!` more similar to `include_str!`, though `include_bytes!` contents still aren't escaped, and hashing is still much cheaper than escaping.
2025-06-28move discr=varid check to layout_sanity_checkFlorian Sextl-0/+6
2025-06-27Rollup merge of #139858 - oli-obk:new-const-traits-syntax, r=fee1-deadMatthias Krüger-1/+1
New const traits syntax This PR only affects the AST and doesn't actually change anything semantically. All occurrences of `~const` outside of libcore have been replaced by `[const]`. Within libcore we have to wait for rustfmt to be bumped in the bootstrap compiler. This will happen "automatically" (when rustfmt is run) during the bootstrap bump, as rustfmt converts `~const` into `[const]`. After this we can remove the `~const` support from the parser Caveat discovered during impl: there is no legacy bare trait object recovery for `[const] Trait` as that snippet in type position goes down the slice /array parsing code and will error r? ``@fee1-dead`` cc ``@nikomatsakis`` ``@traviscross`` ``@compiler-errors``
2025-06-26Change const trait bound syntax from ~const to [const]Oli Scherer-1/+1
2025-06-23Add `#[loop_match]` for improved DFA codegenbjorn3-1/+7
Co-authored-by: Folkert de Vries <folkert@folkertdev.nl>
2025-06-18Rollup merge of #142619 - klensy:or_fun_call, r=nnethercoteJakub Beránek-4/+3
apply clippy::or_fun_call Applies https://rust-lang.github.io/rust-clippy/master/index.html?groups=nursery#or_fun_call to reduce needless allocs.
2025-06-17apply clippy::or_fun_callklensy-4/+3
2025-06-16hir_analysis: add `{Meta,Pointee}Sized` boundsDavid Wood-1/+1
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-16trait_sel: `{Meta,Pointee}Sized` on `?Sized` typesDavid Wood-30/+52
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-14Remove all support for wasm's legacy ABIbjorn3-18/+8
2025-06-13TypeVisiting binders no longer requires TypeFolding its interiorMichael Goulet-3/+2
2025-06-10Dont unwrap and re-wrap typing envsMichael Goulet-5/+3
2025-06-08Dont make ObligationCtxts with diagnostics unnecessarilyMichael Goulet-1/+1
2025-06-05Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of NoneOli Scherer-10/+11
2025-06-03Change `tag_field` to `FieldIdx` in `Variants::Multiple`Scott McMurray-1/+1
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-03Rollup merge of #141569 - workingjubilee:canonicalize-abi, r=bjorn3Matthias Krüger-41/+3
Replace ad-hoc ABI "adjustments" with an `AbiMap` to `CanonAbi` Our `conv_from_spec_abi`, `adjust_abi`, and `is_abi_supported` combine to give us a very confusing way of reasoning about what _actual_ calling convention we want to lower our code to and whether we want to compile the resulting code at all. Instead of leaving this code as a miniature adventure game in which someone tries to combine stateful mutations into a Rube Goldberg machine that will let them escape the maze and arrive at the promised land of codegen, we let `AbiMap` devour this complexity. Once you have an `AbiMap`, you can answer which `ExternAbi`s will lower to what `CanonAbi`s (and whether they will lower at all). Removed: - `conv_from_spec_abi` replaced by `AbiMap::canonize_abi` - `adjust_abi` replaced by same - `Conv::PreserveAll` as unused - `Conv::Cold` as unused - `enum Conv` replaced by `enum CanonAbi` target-spec.json changes: - If you have a target-spec.json then now your "entry-abi" key will be specified in terms of one of the `"{abi}"` strings Rust recognizes, e.g. ```json "entry-abi": "C", "entry-abi": "win64", "entry-abi": "aapcs", ```
2025-06-03compiler: change Conv to CanonAbiJubilee Young-41/+3
2025-05-27Rollup merge of #141495 - compiler-errors:rename-unpack, r=fmeaseMatthias Krüger-3/+3
Rename `{GenericArg,Term}::unpack()` to `kind()` A well-deserved rename IMO. r? `@oli-obk` or `@lcnr` (or anyone) cc `@rust-lang/types,` but I'd be surprised if this is controversial.
2025-05-27Rename unpack to kindMichael Goulet-3/+3
2025-05-26Support opaque_types_defined_by for SyntheticCoroutineBodyMichael Goulet-3/+5
2025-05-18Rollup merge of #140926 - ↵León Orell Valerian Liehr-3/+1
azhogin:azhogin/async-drop-coroutine-layout-returns-layout-error, r=oli-obk Return value of coroutine_layout fn changed to Result with LayoutError Continue of https://github.com/rust-lang/rust/pull/140902: `coroutine_layout` fn is now returns `Result` with `LayoutError` to have consistent error with `layout_of_uncached`. `async_drop_coroutine_layout` fn is now return `LayoutError::TooGeneric` in case of not-fully-specialized `async_drop_in_place<T>::{closure}` coroutine.
2025-05-15move expensive layout sanity check to debug assertionsRémy Rakic-9/+13