]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_typeck/src/fallback.rs
Rollup merge of #101975 - chenyukang:fix-101749, r=compiler-errors
[rust.git] / compiler / rustc_hir_typeck / src / fallback.rs
index 5d44092a5f68e33c440e652e24608bf9745ba161..ac6b0924ab572498a4cc36f9fe8187f1b93b38ed 100644 (file)
@@ -104,7 +104,7 @@ fn fallback_if_possible(
         // type, `?T` is not considered unsolved, but `?I` is. The
         // same is true for float variables.)
         let fallback = match ty.kind() {
-            _ if self.is_tainted_by_errors() => self.tcx.ty_error(),
+            _ if let Some(e) = self.tainted_by_errors() => self.tcx.ty_error_with_guaranteed(e),
             ty::Infer(ty::IntVar(_)) => self.tcx.types.i32,
             ty::Infer(ty::FloatVar(_)) => self.tcx.types.f64,
             _ => match diverging_fallback.get(&ty) {