Remove needless alloc_slice

Don't invoke alloc_slice.

Arenas are temporary,
empty slices are eternal!
This commit is contained in:
est31 2020-10-14 14:22:22 +02:00
parent f243a2ad90
commit 301907497f
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ pub(crate) fn destructure_const<'tcx>(
let (field_count, variant, down) = match val.ty.kind() {
ty::Array(_, len) => (usize::try_from(len.eval_usize(tcx, param_env)).unwrap(), None, op),
ty::Adt(def, _) if def.variants.is_empty() => {
return mir::DestructuredConst { variant: None, fields: tcx.arena.alloc_slice(&[]) };
return mir::DestructuredConst { variant: None, fields: &[] };
}
ty::Adt(def, _) => {
let variant = ecx.read_discriminant(op).unwrap().1;