Skip to content

Introduce a RerunNonErased error type mirroring NoSolution, to better track when we're bailing#156246

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
jdonszelmann:rerun-error-type
May 8, 2026
Merged

Introduce a RerunNonErased error type mirroring NoSolution, to better track when we're bailing#156246
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
jdonszelmann:rerun-error-type

Conversation

@jdonszelmann
Copy link
Copy Markdown
Contributor

r? @lcnr

@rustbot blocked #155443

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 6, 2026

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels May 6, 2026
@rustbot rustbot added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label May 6, 2026
Comment thread compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
Comment thread compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 8, 2026

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.

@jdonszelmann
Copy link
Copy Markdown
Contributor Author

@bors r=lcnr

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 8, 2026

📋 This PR cannot be approved because it currently has the following label: S-blocked.

@jdonszelmann jdonszelmann removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label May 8, 2026
@jdonszelmann
Copy link
Copy Markdown
Contributor Author

@bors r=lcnr

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 8, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 8, 2026

📋 Only open, non-draft PRs can be approved.

@jdonszelmann jdonszelmann reopened this May 8, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 8, 2026
@jdonszelmann
Copy link
Copy Markdown
Contributor Author

@bors r=lcnr

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 8, 2026

📌 Commit 180725c has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 8, 2026
rust-bors Bot pushed a commit that referenced this pull request May 8, 2026
…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)
@rust-bors rust-bors Bot merged commit fd16638 into rust-lang:main May 8, 2026
22 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 8, 2026
rust-timer added a commit that referenced this pull request May 8, 2026
Rollup merge of #156246 - jdonszelmann:rerun-error-type, r=lcnr

Introduce a `RerunNonErased` error type mirroring `NoSolution`, to better track when we're bailing

r? @lcnr

@rustbot blocked #155443
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.
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// check th t the opaque_accesses state mirrors the result we got.
// check that the opaque_accesses state mirrors the result we got.

View changes since the review

if self.typing_mode().is_erased_not_coherence() {
self.opaque_accesses.rerun_always(RerunReason::EvaluateConst);
return None;
self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)?;
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)?;
match self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)? {}

View changes since the review

if self.typing_mode().is_erased_not_coherence() {
self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature);
return false;
self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature)?;
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature)?;
match self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature) {}

View changes since the review


outer.opaque_accesses.update(nested.opaque_accesses)?;

let r = match r.map_err_to_rerun()? {
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this match doing 🤔 and this ? could be an unwrap, can it?

View changes since the review

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)
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is surprising, how does evaluate_added_goals_and_make_canonical_response not return NoSolutionOrRerunErased

View changes since the review

Comment on lines +713 to +716
let alias_bound_result = match alias_bound_result.map_err_to_rerun()? {
Ok(i) => Ok(i),
Err(NoSolution) => Err(NoSolution),
};
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +147 to +153
let result = match result {
Ok(i) => Ok(i),
Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution),
Err(NoSolutionOrRerunNonErased::RerunNonErased(e)) => {
return Err(e.into());
}
};
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not the map_err_rerun thingy? here

View changes since the review

);

then(ecx, maximal_certainty)
then(ecx, maximal_certainty).map_err(Into::into)
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this map_err(Into::into) is a noop afaict?

same for a lot of them

View changes since the review


let result = ecx.probe(|_| ProbeKind::UnsizeAssembly).enter(
|ecx| -> Result<Vec<Candidate<I>>, NoSolution> {
|ecx| -> Result<Vec<Candidate<I>>, NoSolutionOrRerunNonErased> {
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels still suboptimal, should be Result<Vec<Candidate<I>>, RerunNonErased>

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants