Replace infers and non-rigid aliases with Ty/Const::Error if param env normalization fails - #160856
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Replace infers and non-rigid aliases with `Ty/Const::Error` if param env normalization fails
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (63c3ea0): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 1.4%, secondary 0.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 455.179s -> 456.527s (0.30%) |
| _ => ty, | ||
| } | ||
| }, | ||
| lt_op: |lt| lt, |
There was a problem hiding this comment.
we have to deal with infer regions here, don't we? 🤔
/ does fully_resolve even make sense as an abstraction? it's a version of resolve_vars_if_possible which also looks at the region graph?
There was a problem hiding this comment.
We already replace unresolved region infers with Region::Error in fully_resolve.
it's a version of resolve_vars_if_possible which also looks at the region graph?
Yap, another difference is that it eagerly returns with error.
There was a problem hiding this comment.
doesn't that mean this incorrectly handles having both unresolved regions and an unresolved ty var? because it keeps the unresolved region
unsure when exactly fully_resolve errors here
There was a problem hiding this comment.
also, can you move these folders into a separate replace_infer_and_non_rigid_alias_with_error function or sth 🤔
There was a problem hiding this comment.
doesn't that mean this incorrectly handles having both unresolved regions and an unresolved ty var? because it keeps the unresolved region
What do you mean? fully_resolve itself would replace unresolved region and return Ok with delayed error.
unsure when exactly fully_resolve errors here
Yeah, it's not obvious.
It errors when the clauses contain ty vars or const vars which would happen if we don't have normalization failure but have ill-formed impls like impl<T> Trait for () where the generic parameter is unused. I have a comment about this above but it doesn't mention what the impl would look like.
See tests/ui/traits/normalize/self-referential-param-env-normalization.rs
There was a problem hiding this comment.
also, can you move these folders into a separate replace_infer_and_non_rigid_alias_with_error function or sth 🤔
The two folders are slightly different. Unsure we should fold non-rigid aliases to error if we don't have normalization failure. Those non-rigid aliases can come from opaques. Maybe we can still do that since we're on a failed code path anyway. Could cause some spurious failures? 🤔
There was a problem hiding this comment.
What do you mean?
fully_resolveitself would replace unresolved region and return Ok with delayed error.
if fully_resolve has both unresolved regions (which it replaced) and an unresolved type (which causes it to return an Err), then wouldn't we fold over the type without the unresolved region replaced?
ea6993b to
ef03c32
Compare
This comment has been minimized.
This comment has been minimized.
ef03c32 to
d79e9fd
Compare
|
This PR changes a file inside |
This comment has been minimized.
This comment has been minimized.
7b33584 to
14870df
Compare
| }) | ||
| } | ||
|
|
||
| enum ReplaceRegion { |
There was a problem hiding this comment.
| enum ReplaceRegion { | |
| enum ReplaceRegions { |
| // We can't resolve regions using lexical resolution here since that's | ||
| // private. It probably doesn't matter since we already got more severe error. |
There was a problem hiding this comment.
vibe, want to move this above the ReplaceRegions::Yes as that should make the formatting slightly nicer here
| // FIXME: We should avoid interning clauses both here and at the caller sites. We should also | ||
| // avoid cloning if possible. |
There was a problem hiding this comment.
| // FIXME: We should avoid interning clauses both here and at the caller sites. We should also | |
| // avoid cloning if possible. | |
| // FIXME: We should avoid interning clauses both here and at the | |
| // caller sites. We should also avoid cloning if possible. |
minor formatting nit, the lines are very long here in general :<
14870df to
51ef2f2
Compare
|
@bors r=lcnr |
Rollup of 8 pull requests Successful merges: - #159593 (merge ambiguity errors that blame the same inference variable) - #160687 (Experiment: Add `core::cmp::smallest` and `core::cmp::largest`) - #160856 (Replace infers and non-rigid aliases with `Ty/Const::Error` if param env normalization fails) - #160961 (bootstrap: Overhaul matching of command-line selectors to steps) - #160975 (Remove target argument from get_proc_macros) - #161023 (bootstrap: Replace the `exit!` macro with a function `helpers::exit_process`) - #160932 (Make tidy::Version public) - #161029 (mailmap: Update my default email)
Rollup merge of #160856 - adwinwhite:param-env-norm-fail-with-err, r=lcnr Replace infers and non-rigid aliases with `Ty/Const::Error` if param env normalization fails Fixes #160196 Fixes #148630 Previously we use unnormalized param env if we fail to normalize it. This causes problem for places which expect normalized param env, like in lexical region solving. I also sneak in a one-line change that we resolve regions with normalized param env in param env normalization now. This fixes ICEs in `polkadot` and `zerocopy` which had non-rigid const aliases in type outlive env before. I can split it into another PR if that's preferred. r? lcnr
replace infers and non-rigid aliases with `Ty/Const::Error`
View all comments
Fixes #160196
Fixes #148630
Previously we use unnormalized param env if we fail to normalize it. This causes problem for places which expect normalized param env, like in lexical region solving.
I also sneak in a one-line change that we resolve regions with normalized param env in param env normalization now.
This fixes ICEs in
polkadotandzerocopywhich had non-rigid const aliases in type outlive env before. I can split it into another PR if that's preferred.r? lcnr