1
Fork 0

Allow type_of to return partially non-error types if the type was already tainted

This commit is contained in:
Oli Scherer 2024-05-28 11:38:30 +00:00
parent f989d2f625
commit a04ac26a9d
18 changed files with 174 additions and 51 deletions

View file

@ -502,7 +502,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
bug!("unexpected sort of node in type_of(): {:?}", x);
}
};
if let Err(e) = icx.check_tainted_by_errors() {
if let Err(e) = icx.check_tainted_by_errors()
&& !output.references_error()
{
ty::EarlyBinder::bind(Ty::new_error(tcx, e))
} else {
ty::EarlyBinder::bind(output)