about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2024-03-18 22:28:29 +0100
committerLukas Markeffsky <@>2024-03-18 22:28:29 +0100
commit99efae342e8581d12f9017affba2a229a2cfa152 (patch)
treeeda41541756992ca6db4a3457fad478d527b4ad4 /compiler/rustc_trait_selection/src/solve
parentee66acbea856f12694ea7c8033769a371a754ae3 (diff)
downloadrust-99efae342e8581d12f9017affba2a229a2cfa152.tar.gz
rust-99efae342e8581d12f9017affba2a229a2cfa152.zip
address nits
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
-rw-r--r--compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs b/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs
index e7e8ff66e3e..faf8c55c475 100644
--- a/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs
+++ b/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs
@@ -168,10 +168,11 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
         //   "best effort" optimization and `sized_constraint` may return `Some`, even
         //   if the ADT is sized for all possible args.
         ty::Adt(def, args) => {
-            let sized_crit = def.sized_constraint(ecx.tcx());
-            Ok(sized_crit.map_or_else(Vec::new, |ty| {
-                vec![ty::Binder::dummy(ty.instantiate(ecx.tcx(), args))]
-            }))
+            if let Some(sized_crit) = def.sized_constraint(ecx.tcx()) {
+                Ok(vec![ty::Binder::dummy(sized_crit.instantiate(ecx.tcx(), args))])
+            } else {
+                Ok(vec![])
+            }
         }
     }
 }