Skip to content

Commit 69422c9

Browse files
committed
Don't requery the param_env of a union
Union fields have the ParamEnv of the union.
1 parent 212b2c7 commit 69422c9

File tree

1 file changed

+1
-1
lines changed
  • src/librustc_typeck/check

1 file changed

+1
-1
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,11 +1545,11 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: DefId) -> bool {
15451545
if let ty::Adt(def, substs) = item_type.kind {
15461546
assert!(def.is_union());
15471547
let fields = &def.non_enum_variant().fields;
1548+
let param_env = tcx.param_env(item_def_id);
15481549
for field in fields {
15491550
let field_ty = field.ty(tcx, substs);
15501551
// We are currently checking the type this field came from, so it must be local.
15511552
let field_span = tcx.hir().span_if_local(field.did).unwrap();
1552-
let param_env = tcx.param_env(field.did);
15531553
if field_ty.needs_drop(tcx, param_env) {
15541554
struct_span_err!(
15551555
tcx.sess,

0 commit comments

Comments
 (0)