mark candidate set ambig for defaulted traits where self-type is not yet known

This commit is contained in:
Niko Matsakis 2015-02-19 11:28:01 -05:00 committed by Flavio Percoco
parent 24bdce4bbf
commit e8df95d77f

View file

@ -1143,8 +1143,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
match self_ty.sty {
ty::ty_infer(ty::TyVar(_)) |
ty::ty_trait(..) => {},
ty::ty_infer(ty::TyVar(_)) => {
// the defaulted impl might apply, we don't know
if ty::trait_has_default_impl(self.tcx(), def_id) {
candidates.ambiguous = true;
}
}
_ => {
if ty::trait_has_default_impl(self.tcx(), def_id) {
candidates.vec.push(DefaultImplCandidate(def_id.clone()))