]> git.lizzy.rs Git - rust.git/commitdiff
Explain that `ensure_monomorphic_enough` omission is intentional
authorTomasz Miąsko <tomasz.miasko@gmail.com>
Sat, 5 Jun 2021 00:00:00 +0000 (00:00 +0000)
committerTomasz Miąsko <tomasz.miasko@gmail.com>
Sat, 5 Jun 2021 16:28:25 +0000 (18:28 +0200)
compiler/rustc_mir/src/interpret/intrinsics.rs

index cdd1edbf2866e3e93bf99f6adec631b0d44a2f8b..4e4166dad50e29b83c7b49c00905fe344941f659 100644 (file)
@@ -61,6 +61,7 @@ fn numeric_intrinsic<Tag>(name: Symbol, bits: u128, kind: Primitive) -> Scalar<T
             ConstValue::from_bool(tp_ty.needs_drop(tcx, param_env))
         }
         sym::min_align_of | sym::pref_align_of => {
+            // Correctly handles non-monomorphic calls, so there is no need for ensure_monomorphic_enough.
             let layout = tcx.layout_of(param_env.and(tp_ty)).map_err(|e| err_inval!(Layout(e)))?;
             let n = match name {
                 sym::pref_align_of => layout.align.pref.bytes(),
@@ -74,6 +75,7 @@ fn numeric_intrinsic<Tag>(name: Symbol, bits: u128, kind: Primitive) -> Scalar<T
             ConstValue::from_u64(tcx.type_id_hash(tp_ty))
         }
         sym::variant_count => match tp_ty.kind() {
+            // Correctly handles non-monomorphic calls, so there is no need for ensure_monomorphic_enough.
             ty::Adt(ref adt, _) => ConstValue::from_machine_usize(adt.variants.len() as u64, &tcx),
             ty::Projection(_)
             | ty::Opaque(_, _)