Return false from needs_drop for all zero-sized arrays

This commit is contained in:
Dylan MacKenzie 2019-10-13 12:27:11 -07:00
parent c27f7568bc
commit 061b906683

View file

@ -1096,6 +1096,9 @@ fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
// Zero-length arrays never contain anything to drop.
ty::Array(_, len) if len.try_eval_usize(tcx, param_env) == Some(0) => false,
// Structural recursion.
ty::Array(ty, _) | ty::Slice(ty) => needs_drop(ty),