-
-
Notifications
You must be signed in to change notification settings - Fork 16k
Regression in trait disambiguation with the next generation trait solver (-Znext-solver=globally) #161645
Copy link
Copy link
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-method-lookupArea: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)Area: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)C-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-method-lookupArea: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)Area: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)C-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
I was playing with the next generation trait solver (which is said to stabilize soon: rust-lang/goals#113) on Bevy. Bevy has a notoriously slow to compile subcrate called
bevy_pbrand was hoping to see some improvements.The good new is that the improvement is real and substantial:
bevy_pbrtotal-Znext-solver=coherence)-Znext-solver=globally)The bad news is that it became less equipped to deal with ambiguity. In this case the patch is relatively simple and acceptable: bevyengine/bevy#25533. That said, stabilization of the next generation trait solver would technique constitute a regression.
If the answer is, "the next generation solver can only be this performant because it chooses to reject ambiguity" then I'm also relatively satisfied, just wanted to make sure this is a conscious decision.
Tested using
rustc 1.100.0-nightly (c656540d6 2026-08-21)