Rollup merge of #77936 - est31:remove_needless_alloc_slice, r=jonas-schievink

Remove needless alloc_slice

Don't invoke alloc_slice.

Arenas are temporary,
empty slices are eternal!
This commit is contained in:
Yuki Okushi 2020-10-15 07:32:37 +09:00 committed by GitHub
commit df08fe7214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;