1
Fork 0

Emit proper error when casting to Ddyn-star

This commit is contained in:
Michael Goulet 2022-10-28 17:32:34 +00:00
parent 5237c4d83d
commit c4420135fe
5 changed files with 65 additions and 1 deletions

View file

@ -866,7 +866,13 @@ impl<'a, 'tcx> CastCheck<'tcx> {
(Int(_) | Float, Int(_) | Float) => Ok(CastKind::NumericCast),
(_, DynStar) | (DynStar, _) => bug!("should be handled by `try_coerce`"),
(_, DynStar) | (DynStar, _) => {
if fcx.tcx.features().dyn_star {
bug!("should be handled by `try_coerce`")
} else {
Err(CastError::IllegalCast)
}
}
}
}