Skip to content

Commit 0e6ccff

Browse files
committed
Normalize in needs_drop_raw
1 parent a605441 commit 0e6ccff

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/librustc/ty/util.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,9 +1122,19 @@ fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>
11221122

11231123
// Can refer to a type which may drop.
11241124
// FIXME(eddyb) check this against a ParamEnv.
1125-
ty::Dynamic(..) | ty::Projection(..) | ty::Param(_) | ty::Bound(..) |
1125+
ty::Dynamic(..) | ty::Param(_) | ty::Bound(..) |
11261126
ty::Placeholder(..) | ty::Opaque(..) | ty::Infer(_) | ty::Error => true,
11271127

1128+
ty::Projection(..) => {
1129+
let normalized = tcx.normalize_erasing_regions(param_env, ty);
1130+
if let ty::Projection(..) = normalized.kind {
1131+
// Failed to normalize - assume that drop is required
1132+
true
1133+
} else {
1134+
needs_drop(normalized)
1135+
}
1136+
}
1137+
11281138
ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
11291139

11301140
// Zero-length arrays never contain anything to drop.

0 commit comments

Comments
 (0)