Wrong specialised implementation chosen on T
or U
where T: U
#68159
Labels
A-specialization
Area: Trait impl specialization
C-bug
Category: This is a bug.
F-specialization
`#![feature(specialization)]`
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
If a default function taking a generic type
T
is specialised by a concrete typeU
which fulfills the constraints onT
, calls to the function will never choose the default implementation even if it is the only valid choice.https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a6b6b6f5a051db104630ec706708da08
The proper implementation is, however, correctly resolved using universal calling syntax:
It also seems to resolve correctly when a second specialised implementation with another concrete type that also meets the constraints on the default implementation:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=2687e226c51933ce99ed514c840bd317
The text was updated successfully, but these errors were encountered: