summary refs log tree commit diff
path: root/compiler/rustc_next_trait_solver/src
AgeCommit message (Collapse)AuthorLines
2024-12-22Begin to implement type system layer of unsafe bindersMichael Goulet-3/+37
2024-12-18update new solver candidate assemblylcnr-89/+180
2024-12-18canonicalizer: keep 'static in the param_envlcnr-40/+102
2024-12-11Rename projection_def_id to item_def_idMichael Goulet-1/+1
2024-12-05do not implement unsafe auto traits for types with unsafe fieldsJack Wrenn-0/+8
If a type has unsafe fields, its safety invariants are not simply the conjunction of its field types' safety invariants. Consequently, it's invalid to reason about the safety properties of these types in a purely structural manner — i.e., the manner in which `auto` traits are implemented. Makes progress towards #132922.
2024-11-28support revealing defined opaque post borrowcklcnr-33/+53
2024-11-23remove remaining references to `Reveal`lcnr-2/+1
2024-11-23no more Reveal :(lcnr-13/+9
2024-11-22Implement ~const Destruct in new solverMichael Goulet-4/+97
2024-11-21Rollup merge of #133218 - compiler-errors:const-opaque, r=fee1-deadMatthias Krüger-5/+2
Implement `~const` item bounds in RPIT an RPIT in a `const fn` is allowed to be conditionally const itself :) r? fee1-dead or reroll
2024-11-20Rip out built-in PointerLike implMichael Goulet-50/+0
2024-11-19Implement ~const Fn trait goals in the new solverMichael Goulet-17/+128
2024-11-19Rename implied_const_bounds to explicit_implied_const_boundsMichael Goulet-5/+2
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-1/+5
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-12Consolidate type system const evaluation under `traits::evaluate_const`Boxy-8/+8
mew
2024-11-03Rename the FIXMEs, remove a few that dont matter anymoreMichael Goulet-3/+1
2024-10-30Merge HostPolarity and BoundConstnessMichael Goulet-4/+7
2024-10-29remove outdated debug_assertionlcnr-3/+0
2024-10-29TypingMode :thinking:lcnr-87/+73
2024-10-24Add support for ~const item boundsMichael Goulet-1/+77
2024-10-24Implement const effect predicate in new solverMichael Goulet-0/+300
2024-10-24Remove associated type based effects logicMichael Goulet-121/+0
2024-10-22remove unused fieldlcnr-11/+7
2024-10-22fix typolcnr-1/+1
2024-10-21don't bail when encountering many placeholderslcnr-1/+2
2024-10-21normalizes-to disable infer var checklcnr-7/+16
2024-10-19Fix transmute goalMichael Goulet-1/+37
2024-10-18Rollup merge of #131857 - WaffleLapkin:dyn-drop-principal-3, r=compiler-errorsMatthias Krüger-1/+2
Allow dropping dyn principal Revival of #126660, which was a revival of #114679. Fixes #126313. Allows dropping principal when coercing trait objects, e.g. `dyn Debug + Send` -> `dyn Send`. cc `@compiler-errors` `@Jules-Bertholet` r? `@lcnr`
2024-10-17Rollup merge of #131825 - lcnr:probe-no-more-leak-2, r=compiler-errorsMatthias Krüger-3/+2
SolverDelegate add assoc type for Infcx makes writing trait bounds on it a lot nicer going forward. r? `@compiler-errors`
2024-10-17Allow dropping dyn principalMichael Goulet-1/+2
2024-10-17SolverDelegate add assoc type for Infcxlcnr-3/+2
2024-10-17move `defining_opaque_types` out of `Canonical`lcnr-11/+18
2024-10-16Auto merge of #131792 - matthiaskrgr:rollup-480nwg4, r=matthiaskrgrbors-6/+79
Rollup of 8 pull requests Successful merges: - #130822 (Add `from_ref` and `from_mut` constructors to `core::ptr::NonNull`.) - #131381 (Implement edition 2024 match ergonomics restrictions) - #131594 (rustdoc: Rename "object safe" to "dyn compatible") - #131686 (Add fast-path when computing the default visibility) - #131699 (Try to improve error messages involving aliases in the solver) - #131757 (Ignore lint-non-snake-case-crate#proc_macro_ on targets without unwind) - #131783 (Fix explicit_iter_loop in rustc_serialize) - #131788 (Fix mismatched quotation mark) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-15update bootstrap configsJosh Stone-1/+1
2024-10-15Register a dummy candidate for failed structural normalization during ↵Michael Goulet-0/+20
candiate assembly
2024-10-15Be better at reporting alias errorsMichael Goulet-9/+13
2024-10-15Make sure the alias is actually rigidMichael Goulet-2/+51
2024-10-12Shallowly match opaque key in storageMichael Goulet-43/+42
2024-10-11remove outdated FIXMEslcnr-15/+4
2024-10-10Auto merge of #131263 - compiler-errors:solver-relating, r=lcnrbors-51/+3
Introduce SolverRelating type relation to the new solver Redux of #128744. Splits out relate for the new solver so that implementors don't need to implement it themselves. r? lcnr
2024-10-10impossible obligations check fast pathlcnr-21/+62
2024-10-10Use SolverRelating in favor of TypeRelating in the old solver where possibleMichael Goulet-1/+1
2024-10-10Use SolverRelating in new solverMichael Goulet-0/+2
2024-10-10Uplift super_combineMichael Goulet-50/+0
2024-10-02Auto merge of #130821 - lcnr:nalgebra-hang-2, r=compiler-errorsbors-124/+190
add caching to most type folders, rm region uniquification Fixes the new minimization of the hang in nalgebra and nalgebra itself :3 this is a bit iffy, especially the cache in `TypeRelating`. I believe all the caches are correct, but it definitely adds some non-local complexity in places. The first commit removes region uniquification, reintroducing the ICE from https://github.com/rust-lang/trait-system-refactor-initiative/issues/27. This does not affect coherence and I would like to fix this by introducing OR-region constraints r? `@compiler-errors`
2024-10-02reviewlcnr-12/+17
2024-10-01add caches to multiple type folderslcnr-15/+47
2024-09-30canonicalizer: rm region uniquification, add cachinglcnr-109/+138
2024-09-28Rollup merge of #130866 - compiler-errors:dyn-instantiate-binder, r=lcnrMatthias Krüger-27/+38
Allow instantiating object trait binder when upcasting This PR fixes two bugs (that probably need an FCP). ### We use equality rather than subtyping for upcasting dyn conversions This code should be valid: ```rust #![feature(trait_upcasting)] trait Foo: for<'h> Bar<'h> {} trait Bar<'a> {} fn foo(x: &dyn Foo) { let y: &dyn Bar<'static> = x; } ``` But instead: ``` error[E0308]: mismatched types --> src/lib.rs:7:32 | 7 | let y: &dyn Bar<'static> = x; | ^ one type is more general than the other | = note: expected existential trait ref `for<'h> Bar<'h>` found existential trait ref `Bar<'_>` ``` And so should this: ```rust #![feature(trait_upcasting)] fn foo(x: &dyn for<'h> Fn(&'h ())) { let y: &dyn FnOnce(&'static ()) = x; } ``` But instead: ``` error[E0308]: mismatched types --> src/lib.rs:4:39 | 4 | let y: &dyn FnOnce(&'static ()) = x; | ^ one type is more general than the other | = note: expected existential trait ref `for<'h> FnOnce<(&'h (),)>` found existential trait ref `FnOnce<(&(),)>` ``` Specifically, both of these fail because we use *equality* when comparing the supertrait to the *target* of the unsize goal. For the first example, since our supertrait is `for<'h> Bar<'h>` but our target is `Bar<'static>`, there's a higher-ranked type mismatch even though we *should* be able to instantiate that supertrait binder when upcasting. Similarly for the second example. ### New solver uses equality rather than subtyping for no-op (i.e. non-upcasting) dyn conversions This code should be valid in the new solver, like it is with the old solver: ```rust // -Znext-solver fn foo<'a>(x: &mut for<'h> dyn Fn(&'h ())) { let _: &mut dyn Fn(&'a ()) = x; } ``` But instead: ``` error: lifetime may not live long enough --> <source>:2:11 | 1 | fn foo<'a>(x: &mut dyn for<'h> Fn(&'h ())) { | -- lifetime `'a` defined here 2 | let _: &mut dyn Fn(&'a ()) = x; | ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` | = note: requirement occurs because of a mutable reference to `dyn Fn(&())` ``` Specifically, this fails because we try to coerce `&mut dyn for<'h> Fn(&'h ())` to `&mut dyn Fn(&'a ())`, which registers an `dyn for<'h> Fn(&'h ()): dyn Fn(&'a ())` goal. This fails because the new solver uses *equating* rather than *subtyping* in `Unsize` goals. This is *mostly* not a problem... You may wonder why the same code passes on the new solver for immutable references: ``` // -Znext-solver fn foo<'a>(x: &dyn Fn(&())) { let _: &dyn Fn(&'a ()) = x; // works } ``` That's because in this case, we first try to coerce via `Unsize`, but due to the leak check the goal fails. Then, later in coercion, we fall back to a simple subtyping operation, which *does* work. Since `&T` is covariant over `T`, but `&mut T` is invariant, that's where the discrepancy between these two examples crops up. --- r? lcnr or reassign :D
2024-09-27Instantiate binders when checking supertrait upcastingMichael Goulet-27/+38