mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
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:
commit
df08fe7214
@ -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