Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRustc selects the wrong impl for trait objects when a trait is implemented multiple times with different parameters on the same struct #26339
Comments
jorisgio
changed the title
Rustc selects the wrong impl when a trait is implemented multiple times with different parameters on the same struct
Rustc selects the wrong impl for trait objects when a trait is implemented multiple times with different parameters on the same struct
Jun 16, 2015
This comment has been minimized.
This comment has been minimized.
|
I'm starting to be convinced that such a trait shouldn't be object safe, it introduces dynamic multi-dispatch into the language. |
bluss
added
the
I-wrong
label
Jun 16, 2015
nikomatsakis
added
the
T-compiler
label
Jun 16, 2015
This comment has been minimized.
This comment has been minimized.
|
triage: P-high |
rust-highfive
added
the
P-high
label
Jun 16, 2015
This comment has been minimized.
This comment has been minimized.
|
Looks like the immediate issue is that (I don't think handling cases like this requires dynamic multi-dispatch: the trait A contains |
This comment has been minimized.
This comment has been minimized.
|
A couple of notes:
|
jorisgio commentedJun 16, 2015
In the following test case, rustc selects the second implementation instead of the first one :
This can lead to uninitialised memory access. Thanks to bluss for further reducing the testcase.