Skip to content

Commit 37c5e3b

Browse files
Return false from needs_drop for all zero-sized arrays
1 parent 9d39a68 commit 37c5e3b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc/ty/util.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,9 @@ fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>
11051105

11061106
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
11071107

1108+
// Zero-length arrays never contain anything to drop.
1109+
ty::Array(_, len) if len.try_eval_usize(tcx, param_env) == Some(0) => false,
1110+
11081111
// Structural recursion.
11091112
ty::Array(ty, _) | ty::Slice(ty) => needs_drop(ty),
11101113

0 commit comments

Comments
 (0)