Skip to content

Regression in trait disambiguation with the next generation trait solver (-Znext-solver=globally) #161645

Description

@HugoPeters1024

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_pbr and was hoping to see some improvements.

The good new is that the improvement is real and substantial:

Solver bevy_pbr total Frontend Codegen
Legacy (-Znext-solver=coherence) 40.8s 33.9s 6.9s
Next (-Znext-solver=globally) 32.9s 25.5s 7.4s

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `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`)C-bugCategory: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions