1
Fork 0

Don't drop Upcast candidate in intercrate mode

This commit is contained in:
Michael Goulet 2024-05-30 19:45:27 -04:00
parent 6f3df08aad
commit e485b193d0
3 changed files with 30 additions and 0 deletions

View file

@ -921,6 +921,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
param_env: ty::ParamEnv<'tcx>,
cause: &ObligationCause<'tcx>,
) -> Option<ty::PolyExistentialTraitRef<'tcx>> {
// Don't drop any candidates in intercrate mode, as it's incomplete.
// (Not that it matters, since `Unsize` is not a stable trait.)
if self.infcx.intercrate {
return None;
}
let tcx = self.tcx();
if tcx.features().trait_upcasting {
return None;