about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2025-05-21Make captures state error more preciseMichael Goulet-7/+5
2025-05-21Don't evaluate constants depending on infers or paramsBoxy-42/+64
2025-05-21Introduce `tcx.anon_const_kind` queryBoxy-2/+7
2025-05-21Document why we allow escaping bound vars in LTA normBoxy-4/+13
2025-05-21Auto merge of #141345 - matthiaskrgr:rollup-vux7gok, r=matthiaskrgrbors-3/+15
Rollup of 7 pull requests Successful merges: - #141267 (only resolve top-level guard patterns' guards once) - #141280 (Use Docker cache from the current repository) - #141296 (Async drop fix for 'broken mir, place has deref as later projection') - #141328 (When AsyncDrop impl is empty, sync drop generated in elaborator) - #141332 (Do not eagerly fold consts in `normalize_param_env_or_error` if new solver) - #141333 (Use `DeepRejectCtxt` in `assemble_inherent_candidates_from_param`) - #141334 (eagerly check nested obligations when coercing fndefs) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-21Rollup merge of #141334 - lcnr:coerce-nested-obligations, r=compiler-errorsMatthias Krüger-0/+14
eagerly check nested obligations when coercing fndefs fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/212 r? `@compiler-errors`
2025-05-21Rollup merge of #141332 - compiler-errors:no-fold-const, r=lcnrMatthias Krüger-3/+1
Do not eagerly fold consts in `normalize_param_env_or_error` if new solver Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/213 Given: ``` trait Trait: Deref<Target = [u8; { 1 + 1 }]> {} ``` when elaborating param env for `Trait`, we have `Self: Trait`, `Self: Deref<Target = [u8; {anon const}]>`. Before this PR, we would fold the anon consts away *before* elaborating. However, we end up getting another *un-folded* copy of the anon const from elaborating `Self: Trait`. This leads to normalization ambiguity. r? lcnr
2025-05-21Auto merge of #140386 - oli-obk:match-on-lang-item-kind, r=compiler-errorsbors-85/+91
Match on lang item kind instead of using an if/else chain Similar to how the new solver does this. Just noticed while I was adding a new entry to the chain 😆
2025-05-21eagerly check nested obligations when coercing fndefslcnr-0/+14
2025-05-21Do not eagerly fold consts in normalize_param_env_or_error if new solverMichael Goulet-3/+1
2025-05-20Do not call name() on rpitit assoc_itemSantiago Pastorino-10/+13
2025-05-20Querify coroutine_hidden_typesMichael Goulet-1/+1
2025-05-18Fast path for sized predMichael Goulet-0/+16
2025-05-18Fast path for processing some obligations in the new solverMichael Goulet-3/+44
2025-05-17Rollup merge of #141121 - compiler-errors:ambig-is-not-err, r=lcnrMatthias Krüger-2/+8
Only select true errors in `impossible_predicates` See description in test. Fixes #141119 r? lcnr
2025-05-17do away with `_Self` and `TraitName` and check generic params for ↵mejrs-87/+47
rustc_on_unimplemented
2025-05-17Only select true errors in impossible_predicatesMichael Goulet-2/+8
2025-05-17Rollup merge of #140208 - compiler-errors:wf-coinductive, r=lcnrMatthias Krüger-1/+6
Make well-formedness predicates no longer coinductive This PR makes well-formedness no longer coinductive. It was made coinductive in https://github.com/rust-lang/rust/pull/98542, but AFAICT this was only to fix UI tests since we stopped lowering `where Ty:` to an empty-region outlives predicate but to a WF predicate instead. Arguably it should lower to something completely different, something like a "type mentioned no-op predicate", but well-formedness serves this purpose fine today, and since no code (according to crater) relies on this coinductive behavior, we'd like to avoid having to emulate it in the new solver. Fixes #123456 (I didn't want to add a test since it seems low-value to have a ICE test for a fuzzer minimization that is basically garbage code.) Fixes #109764 (not sure if this behavior is emulatable w/o coinductive WF?) Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/169 r? lcnr
2025-05-16Auto merge of #140978 - davidtwco:deep-reject-in-match-norm-trait-ref, r=lcnrbors-2/+8
trait_sel: deep reject `match_normalize_trait_ref` Spotted during an in-person review of #137944 at RustWeek: `match_normalize_trait_ref` could be using `DeepRejectCtxt` to exit early as an optimisation for projection candidates, like is done with param candidates. r? `@lcnr` cc `@oli-obk`
2025-05-15Rollup merge of #140947 - compiler-errors:pending-norm, r=lcnrMatthias Krüger-4/+24
Flush errors before deep normalize in `dropck_outlives` Deep normalization doesn't allow the ocx to have pending obligations, so process them before deeply normalizing. Fixes https://github.com/rust-lang/rust/issues/140931 Fixes https://github.com/rust-lang/rust/issues/140462
2025-05-15Rollup merge of #140712 - lcnr:normalization-gat-args, r=compiler-errorsMatthias Krüger-3/+4
normalization: avoid incompletely constraining GAT args We need to copy the behavior of #125214 in the new solver. This fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/202 which seems to be the cause of the regression in `deptypes`. r? ```@compiler-errors```
2025-05-15Auto merge of #136988 - compiler-errors:impossible_predicates, r=lcnrbors-9/+5
Use the new solver in the `impossible_predicates` The old solver is unsound for many reasons. One of which was weaponized by `@lcnr` in #140212, where the old solver was incompletely considering a dyn vtable method to be impossible and replacing its vtable entry with a null value. This null function could be called post-mono. The new solver is expected to be less incomplete due to its correct handling of higher-ranked aliases in relate. This PR switches the `impossible_predicates` query to use the new solver, which patches this UB. r? lcnr
2025-05-13Auto merge of #140887 - pietroalbini:pa-bootstrap-update, r=compiler-errorsbors-1/+0
Stage0 bootstrap update This PR [follows the release process](https://forge.rust-lang.org/release/process.html#master-bootstrap-update-tuesday) to update the stage0 compiler. The only thing of note is https://github.com/rust-lang/rust/commit/58651d1b316e268fac2100c3ae37bb502a36b8ba, which was flagged by clippy as a correctness fix. I think allowing that lint in our case makes sense, but it's worth to have a second pair of eyes on it. r? `@Mark-Simulacrum`
2025-05-13Expect deep norm to fail if query norm failedMichael Goulet-5/+17
2025-05-13trait_sel: deep reject `match_normalize_trait_ref`David Wood-2/+8
Spotted during an in-person review of unrelated changes, `match_normalize_trait_ref` could be using `DeepRejectCtxt` to exit early as an optimisation for prejection candidates, like is done in param candidates.
2025-05-12Flush errors before deep normalize in dropck_outlivesMichael Goulet-0/+8
2025-05-12Fix typosomahs-1/+1
2025-05-12update cfg(bootstrap)Pietro Albini-1/+0
2025-05-09Disarm `time` bomb (diagnostics)Jieyou Xu-46/+2
Revert "Rollup merge of #129343 - estebank:time-version, r=jieyouxu" This reverts commit 26f75a65d70773e4520634b9f6599ddf08c499e6, reversing changes made to 2572e0e8c9d5d671eccb1d5791e55c929c4720f4. Imports are modified to fix merge conflicts and remove unused ones.
2025-05-08normalization: avoid incompletely constraining GAT argslcnr-3/+4
2025-05-08Rollup merge of #140736 - xizheyin:issue-140166, r=petrochenkovMatthias Krüger-0/+6
trait selection: check `&` before suggest remove deref FIxes #140166 r? compiler
2025-05-08Rollup merge of #140711 - compiler-errors:combine-maybes, r=lcnrMatthias Krüger-2/+8
Do not discard constraints on overflow if there was candidate ambiguity Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/201. There's a pretty chunky justification in the test. r? lcnr
2025-05-08Rollup merge of #140641 - lcnr:opaque-type-storage-entries, r=compiler-errorsMatthias Krüger-47/+0
detect additional uses of opaques after writeback Based on #140607. It's a lot harder to encounter in practice than I though :sweat_smile: :grin: I've still added it with the expectation that somebody will encounter it at some point. Also modifies the `EvalCtxt` to use the same impl to detect newly added opaque types. r? ``@compiler-errors``
2025-05-07opaque_type_storage to InferCtxtLikelcnr-47/+0
2025-05-07Use MaybeCause::or to allow constraints from overflows if they are combined ↵Michael Goulet-2/+8
with ambiguity
2025-05-07Require T: TypeFoldable in Binder<T> visitMichael Goulet-2/+2
2025-05-07Check `&` before suggest remove deref when trait_selectionxizheyin-0/+6
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-07Auto merge of #137995 - hkBst:parse_format_reuse_unescape, r=nnethercotebors-9/+8
Remove duplicate impl of string unescape from parse_format r? `@nnethercote`
2025-05-06support duplicates in the opaque_types_storagelcnr-5/+32
2025-05-06Remove duplicate impl of string unescapeMarijn Schouten-9/+8
2025-05-05Rollup merge of #140605 - lcnr:defer-opaque-type-error, r=compiler-errorsGuillaume Gomez-29/+54
`fn check_opaque_type_parameter_valid` defer error Will be used in #139587 to silence opaque type errors if there are other borrowck failures. I think it can be merged separately. r? `@compiler-errors`
2025-05-05Rollup merge of #140559 - rperier:type-ir-to-type-middle, r=compiler-errorsGuillaume Gomez-3/+3
Removing rustc_type_ir in the rustc_infer codebase cc #138449 This is a second refactoring of rustc_type_ir to use rustc_middle instead, this time that's for rustc_infer
2025-05-05Rollup merge of #140307 - mejrs:condition_parser, r=nnethercoteTrevor Gross-104/+323
Refactor rustc_on_unimplemented's filter parser Followup to https://github.com/rust-lang/rust/pull/139091; I plan on moving most of this code into `rustc_attr_parsing` at some point, but want to land this separately first. I have taken care to preserve the original behavior as much as I could: - All but one of the new error variants are replacements for the ones originally emitted by the cfg parsing machinery; so these errors are not "new". - the `InvalidFlag` variant is new, this PR turns this (from being ignored and silently doing nothing) into an error: ```rust #[rustc_on_unimplemented(on(something, message = "y"))] //~^ ERROR invalid boolean flag //~^^ NOTE expected one of `crate_local`, `direct` or `from_desugaring`, not `something` trait InvalidFlag {} ``` This does not occur anywhere except in this test. I couldn't find a way that I liked to keep allowing this or to do nothing, erroring was the cleanest solution. - There are a bunch of FIXME throughout this and the previous PR, I plan on addressing those in follow up prs.. Finally, this gets rid of the "longest" dependency in rustc: ![image](https://github.com/user-attachments/assets/3c3eb3a0-b7b3-40d9-aada-a752e28c8678)
2025-05-04Auto merge of #140549 - BoxyUwU:proper_const_norm, r=lcnrbors-255/+324
Set groundwork for proper const normalization r? lcnr Updates a lot of our normalization/alias infrastructure to be setup to handle mgca aliases and normalization once const items are represented more like aliases than bodies. Inherent associated consts are still super busted, I didn't update the assertions that IACs the right arg setup because that winds up being somewhat involved to do *before* proper support for normalizing const aliases is implemented. I dont *intend* for this to have any effect on stable. We continue normalizing via ctfe on stable and the codepaths in `project` for consts should only be reachable with mgca or ace.
2025-05-03`fn check_opaque_type_parameter_valid` defer errorlcnr-29/+54
2025-05-02Refactor rustc_on_unimplemented's filter parsermejrs-104/+323
2025-05-02Rollup merge of #140519 - compiler-errors:name-based-comparison, r=oli-obkMatthias Krüger-20/+22
Use select in projection lookup in `report_projection_error` Using `for_each_relevant_impl` doesn't actually select the correct impl; we can use `select` here to actually get the correct impl with certainty. Follow-up to https://github.com/rust-lang/rust/pull/140278. r? oli-obk
2025-05-02Use less rustc_type_ir in the compiler codebaseRomain Perier-3/+3
This commit does the following: - Replaces use of rustc_type_ir by rustc_middle in rustc_infer. - The DelayedMap type is exposed by rustc_middle so everything can be accessed through rustc_middle in a coherent manner. - API-layer traits, like InferCtxtLike, Interner or inherent::* must be accessed via rustc_type_ir, not rustc_middle::ty. For this reason these are not reexported by rustc_middle::ty. - Replaces use of ty::Interner by rustc_type_ir::Interner in rustc_trait_selection
2025-05-01Set groundwork for proper const normalizationBoxy-159/+230
2025-05-01No-op split into sub functionsBoxy-164/+162