mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
Handle multiple trait-def projection candidates
This commit is contained in:
parent
0dfa6ff3be
commit
ed32482534
@ -977,6 +977,13 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>(
|
||||
|
||||
if is_match {
|
||||
candidate_set.push_candidate(ctor(data));
|
||||
|
||||
if potentially_unnormalized_candidates && !obligation.predicate.needs_infer() {
|
||||
// HACK: Pick the first trait def candidate for a fully
|
||||
// inferred predicate. This is to allow duplicates that
|
||||
// differ only in normalization.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
// Check that if we have multiple applicable projection bounds we pick one (for
|
||||
// backwards compatibility reasons).
|
||||
|
||||
// check-pass
|
||||
use std::ops::Mul;
|
||||
|
||||
trait A {
|
||||
type V;
|
||||
type U: Mul<Self::V, Output = ()> + Mul<(), Output = ()>;
|
||||
}
|
||||
|
||||
fn g<T: A<V = ()>>() {
|
||||
let y: <T::U as Mul<()>>::Output = ();
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user