Introduce a RerunNonErased error type mirroring NoSolution, to better track when we're bailing#156246
Conversation
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred to the CTFE machinery Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri changes to the core type system cc @lcnr Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
13753cc to
56bbe1c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
aaf1151 to
180725c
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=lcnr |
|
📋 This PR cannot be approved because it currently has the following label: |
|
@bors r=lcnr |
|
📋 Only open, non-draft PRs can be approved. |
|
@bors r=lcnr |
…uwer Rollup of 4 pull requests Successful merges: - #156246 (Introduce a `RerunNonErased` error type mirroring `NoSolution`, to better track when we're bailing) - #156038 (turn `compute_goal_fast_path` into a single match) - #156291 (Treat MSVC "performing full link" message as informational) - #156301 (Avoid ICE when suggesting as_ref for ill-typed closure receivers)
| Ok(i) => Ok(i), | ||
| Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution), | ||
| Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => { | ||
| // check th t the opaque_accesses state mirrors the result we got. |
There was a problem hiding this comment.
| // check th t the opaque_accesses state mirrors the result we got. | |
| // check that the opaque_accesses state mirrors the result we got. |
| if self.typing_mode().is_erased_not_coherence() { | ||
| self.opaque_accesses.rerun_always(RerunReason::EvaluateConst); | ||
| return None; | ||
| self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)?; |
There was a problem hiding this comment.
| self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)?; | |
| match self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)? {} |
| if self.typing_mode().is_erased_not_coherence() { | ||
| self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature); | ||
| return false; | ||
| self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature)?; |
There was a problem hiding this comment.
| self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature)?; | |
| match self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature) {} |
|
|
||
| outer.opaque_accesses.update(nested.opaque_accesses)?; | ||
|
|
||
| let r = match r.map_err_to_rerun()? { |
There was a problem hiding this comment.
what is this match doing 🤔 and this ? could be an unwrap, can it?
| ecx.add_goal(GoalSource::Misc, goal.with(cx, PredicateKind::Ambiguous)); | ||
| return ecx | ||
| .evaluate_added_goals_and_make_canonical_response(Certainty::Yes); | ||
| .evaluate_added_goals_and_make_canonical_response(Certainty::Yes) |
There was a problem hiding this comment.
this is surprising, how does evaluate_added_goals_and_make_canonical_response not return NoSolutionOrRerunErased
| let alias_bound_result = match alias_bound_result.map_err_to_rerun()? { | ||
| Ok(i) => Ok(i), | ||
| Err(NoSolution) => Err(NoSolution), | ||
| }; |
There was a problem hiding this comment.
why this match?
| let result = match result { | ||
| Ok(i) => Ok(i), | ||
| Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution), | ||
| Err(NoSolutionOrRerunNonErased::RerunNonErased(e)) => { | ||
| return Err(e.into()); | ||
| } | ||
| }; |
There was a problem hiding this comment.
why not the map_err_rerun thingy? here
| ); | ||
|
|
||
| then(ecx, maximal_certainty) | ||
| then(ecx, maximal_certainty).map_err(Into::into) |
There was a problem hiding this comment.
|
|
||
| let result = ecx.probe(|_| ProbeKind::UnsizeAssembly).enter( | ||
| |ecx| -> Result<Vec<Candidate<I>>, NoSolution> { | ||
| |ecx| -> Result<Vec<Candidate<I>>, NoSolutionOrRerunNonErased> { |
There was a problem hiding this comment.
this feels still suboptimal, should be Result<Vec<Candidate<I>>, RerunNonErased>
r? @lcnr
@rustbot blocked #155443