Ignore trait implementations with negative polarity when suggesting trait implementations in diagnostics
This commit is contained in:
parent
4cbda829c0
commit
3c4bc8c8ad
1 changed files with 11 additions and 1 deletions
|
@ -1310,10 +1310,20 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if self.tcx.impl_polarity(def_id) == ty::ImplPolarity::Negative {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
Some(imp)
|
Some(imp)
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
None => all_impls.map(|def_id| self.tcx.impl_trait_ref(def_id).unwrap()).collect(),
|
None => all_impls
|
||||||
|
.filter_map(|def_id| {
|
||||||
|
if self.tcx.impl_polarity(def_id) == ty::ImplPolarity::Negative {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
self.tcx.impl_trait_ref(def_id)
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue