summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2025-04-24Do not mix normalized and unnormalized caller bounds when constructing ↵Michael Goulet-13/+22
param-env for receiver_is_dispatchable (cherry picked from commit 4f2baaa9c6b75d4267eea9e1096339d56d380615)
2025-03-27Auto merge of #139012 - Zalathar:rollup-qgt5yfo, r=Zalatharbors-2/+4
Rollup of 10 pull requests Successful merges: - #130883 (Add environment variable query) - #138624 (Add mipsel maintainer) - #138672 (Avoiding calling queries when collecting active queries) - #138935 (Update wg-prio triagebot config) - #138946 (Un-bury chapters from the chapter list in rustc book) - #138964 (Implement lint against using Interner and InferCtxtLike in random compiler crates) - #138977 (Don't deaggregate InvocationParent just to reaggregate it again) - #138980 (Collect items referenced from var_debug_info) - #138985 (Use the correct binder scope for elided lifetimes in assoc consts) - #138987 (Always emit `native-static-libs` note, even if it is empty) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-26Stop using Interner in the compiler randomlyMichael Goulet-2/+4
2025-03-24Instantiate binder before registering nested obligations for auto/built-in ↵Michael Goulet-32/+16
traits
2025-03-23Obligation::as_goalMichael Goulet-1/+1
2025-03-18Remove existing AFIDT implementationMichael Goulet-89/+3
2025-03-16Suppress must_use in compiler and toolsMichael Goulet-2/+2
2025-03-15Fold visit into tyMichael Goulet-8/+9
2025-03-15Squash fold into tyMichael Goulet-10/+7
2025-03-13Auto merge of #138249 - compiler-errors:auto-self, r=lcnrbors-15/+1
Do not register `Self: AutoTrait` when confirming auto trait (in old solver) Every built-in auto impl for a trait goal like `Ty: Auto` immediately registers another obligation of `Ty: Auto` as one of its nested obligations, leading to us stressing the cycle detection machinery a lot more than we need to. This is because all traits have a `Self: Trait` predicate. To fix this, remove the call to `impl_or_trait_obligations` in `vtable_auto_impl`, since auto traits do not have where clauses. r? lcnr
2025-03-12Rollup merge of #138174 - compiler-errors:elaborate-unsize-self-pred, r=BoxyUwUMatthias Krüger-7/+12
Elaborate trait assumption in `receiver_is_dispatchable` Fixes #138172. See comment on the linked test. Probably not a fix for the general problem, bc I think this may still be incomplete for other weird `where` clauses on the receiver. But 🤷, supertraits seems like an obvious one to fix.
2025-03-11Elaborate param-env built for checking DispatchFromDyn for dyn compatMichael Goulet-7/+12
2025-03-10Remove AdtFlags::IS_ANONYMOUS and Copy/Clone condition for anonymous ADTMichael Goulet-9/+0
2025-03-09Rollup merge of #138040 - thaliaarchi:use-prelude-size-of.compiler, ↵Matthias Krüger-1/+1
r=compiler-errors compiler: Use `size_of` from the prelude instead of imported Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. Apply this change across the compiler. These functions were added to all preludes in Rust 1.80. r? ``@compiler-errors``
2025-03-09Rollup merge of #136968 - oli-obk:bye-bye, r=compiler-errorsMatthias Krüger-25/+5
Turn order dependent trait objects future incompat warning into a hard error fixes #56484 r? ``@ghost`` will FCP when we have a crater result
2025-03-09Do not register `Self: AutoTrait` when confirming auto traitMichael Goulet-15/+1
2025-03-07compiler: Use size_of from the prelude instead of importedThalia Archibald-1/+1
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-03-06Rollup merge of #137910 - compiler-errors:async-fn-goal-error, r=oli-obkMichael Goulet-1/+3
Improve error message for `AsyncFn` trait failure for RPIT Use a `WellFormedDerived` obligation cause to make sure we can turn an `AsyncFnKindHelper` trait goal into its parent `AsyncFn*` goal, then fix the logic for reporting `AsyncFn*` kind mismatches. Best reviewed without whitespace. Fixes #137905 r? oli-obk
2025-03-06Remove the `Option` part of range ends in the HIROli Scherer-1/+1
2025-03-06Avoid having to handle an `Option` in the type systemOli Scherer-6/+2
2025-03-05Rollup merge of #137728 - Darksonn:no-tuple-unsize, r=oli-obk许杰友 Jieyou Xu (Joe)-40/+2
Remove unsizing coercions for tuples See https://github.com/rust-lang/rust/issues/42877#issuecomment-2686010847 and below comments for justification. Tracking issue: #42877 Fixes: #135217
2025-03-05Rollup merge of #137633 - ↵许杰友 Jieyou Xu (Joe)-158/+58
compiler-errors:no-implied-bounds-hack-unless-bevy, r=lcnr Only use implied bounds hack if bevy, and use deeply normalize in implied bounds hack Consolidates the implied bounds computation mode into a single function, which deeply normalizes, and if it's in **compat** mode (for bevy), it extracts outlives bounds from the infcx. Previously, we were using the implied bounds compat mode in two cases: 1. During WF, if it detects `ParamSet` 2. EVERYWHERE ELSE (lol) -- e.g. borrowck, predicate entailment, etc. While I think this is fine, and the net effect was just that we emitted fewer diagnostics, it makes me uncomfortable that all crates were using the supposed "compat" code. Fixes #137767
2025-03-04Only use implied bounds hack if bevy, and use deeply normalize in implied ↵Michael Goulet-158/+58
bounds hack
2025-03-04mgca: Lower all const paths as `ConstArgKind::Path`Noah Lev-1/+7
When `#![feature(min_generic_const_args)]` is enabled, we now lower all const paths in generic arg position to `hir::ConstArgKind::Path`. We then lower assoc const paths to `ty::ConstKind::Unevaluated` since we can no longer use the anon const expression lowering machinery. In the process of implementing this, I factored out `hir_ty_lowering` code that is now shared between lowering assoc types and assoc consts. This PR also introduces a `#[type_const]` attribute for trait assoc consts that are allowed as const args. However, we still need to implement code to check that assoc const definitions satisfy `#[type_const]` if present (basically is it a const path or a monomorphic anon const).
2025-03-03Improve error message for AsyncFn trait failure for RPITMichael Goulet-1/+3
2025-03-01Rollup merge of #137822 - BoxyUwU:query_normalizer_docs, r=compiler-errorsMatthias Krüger-12/+9
Update query normalizer docs to not position it as the greatest pioneer in the space of normalization I don't think its true that we intend to replace all normalization with the query normalizer- its more likely that once the new solver is stable we can replace the query normalizer with normal normalization calls as the new solver caches much more than the old solver r? ``@compiler-errors``
2025-03-01Rollup merge of #137800 - BoxyUwU:param_env_docs, r=compiler-errorsMatthias Krüger-1/+1
Remove `ParamEnv::without_caller_bounds` This doesn't really do anything that `ParamEnv::empty` doesn't do nowadays as `ParamEnv` *only* stores caller bounds since other information has been moved out into `TypingMode` r? ```@compiler-errors``` ```@lcnr```
2025-03-01Rollup merge of #137776 - nnethercote:rustc_transmute-cleanups, r=jswrennMatthias Krüger-9/+4
Some `rustc_transmute` cleanups A number of small things that can be removed. r? ``@jswrenn``
2025-03-01Rollup merge of #137689 - compiler-errors:coroutine, r=lcnrMatthias Krüger-58/+21
Use `Binder<Vec<Ty>>` instead of `Vec<Binder<Ty>>` in both solvers for sized/auto traits/etc. It's more conceptually justified IMO, especially when binders get implications. r? lcnr
2025-02-28Update query normalizer docsBoxy-12/+9
2025-02-28reviewlcnr-3/+9
2025-02-28Remove `allow(unused_variables)` for `rustc_transmute`.Nicholas Nethercote-8/+3
This was hiding some genuine sins, including unused arguments in numerous functions/methods (incl. trait methods), and some unnecessary computation.
2025-02-28Remove `rustc_transmute`'s dependence on `rustc_infer`.Nicholas Nethercote-1/+1
`TransmuteTypeEnv` only needs a `TyCtxt`, not an `InferCtxt`.
2025-02-27Delete tuple unsizingAlice Ryhl-40/+2
2025-02-26Remove `ParamEnv::without_caller_bounds`Boxy-1/+1
2025-02-26Use bound_coroutine_witnesses in old solverMichael Goulet-58/+21
2025-02-24Remove dyn_compatible_for_dispatchMichael Goulet-25/+12
2025-02-24trait_sel: resolve vars in host effectsDavid Wood-0/+2
In the standard library, the `Extend` impl for `Iterator` (specialised with `TrustedLen`) has a parameter which is constrained by a projection predicate. This projection predicate provides a value for an inference variable but host effect evaluation wasn't resolving variables first. Adding the extra resolve can the number of errors in some tests when they gain host effect predicates, but this is not unexpected as calls to `resolve_vars_if_possible` can cause more error tainting to happen. Co-authored-by: Boxy <rust@boxyuwu.dev>
2025-02-22Greatly simplify lifetime captures in edition 2024Michael Goulet-10/+6
2025-02-22Fix binding mode problemsMichael Goulet-2/+2
2025-02-20Turn order dependent trait objects future incompat warning into a hard errorOli Scherer-25/+5
2025-02-17Clean up dropck code a bitMatthew Jasper-35/+21
- Remove `Result` that couldn't be Err on valid compilation. - Always compute errors on failure.
2025-02-17Report dropck normalization errors in borrowckMatthew Jasper-9/+42
HIR type checking no longer runs dropck, so we may get new errors when we run it in borrowck. If this happens then rerun the query in a local infcx and report errors for it.
2025-02-17Move some `Map` methods onto `TyCtxt`.Nicholas Nethercote-8/+7
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
2025-02-15Ignore Self in bounds check for associated types with Self:SizedMichael Goulet-0/+3
2025-02-13Rollup merge of #136951 - compiler-errors:clause-binder, r=lqdJubilee-2/+2
Use the right binder for rebinding `PolyTraitRef` Fixes #136940 I committed a slightly different test which still demonstrates the issue.
2025-02-13Use BikeshedGuaranteedNotDrop in unsafe binder type WF tooMichael Goulet-1/+4
2025-02-13Implement and use BikeshedGuaranteedNoDrop for union/unsafe field validityMichael Goulet-1/+143
2025-02-12Use the right binder for rebinding PolyTraitRefMichael Goulet-2/+2
2025-02-12Rollup merge of #136838 - compiler-errors:escaping-unsize, r=fmeaseGuillaume Gomez-2/+3
Check whole `Unsize` predicate for escaping bound vars Fixes #136799