-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Trait argument from associated type has conflicting impl #99940
Copy link
Copy link
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-coherenceArea: CoherenceArea: CoherenceC-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.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-coherenceArea: CoherenceArea: CoherenceC-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=5a6bc60775d41ce5ef3ff9656d489c51
I expected to see this happen: Code compiles successfully
Instead, this happened:
As you you see, the stdlib has
Which makes use of a default type arg on
FromResidual-<Self as Try>::Residual. ForOption<T>, that isOption<Infallible>.So apparently,
FromResidual<Option<Infallible>>conflicts withFromResidual<Flip<T>>.Playing devil's advocate, we could assume that
FromResidualis being conservative with its conflicts becauseTry::Residualcould change, but it could never change to a type I own.Meta
rustc --version --verbose: