Skip to content

Commit e8df95d

Browse files
nikomatsakisflaper87
authored andcommitted
mark candidate set ambig for defaulted traits where self-type is not yet known
1 parent 24bdce4 commit e8df95d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/librustc/middle/traits/select.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,8 +1143,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11431143
}
11441144

11451145
match self_ty.sty {
1146-
ty::ty_infer(ty::TyVar(_)) |
11471146
ty::ty_trait(..) => {},
1147+
ty::ty_infer(ty::TyVar(_)) => {
1148+
// the defaulted impl might apply, we don't know
1149+
if ty::trait_has_default_impl(self.tcx(), def_id) {
1150+
candidates.ambiguous = true;
1151+
}
1152+
}
11481153
_ => {
11491154
if ty::trait_has_default_impl(self.tcx(), def_id) {
11501155
candidates.vec.push(DefaultImplCandidate(def_id.clone()))

0 commit comments

Comments
 (0)