summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/predicate.rs
AgeCommit message (Collapse)AuthorLines
2024-10-24Implement const effect predicate in new solverMichael Goulet-0/+4
2024-10-04Elaborate supertrait span correctly to label the error betterMichael Goulet-0/+4
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-4/+4
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-08Rollup merge of #120248 - WaffleLapkin:bonk-ptr-object-casts, ↵Matthias Krüger-0/+8
r=compiler-errors,oli-obk,lnicola Make casts of pointers to trait objects stricter This is an attempt to `fix` https://github.com/rust-lang/rust/issues/120222 and https://github.com/rust-lang/rust/issues/120217. This is done by adding restrictions on casting pointers to trait objects. Before this PR the rules were as follows: > When casting `*const X<dyn A>` -> `*const Y<dyn B>`, principal traits in `A` and `B` must refer to the same trait definition (or no trait). With this PR the rules are changed to > When casting `*const X<dyn Src>` -> `*const Y<dyn Dst>` > - if `Dst` has a principal trait `DstP`, > - `Src` must have a principal trait `SrcP` > - `dyn SrcP` and `dyn DstP` must be the same type (modulo the trait object lifetime, `dyn T+'a` -> `dyn T+'b` is allowed) > - Auto traits in `Dst` must be a subset of auto traits in `Src` > - Not adhering to this is currently a FCW (warn-by-default + `FutureReleaseErrorReportInDeps`), instead of an error > - if `Src` has a principal trait `Dst` must as well > - this restriction will be removed in a follow up PR This ensures that 1. Principal trait's generic arguments match (no `*const dyn Tr<A>` -> `*const dyn Tr<B>` casts, which are a problem for [#120222](https://github.com/rust-lang/rust/issues/120222)) 2. Principal trait's lifetime arguments match (no `*const dyn Tr<'a>` -> `*const dyn Tr<'b>` casts, which are a problem for [#120217](https://github.com/rust-lang/rust/issues/120217)) 3. No auto traits can be _added_ (this is a problem for arbitrary self types, see [this comment](https://github.com/rust-lang/rust/pull/120248#discussion_r1463835350)) Some notes: - We only care about the metadata/last field, so you can still cast `*const dyn T` to `*const WithHeader<dyn T>`, etc - The lifetime of the trait object itself (`dyn A + 'lt`) is not checked, so you can still cast `*mut FnOnce() + '_` to `*mut FnOnce() + 'static`, etc - This feels fishy, but I couldn't come up with a reason it must be checked The diagnostics are currently not great, to say the least, but as far as I can tell this correctly fixes the issues. cc `@oli-obk` `@compiler-errors` `@lcnr`
2024-07-07Uplift elaborationMichael Goulet-1/+9
2024-07-04Align the changes to the lang decisionMaybe Lapkin-0/+8
2024-06-18Uplift the new trait solverMichael Goulet-6/+36
2024-06-13Address nitsMichael Goulet-0/+4
- Remove the ValuePairs glob import - Make DummyPairs -> ValuePairs::Dummy and make it bug more - Fix WC - Make interner return `impl IntoIterator`s
2024-06-13Finish uplifting all of structural_traitsMichael Goulet-0/+9
2024-06-12Stop passing traitref/traitpredicate by refMichael Goulet-1/+1
2024-05-28eagerly normalize when adding goalslcnr-6/+3
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-05-21Uplift OutlivesPredicate, remove a bunch of unnecessary associated types ↵Michael Goulet-21/+12
from Interner
2024-05-21Uplift binderMichael Goulet-136/+17
2024-05-19Make search graph generic over internerMichael Goulet-1/+5
2024-05-18Uplift GenericArgKind, CanonicalVarValues, QueryInputMichael Goulet-1/+0
and make NestedGoals generic
2024-05-17to_opt_poly_X_pred -> as_X_clauseMichael Goulet-2/+2
2024-05-16Uplift Goal to rustc_type_irMichael Goulet-50/+28
2024-05-16Make impls UpcastFrom, implement Upcast for UpcastFromMichael Goulet-89/+91
2024-05-16Make P parameter explicitMichael Goulet-16/+16
2024-05-16Rename ToPredicate for UpcastMichael Goulet-73/+73
2024-05-13Uplift AliasTyMichael Goulet-0/+1
2024-05-13split out AliasTy -> AliasTermMichael Goulet-3/+3
2024-05-11Apply nits, uplift ExistentialPredicate tooMichael Goulet-52/+28
2024-05-11Uplift `NormalizesTo`, `CoercePredicate`, and `SubtypePredicate`Michael Goulet-49/+11
2024-05-11Uplift `ExistentialTraitRef`, `ExistentialProjection`, `ProjectionPredicate`Michael Goulet-140/+7
2024-05-11Uplift `TraitPredicate`Michael Goulet-29/+2
2024-05-10Apply nits, make some bounds into supertraits on inherent traitsMichael Goulet-0/+2
2024-05-10Lift `TraitRef` into `rustc_type_ir`Michael Goulet-80/+4
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-2/+2
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-03-27Remove `Ord` from `Ty`, `Const`, and `Region`Oli Scherer-4/+4
2024-03-22Split out ImplPolarity and PredicatePolarityMichael Goulet-6/+6
2024-03-11Rename `IntoDiagnosticArg` as `IntoDiagArg`.Nicholas Nethercote-11/+11
Also rename `into_diagnostic_arg` as `into_diag_arg`, and `NotIntoDiagnosticArg` as `NotInotDiagArg`.
2024-02-28Rename `DiagnosticArg{,Map,Name,Value}` as `DiagArg{,Map,Name,Value}`.Nicholas Nethercote-7/+7
2024-02-13Uplift TypeVisitableExt into rustc_type_irMichael Goulet-0/+12
2024-02-12Dejargnonize substShoyu Vanilla-15/+15
2024-01-30Move predicate, region, and const stuff into their own modules in middleMichael Goulet-0/+1062