]> git.lizzy.rs Git - rust.git/commitdiff
wf correctly shallow_resolve consts
authorlcnr <rust@lcnr.de>
Sat, 13 Aug 2022 11:49:11 +0000 (13:49 +0200)
committerlcnr <rust@lcnr.de>
Sat, 13 Aug 2022 19:04:52 +0000 (21:04 +0200)
compiler/rustc_trait_selection/src/traits/wf.rs

index 414857f0acc8096b4f938f9e6e3c85405ab06c91..7a5e67ff74b32daa78845d419948750b035633eb 100644 (file)
@@ -31,9 +31,9 @@ pub fn obligations<'a, 'tcx>(
                     if resolved_ty == ty {
                         // No progress, bail out to prevent "livelock".
                         return None;
+                    } else {
+                        resolved_ty
                     }
-
-                    resolved_ty
                 }
                 _ => ty,
             }
@@ -41,16 +41,14 @@ pub fn obligations<'a, 'tcx>(
         }
         GenericArgKind::Const(ct) => {
             match ct.kind() {
-                ty::ConstKind::Infer(infer) => {
-                    let resolved = infcx.shallow_resolve(infer);
-                    if resolved == infer {
+                ty::ConstKind::Infer(_) => {
+                    let resolved = infcx.shallow_resolve(ct);
+                    if resolved == ct {
                         // No progress.
                         return None;
+                    } else {
+                        resolved
                     }
-
-                    infcx
-                        .tcx
-                        .mk_const(ty::ConstS { kind: ty::ConstKind::Infer(resolved), ty: ct.ty() })
                 }
                 _ => ct,
             }