about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2025-04-30Rollup merge of #140468 - BoxyUwU:normalization_confusings2, r=lcnrMatthias Krüger-31/+41
Minor tweaks to make some normalization (adjacent) code less confusing r? lcnr sorry for double ping lol
2025-04-30Use select in projection lookupMichael Goulet-20/+22
2025-04-30Rollup merge of #140516 - rperier:type-ir-to-type-middle, r=lcnrMatthias Krüger-25/+20
Replace use of rustc_type_ir by rustc_middle cc #138449 I want to help on this issue. I have replaced all the rustc_type_ir uses by the equivalent type in rustc_middle. DelayedSet is also re-exposed by rustc_middle.
2025-04-30Use less rustc_type_ir in the compiler codebaseRomain Perier-25/+20
This commit does the following: - Replaces use of rustc_type_ir by rustc_middle - Removes the rustc_type_ir dependency - The DelayedSet type is exposed by rustc_middle so everything can be accessed through rustc_middle in a coherent manner.
2025-04-30Rollup merge of #140445 - oli-obk:const-manually-drop, r=fee1-deadMatthias Krüger-0/+3
Treat ManuallyDrop as ~const Destruct cc https://github.com/rust-lang/rust/issues/133214#issuecomment-2838078133 r? ```@compiler-errors``` cc ```@fee1-dead```
2025-04-29confusingsBoxy-31/+41
2025-04-29Rollup merge of #139909 - oli-obk:or-patterns, r=BoxyUwUTrevor Gross-37/+47
implement or-patterns for pattern types These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion cc https://github.com/rust-lang/rust/issues/123646 r? `@BoxyUwU`
2025-04-29Treat `ManuallyDrop` as `~const Destruct`Oli Scherer-0/+3
2025-04-29Also match on the lang item in confirmationOli Scherer-10/+5
2025-04-29Always check the lang item firstOli Scherer-16/+8
2025-04-29Replace if/elseif chain with matchOli Scherer-62/+81
2025-04-29Adjust testsMichael Goulet-1/+3
2025-04-29Wf is not coinductiveMichael Goulet-1/+4
2025-04-28Auto merge of #140388 - GuillaumeGomez:rollup-aj9o3ch, r=GuillaumeGomezbors-11/+11
Rollup of 7 pull requests Successful merges: - #140056 (Fix a wrong error message in 2024 edition) - #140220 (Fix detection of main function if there are expressions around it) - #140249 (Remove `weak` alias terminology) - #140316 (Introduce `BoxMarker` to improve pretty-printing correctness) - #140347 (ci: clean more disk space in codebuild) - #140349 (ci: use aws codebuild for the `dist-x86_64-linux` job) - #140379 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-28Rollup merge of #140249 - BoxyUwU:remove_weak_alias_terminology, r=oli-obkGuillaume Gomez-11/+11
Remove `weak` alias terminology I find the "weak" alias terminology to be quite confusing. It implies the existence of "strong" aliases (which do not exist) and I'm not really sure what about weak aliases is "weak". I much prefer "free alias" as the term. I think it's much more obvious what it means as "free function" is a well defined term that already exists in rust. It's also a little confusing given "weak alias" is already a term in linker/codegen spaces which are part of the compiler too. Though I'm not particularly worried about that as it's usually very obvious if you're talking about the type system or not lol. I'm also currently trying to write documentation about aliases and it's somewhat awkward/confusing to be talking about *weak* aliases, when I'm not really sure what the basis for that as the term actually *is*. I would also be happy to just find out there's a nice meaning behind calling them "weak" aliases :-) r? `@oli-obk` maybe we want a types MCP to decide on a specific naming here? or maybe we think its just too late to go back on this naming decision ^^'
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-44/+0
async_drop_in_place::{closure}, scoped async drop added.
2025-04-28Add or-patterns to pattern typesOli Scherer-0/+5
2025-04-28Split out various pattern type matches into their own functionOli Scherer-37/+42
2025-04-26Rollup merge of #140320 - lcnr:wf-use-term, r=compiler-errorsMatthias Krüger-107/+105
replace `GenericArg` with `Term` where applicable r? types
2025-04-26Rollup merge of #140318 - compiler-errors:specialized-async-fn-kind-err, ↵Matthias Krüger-31/+10
r=fee1-dead Simply try to unpeel AsyncFnKindHelper goal in `emit_specialized_closure_kind_error` Tweak the handling of `AsyncFnKindHelper` goals in `emit_specialized_closure_kind_error` to not be so special-casey, and just try to unpeel one or two layers of obligation causes to get to their underlying `AsyncFn*` goal. Fixes https://github.com/rust-lang/rust/issues/140292
2025-04-26convert some `GenericArg` to `Term`lcnr-107/+105
2025-04-26Simply try to unpeel AsyncFnKindHelper goal in ↵Michael Goulet-31/+10
emit_specialized_closure_kind_error
2025-04-25Track per-obligation recursion depth only if there is inferenceMichael Goulet-8/+15
2025-04-25Rollup merge of #140278 - compiler-errors:name-based-comparison, r=nnethercoteMatthias Krüger-7/+5
Don't use item name to look up associated item from trait item This fix should be self-justifying b/c the fact that we were using identifiers here was kinda sus anyways, esp b/c we have a failproof way of doing the comparison :) I'll leave some info about why this repro needs a macro. Fixes https://github.com/rust-lang/rust/issues/140259 r? `@nnethercote`
2025-04-25Rollup merge of #140202 - est31:let_chains_feature_compiler, r=lcnrMatthias Krüger-1/+1
Make #![feature(let_chains)] bootstrap conditional in compiler/ Let chains have been stabilized recently in #132833, so we can remove the gating from our uses in the compiler (as the compiler uses edition 2024).
2025-04-25Don't use item name to look up associated item from trait itemMichael Goulet-7/+5
2025-04-24Auto merge of #140245 - matthiaskrgr:rollup-e0fwsfv, r=matthiaskrgrbors-33/+48
Rollup of 8 pull requests Successful merges: - #139261 (mitigate MSVC alignment issue on x86-32) - #140075 (Mention average in midpoint documentations) - #140184 (Update doc of cygwin target) - #140186 (Rename `compute_x` methods) - #140194 (minicore: Have `//@ add-core-stubs` also imply `-Cforce-unwind-tables=yes`) - #140195 (triagebot: label minicore changes w/ `A-test-infra-minicore` and ping jieyouxu on changes) - #140214 (Remove comment about handling non-global where bounds with corresponding projection) - #140228 (Revert overzealous parse recovery for single colons in paths) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-24Remove `weak` alias terminologyBoxy-11/+11
2025-04-24Rollup merge of #140214 - compiler-errors:remove-hack, r=lcnrMatthias Krüger-2/+0
Remove comment about handling non-global where bounds with corresponding projection This comment is no longer relevant since we only assemble rigid projections if no param-env candidates hold. Also remove a stray comment from the old solver. r? lcnr
2025-04-24Rollup merge of #140186 - BoxyUwU:compute_what, r=compiler-errorsMatthias Krüger-31/+48
Rename `compute_x` methods r? ```@lcnr``` I find the `compute_x` naming scheme to be overly confusing. It means `compute_wf_obligations_for_x_and_add_them_to_self` but shortens out all of the important parts of the actual operation being performed. `compute_x` sounds like its somehow performing `x`, maybe even returning it from the function, which is not true. I've had some newer contributors be confused by this naming scheme so I think it's good to change it to something more self-evident Some misc drive by niceties while I was here too.
2025-04-24Rollup merge of #140232 - nnethercote:rm-unnecessary-clones, r=SparrowLiiMatthias Krüger-2/+1
Remove unnecessary clones r? `@SparrowLii`
2025-04-24Rollup merge of #139945 - shepmaster:hir-lifetime-syntax-source, r=nnethercoteMatthias Krüger-20/+7
Extend HIR to track the source and syntax of a lifetime An upcoming lint will want to be able to know if a lifetime is hidden (e.g. `&u8`, `ContainsLifetime`) or anonymous: (e.g. `&'_ u8`, `ContainsLifetime<'_>`). It will also want to know if the lifetime is related to a reference (`&u8`) or a path (`ContainsLifetime`). r? ``@nnethercote``
2025-04-24Remove some unnecessary clones.Nicholas Nethercote-2/+1
I found these by grepping for `&[a-z_\.]*\.clone()`, i.e. expressions like `&a.b.clone()`, which are sometimes unnecessary clones, and also looking at clones nearby to cases like that.
2025-04-23Auto merge of #138845 - compiler-errors:stall-generators, r=lcnrbors-47/+197
Properly stall coroutine witnesses in new solver TODO: write description r? lcnr
2025-04-23Extend HIR to track the source and syntax of a lifetimeJake Goulding-20/+7
An upcoming lint will want to be able to know if a lifetime is hidden (e.g. `&u8`, `ContainsLifetime`) or anonymous: (e.g. `&'_ u8`, `ContainsLifetime<'_>`). It will also want to know if the lifetime is related to a reference (`&u8`) or a path (`ContainsLifetime`).
2025-04-23Remove hackMichael Goulet-2/+0
2025-04-23Use the new solver in the impossible_predicatesMichael Goulet-9/+5
2025-04-23MoreMichael Goulet-31/+62
2025-04-23Make #![feature(let_chains)] bootstrap conditional in compiler/est31-1/+1
2025-04-23Module docsBoxy-0/+5
2025-04-23Rename `compute_x` methodsBoxy-31/+43
2025-04-22Consider Copy/Clone tooMichael Goulet-1/+1
2025-04-22Properly drain pending obligations for coroutinesMichael Goulet-38/+122
2025-04-22Collect and resolve ambiguous obligations from normalizing in writebackMichael Goulet-3/+38
2025-04-22Use `is_lang_item` and `as_lang_item` instead of handrolling their logicOli Scherer-137/+130
2025-04-21Rollup merge of #140021 - compiler-errors:no-deep-norm-ice, r=lcnrChris Denton-1/+9
Don't ICE on pending obligations from deep normalization in a loop See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`. Fixes https://github.com/rust-lang/rust/issues/133868 r? lcnr
2025-04-19Don't ICE on pending obligations from deep normalization in a loopMichael Goulet-1/+9
2025-04-19Rollup merge of #139091 - mejrs:format, r=compiler-errorsChris Denton-368/+789
Rewrite on_unimplemented format string parser. This PR rewrites the format string parser for `rustc_on_unimplemented` and `diagnostic::on_unimplemented`. I plan on moving this code (and more) into the new attribute parsing system soon and wanted to PR it separately. This PR introduces some minor differences though: - `rustc_on_unimplemented` on trait *implementations* is no longer checked/used - this is actually never used (outside of some tests) so I plan on removing it in the future. - for `rustc_on_unimplemented`, it introduces the `{This}` argument in favor of `{ThisTraitname}` (to be removed later). It'll be easier to parse. - for `rustc_on_unimplemented`, `Self` can now consistently be used as a filter, rather than just `_Self`. It used to not match correctly on for example `Self = "[{integer}]"` - Some error messages now have better spans. Fixes https://github.com/rust-lang/rust/issues/130627
2025-04-17Rollup merge of #139774 - compiler-errors:supertrait-alias, r=lcnrMatthias Krüger-4/+6
Fix replacing supertrait aliases in `ReplaceProjectionWith` The new solver has a procedure called `predicates_for_object_candidate`, which elaborates the super-bounds and item-bounds that are required to hold for a dyn trait to implement something via a built-in object impl. In that procedure, there is a folder called `ReplaceProjectionWith` which is responsible for replacing projections that reference `Self`, so that we don't encounter cycles when we then go on to normalize those projections in the process of proving these super-bounds. That folder had a few problems: Firstly, it wasn't actually checking that this was a super bound originating from `Self`. Secondly, it only accounted for a *single* projection type def id, but trait objects can have multiple (i.e. `trait Foo<A, B>: Bar<A, Assoc = A> + Bar<B, Assoc = B>`). To fix the first, it's simple enough to just add an equality check for the self ty. To fix the second, I implemented a matching step that's very similar to the `projection_may_match` check we have for upcasting, since on top of having multiple choices, we need to deal with both non-structural matches and ambiguity. This probably lacks a bit of documentation, but I think it works pretty well. Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/171 r? lcnr
2025-04-17Auto merge of #139949 - matthiaskrgr:rollup-pxc5tsx, r=matthiaskrgrbors-68/+20
Rollup of 8 pull requests Successful merges: - #138632 (Stabilize `cfg_boolean_literals`) - #139416 (unstable book; document `macro_metavar_expr_concat`) - #139782 (Consistent with treating Ctor Call as Struct in liveness analysis) - #139885 (document RUSTC_BOOTSTRAP, RUSTC_OVERRIDE_VERSION_STRING, and -Z allow-features in the unstable book) - #139904 (Explicitly annotate edition for `unpretty=expanded` and `unpretty=hir` tests) - #139932 (transmutability: Refactor tests for simplicity) - #139944 (Move eager translation to a method on Diag) - #139948 (git: ignore `60600a6fa403216bfd66e04f948b1822f6450af7` for blame purposes) r? `@ghost` `@rustbot` modify labels: rollup