Commit graph

161 commits

Author SHA1 Message Date
Michael Goulet
3f8ce7c973 Do not assume child bound assumptions for rigid alias 2025-01-28 19:08:50 +00:00
Matthias Krüger
dafc861aa3
Rollup merge of #135766 - lcnr:candidate-assembly-3, r=compiler-errors
handle global trait bounds defining assoc types

This also fixes the compare-mode for
- tests/ui/coherence/coherent-due-to-fulfill.rs
- tests/ui/codegen/mono-impossible-2.rs
- tests/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs
- tests/ui/nll/issue-61320-normalize.rs

I first considered the alternative to always prefer where-bounds during normalization, regardless of how the trait goal has been proven by changing `fn merge_candidates` instead. ecda83b30f/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs (L785)

This approach is more restrictive than behavior of the old solver to avoid mismatches between trait and normalization goals. This may be breaking in case the where-bound adds unnecessary region constraints and we currently don't ever try to normalize an associated type. I would like to detect these cases and change the approach to exactly match the old solver if required. I want to minimize cases where attempting to normalize in more places causes code to break.

r? `@compiler-errors`
2025-01-23 19:54:25 +01:00
Boxy
513bfaa8bc Use structurally_normalize instead of manual normalizes-to goals 2025-01-22 07:04:53 +00:00
lcnr
09b784fac5 handle global trait bounds defining assoc type 2025-01-20 18:51:45 +01:00
lcnr
7171fee4ec remove unnecessary collection 2025-01-20 18:51:45 +01:00
Yotam Ofek
264fa0fc54 Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
Rémy Rakic
00844be421 new solver: prefer trivial builtin impls over where-clauses
for now, only builtin `Sized` impls are tracked as being `Trivial`
2025-01-17 18:50:29 +00:00
Michael Goulet
bf545ce2fe Prefer lower TraitUpcasting candidates 2025-01-14 17:59:54 +00:00
Michael Goulet
c64f859521 Implement const Destruct in old solver 2025-01-08 18:14:58 +00:00
Michael Goulet
ebdf19a8bb Recurse on GAT where clauses in fulfillment error proof tree visitor 2025-01-06 17:58:42 +00:00
Michael Goulet
2be9ffc1af Add derived causes for host effect predicates 2025-01-06 17:49:46 +00:00
Michael Goulet
7143ef6550 Also in the new solver 2025-01-03 05:22:14 +00:00
Michael Goulet
9a1c5eb5b3 Begin to implement type system layer of unsafe binders 2024-12-22 21:57:57 +00:00
lcnr
d5a0c5cfdb update new solver candidate assembly 2024-12-18 16:35:05 +01:00
lcnr
38ce73145c canonicalizer: keep 'static in the param_env 2024-12-18 16:18:01 +01:00
Michael Goulet
ec68498317 Rename projection_def_id to item_def_id 2024-12-11 00:59:43 +00:00
Jack Wrenn
a122dde217 do not implement unsafe auto traits for types with unsafe fields
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-12-05 23:52:21 +00:00
lcnr
34a8c2dbba support revealing defined opaque post borrowck 2024-11-28 10:40:58 +01:00
lcnr
a8c8ab1acd remove remaining references to Reveal 2024-11-23 13:52:56 +01:00
lcnr
319843d8cd no more Reveal :( 2024-11-23 13:52:54 +01:00
Michael Goulet
59408add4d Implement ~const Destruct in new solver 2024-11-22 16:54:40 +00:00
Matthias Krüger
920092531f
Rollup merge of #133218 - compiler-errors:const-opaque, r=fee1-dead
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-21 07:56:13 +01:00
Michael Goulet
06e66d78c3 Rip out built-in PointerLike impl 2024-11-20 16:13:57 +00:00
Michael Goulet
def7ed08e7 Implement ~const Fn trait goals in the new solver 2024-11-19 21:22:17 +00:00
Michael Goulet
588c4c45d5 Rename implied_const_bounds to explicit_implied_const_bounds 2024-11-19 20:30:58 +00:00
lcnr
9cba14b95b use TypingEnv when no infcx is available
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-18 10:38:56 +01:00
Boxy
bea0148ac6 Consolidate type system const evaluation under traits::evaluate_const
mew
2024-11-12 02:54:03 +00:00
clubby789
b480f0f224 Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
Michael Goulet
6b96103bf3 Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
Michael Goulet
802f3a78a6 Merge HostPolarity and BoundConstness 2024-10-30 16:23:16 +00:00
lcnr
ce22ccb552 remove outdated debug_assertion 2024-10-29 17:01:24 +01:00
lcnr
f51ec110a7 TypingMode 🤔 2024-10-29 17:01:24 +01:00
Michael Goulet
3bad5014c9 Add support for ~const item bounds 2024-10-24 23:43:31 +00:00
Michael Goulet
cde29b9ec9 Implement const effect predicate in new solver 2024-10-24 09:46:36 +00:00
Michael Goulet
a16d491054 Remove associated type based effects logic 2024-10-24 09:46:36 +00:00
lcnr
d6ce2bd1de remove unused field 2024-10-22 08:30:09 +02:00
lcnr
25365aeacf fix typo 2024-10-22 08:20:23 +02:00
lcnr
919b61a6f4 don't bail when encountering many placeholders 2024-10-21 17:51:43 +02:00
lcnr
b64b25b99e normalizes-to disable infer var check 2024-10-21 16:25:42 +02:00
Michael Goulet
9453d2cfeb Fix transmute goal 2024-10-19 18:07:35 +00:00
Matthias Krüger
13b398401f
Rollup merge of #131857 - WaffleLapkin:dyn-drop-principal-3, r=compiler-errors
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-18 06:59:07 +02:00
Matthias Krüger
405eb4178e
Rollup merge of #131825 - lcnr:probe-no-more-leak-2, r=compiler-errors
SolverDelegate add assoc type for Infcx

makes writing trait bounds on it a lot nicer going forward.

r? `@compiler-errors`
2024-10-17 20:47:31 +02:00
Michael Goulet
e3800a1a04 Allow dropping dyn principal 2024-10-17 20:43:31 +02:00
lcnr
c45073ec3e SolverDelegate add assoc type for Infcx 2024-10-17 11:38:40 +02:00
lcnr
3360c1773a move defining_opaque_types out of Canonical 2024-10-17 10:22:52 +02:00
bors
7342830c05 Auto merge of #131792 - matthiaskrgr:rollup-480nwg4, r=matthiaskrgr
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-16 17:58:25 +00:00
Josh Stone
acb09bf741 update bootstrap configs 2024-10-15 20:30:23 -07:00
Michael Goulet
0ead25c4a9 Register a dummy candidate for failed structural normalization during candiate assembly 2024-10-15 20:42:17 -04:00
Michael Goulet
8528387743 Be better at reporting alias errors 2024-10-15 20:42:17 -04:00
Michael Goulet
fd2038d344 Make sure the alias is actually rigid 2024-10-15 20:42:17 -04:00