Skip to content

Commit effb6bd

Browse files
committed
Auto merge of #115367 - frank-king:feature/unnamed-fields-hir, r=davidtwco
Lowering unnamed fields and anonymous adt This implements #49804. Goals: - [x] lowering anonymous ADTs from AST to HIR - [x] generating definitions of anonymous ADTs - [x] uniqueness check of the unnamed fields - [x] field projection of anonymous ADTs - [x] `#[repr(C)]` check of the anonymous ADTs Non-Goals (will be in the next PRs) - capturing generic params for the anonymous ADTs from the parent ADT - pattern matching of anonymous ADTs - structural expressions of anonymous ADTs - rustdoc support of anonymous ADTs
2 parents e11e8ac + 2514dce commit effb6bd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ impl TyCoercionStability {
831831
| TyKind::Typeof(..)
832832
| TyKind::TraitObject(..)
833833
| TyKind::InferDelegation(..)
834+
| TyKind::AnonAdt(..)
834835
| TyKind::Err(_) => Self::Reborrow,
835836
};
836837
}

clippy_utils/src/hir_utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ impl HirEqInterExpr<'_, '_, '_> {
515515
(TyKind::Path(l), TyKind::Path(r)) => self.eq_qpath(l, r),
516516
(&TyKind::Tup(l), &TyKind::Tup(r)) => over(l, r, |l, r| self.eq_ty(l, r)),
517517
(&TyKind::Infer, &TyKind::Infer) => true,
518+
(TyKind::AnonAdt(l_item_id), TyKind::AnonAdt(r_item_id)) => l_item_id == r_item_id,
518519
_ => false,
519520
}
520521
}
@@ -1108,7 +1109,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
11081109
TyKind::Typeof(anon_const) => {
11091110
self.hash_body(anon_const.body);
11101111
},
1111-
TyKind::Err(_) | TyKind::Infer | TyKind::Never | TyKind::InferDelegation(..) => {},
1112+
TyKind::Err(_) | TyKind::Infer | TyKind::Never | TyKind::InferDelegation(..) | TyKind::AnonAdt(_) => {},
11121113
}
11131114
}
11141115

0 commit comments

Comments
 (0)