mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
Remove needless alloc_slice
Don't invoke alloc_slice. Arenas are temporary, empty slices are eternal!
This commit is contained in:
parent
f243a2ad90
commit
301907497f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user