Normalize before computing ConstArgHasType goal in new solver#142806
Normalize before computing ConstArgHasType goal in new solver#142806bors merged 1 commit intorust-lang:masterfrom
Conversation
|
This PR changes a file inside |
This comment has been minimized.
This comment has been minimized.
c6112e1 to
46ff4fa
Compare
This comment has been minimized.
This comment has been minimized.
46ff4fa to
87c8aa1
Compare
| goal: Goal<I, (I::Const, I::Ty)>, | ||
| ) -> QueryResult<I> { | ||
| let (ct, ty) = goal.predicate; | ||
| let ct = self.structurally_normalize_const(goal.param_env, ct)?; |
There was a problem hiding this comment.
not sure if you want boxy to review this, but it feels very much correct to require normalizing before matching on the const kind here :> it's what we do for all other matches on kind as well.
so r=me here
|
seems reasonable to me to normalize here. makes a nice property hold. definitely dont want to add a |
|
@bors r=lcnr,BoxyUwU |
|
I guess more thought: I like to think of it kind of like if const items had |
Rollup of 9 pull requests Successful merges: - #139858 (New const traits syntax) - #140809 (Reduce special casing for the panic runtime) - #142730 (suggest declaring modules when file found but module not defined) - #142806 (Normalize before computing ConstArgHasType goal in new solver) - #143046 (const validation: properly ignore zero-sized UnsafeCell) - #143092 (const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology) - #143096 (tag_for_variant: properly pass TypingEnv) - #143104 (hir_analysis: prohibit `dyn PointeeSized`) - #143106 (gce: don't ICE on non-local const) Failed merges: - #143036 (Remove support for `dyn*` from the compiler) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #142806 - compiler-errors:norm-ct-has-ty, r=lcnr,BoxyUwU Normalize before computing ConstArgHasType goal in new solver This is a fix for #139905. See the description I left in the test. I chose to fix this by normalizing the type before matching on its `.kind()` in `compute_const_arg_has_type_goal` (since it feels somewhat consistent with how we normalize types before assembling their candidates, for example); however, there are several other solutions that come to mind for fixing this ICE: 1. (this solution) 2. Giving `ConstKind::Error` a proper type, like `ConstKind::Value`, so that consts don't go from failing to passing `ConstArgHasType` goals after normalization (i.e. `UNEVALUATED` would normalize into a `ConstKind::Error(_, bool)` type rather than losing its type altogether). 3. Just suppressing the errors and accepting the fact that goals can go from fail->pass after normalization. Thoughts? Happy to discuss this fix further. r? `@BoxyUwU`
Rollup of 9 pull requests Successful merges: - rust-lang/rust#139858 (New const traits syntax) - rust-lang/rust#140809 (Reduce special casing for the panic runtime) - rust-lang/rust#142730 (suggest declaring modules when file found but module not defined) - rust-lang/rust#142806 (Normalize before computing ConstArgHasType goal in new solver) - rust-lang/rust#143046 (const validation: properly ignore zero-sized UnsafeCell) - rust-lang/rust#143092 (const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology) - rust-lang/rust#143096 (tag_for_variant: properly pass TypingEnv) - rust-lang/rust#143104 (hir_analysis: prohibit `dyn PointeeSized`) - rust-lang/rust#143106 (gce: don't ICE on non-local const) Failed merges: - rust-lang/rust#143036 (Remove support for `dyn*` from the compiler) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - rust-lang/rust#139858 (New const traits syntax) - rust-lang/rust#140809 (Reduce special casing for the panic runtime) - rust-lang/rust#142730 (suggest declaring modules when file found but module not defined) - rust-lang/rust#142806 (Normalize before computing ConstArgHasType goal in new solver) - rust-lang/rust#143046 (const validation: properly ignore zero-sized UnsafeCell) - rust-lang/rust#143092 (const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology) - rust-lang/rust#143096 (tag_for_variant: properly pass TypingEnv) - rust-lang/rust#143104 (hir_analysis: prohibit `dyn PointeeSized`) - rust-lang/rust#143106 (gce: don't ICE on non-local const) Failed merges: - rust-lang/rust#143036 (Remove support for `dyn*` from the compiler) r? `@ghost` `@rustbot` modify labels: rollup
This is a fix for #139905. See the description I left in the test.
I chose to fix this by normalizing the type before matching on its
.kind()incompute_const_arg_has_type_goal(since it feels somewhat consistent with how we normalize types before assembling their candidates, for example); however, there are several other solutions that come to mind for fixing this ICE:ConstKind::Errora proper type, likeConstKind::Value, so that consts don't go from failing to passingConstArgHasTypegoals after normalization (i.e.UNEVALUATEDwould normalize into aConstKind::Error(_, bool)type rather than losing its type altogether).Thoughts? Happy to discuss this fix further.
r? @BoxyUwU