diff options
| author | est31 <MTest31@outlook.com> | 2020-10-14 14:22:22 +0200 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2020-10-14 14:23:32 +0200 |
| commit | 301907497fa16e8df8d86eecaff3bf4639fd5e00 (patch) | |
| tree | b03361a7a44e098d3e9c92f56815f610ab6c5b9f | |
| parent | f243a2ad904705a1e340a08639dca105605b4175 (diff) | |
| download | rust-301907497fa16e8df8d86eecaff3bf4639fd5e00.tar.gz rust-301907497fa16e8df8d86eecaff3bf4639fd5e00.zip | |
Remove needless alloc_slice
Don't invoke alloc_slice. Arenas are temporary, empty slices are eternal!
| -rw-r--r-- | compiler/rustc_mir/src/const_eval/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_mir/src/const_eval/mod.rs b/compiler/rustc_mir/src/const_eval/mod.rs index 978d2fe0004..4b235e1aa4a 100644 --- a/compiler/rustc_mir/src/const_eval/mod.rs +++ b/compiler/rustc_mir/src/const_eval/mod.rs @@ -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; |
