Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 72653c1

Browse files
committedNov 21, 2023
Use macros to avoid expect_* boilerplate.
The majority of these aren't actually used, but I kept them anyway.
1 parent ec10e37 commit 72653c1

File tree

1 file changed

+102
-369
lines changed

1 file changed

+102
-369
lines changed
 

‎compiler/rustc_hir/src/hir.rs

Lines changed: 102 additions & 369 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,6 +2267,35 @@ pub struct TraitItem<'hir> {
22672267
pub defaultness: Defaultness,
22682268
}
22692269

2270+
macro_rules! expect_methods_self_kind {
2271+
( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
2272+
$(
2273+
#[track_caller]
2274+
pub fn $name(&self) -> $ret_ty {
2275+
let $pat = &self.kind else { expect_failed(stringify!($ident), self) };
2276+
$ret_val
2277+
}
2278+
)*
2279+
}
2280+
}
2281+
2282+
macro_rules! expect_methods_self {
2283+
( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
2284+
$(
2285+
#[track_caller]
2286+
pub fn $name(&self) -> $ret_ty {
2287+
let $pat = self else { expect_failed(stringify!($ident), self) };
2288+
$ret_val
2289+
}
2290+
)*
2291+
}
2292+
}
2293+
2294+
#[track_caller]
2295+
fn expect_failed<T: fmt::Debug>(ident: &'static str, found: T) -> ! {
2296+
panic!("{ident}: found {found:?}")
2297+
}
2298+
22702299
impl<'hir> TraitItem<'hir> {
22712300
#[inline]
22722301
pub fn hir_id(&self) -> HirId {
@@ -2278,30 +2307,15 @@ impl<'hir> TraitItem<'hir> {
22782307
TraitItemId { owner_id: self.owner_id }
22792308
}
22802309

2281-
/// Expect an [`TraitItemKind::Const`] or panic.
2282-
#[track_caller]
2283-
pub fn expect_const(&self) -> (&'hir Ty<'hir>, Option<BodyId>) {
2284-
let TraitItemKind::Const(ty, body) = self.kind else { self.expect_failed("a constant") };
2285-
(ty, body)
2286-
}
2310+
expect_methods_self_kind! {
2311+
expect_const, (&'hir Ty<'hir>, Option<BodyId>),
2312+
TraitItemKind::Const(ty, body), (ty, *body);
22872313

2288-
/// Expect an [`TraitItemKind::Fn`] or panic.
2289-
#[track_caller]
2290-
pub fn expect_fn(&self) -> (&FnSig<'hir>, &TraitFn<'hir>) {
2291-
let TraitItemKind::Fn(ty, trfn) = &self.kind else { self.expect_failed("a function") };
2292-
(ty, trfn)
2293-
}
2294-
2295-
/// Expect an [`TraitItemKind::Type`] or panic.
2296-
#[track_caller]
2297-
pub fn expect_type(&self) -> (GenericBounds<'hir>, Option<&'hir Ty<'hir>>) {
2298-
let TraitItemKind::Type(bounds, ty) = self.kind else { self.expect_failed("a type") };
2299-
(bounds, ty)
2300-
}
2314+
expect_fn, (&FnSig<'hir>, &TraitFn<'hir>),
2315+
TraitItemKind::Fn(ty, trfn), (ty, trfn);
23012316

2302-
#[track_caller]
2303-
fn expect_failed(&self, expected: &'static str) -> ! {
2304-
panic!("expected {expected} item, found {self:?}")
2317+
expect_type, (GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
2318+
TraitItemKind::Type(bounds, ty), (bounds, *ty);
23052319
}
23062320
}
23072321

@@ -2366,30 +2380,10 @@ impl<'hir> ImplItem<'hir> {
23662380
ImplItemId { owner_id: self.owner_id }
23672381
}
23682382

2369-
/// Expect an [`ImplItemKind::Const`] or panic.
2370-
#[track_caller]
2371-
pub fn expect_const(&self) -> (&'hir Ty<'hir>, BodyId) {
2372-
let ImplItemKind::Const(ty, body) = self.kind else { self.expect_failed("a constant") };
2373-
(ty, body)
2374-
}
2375-
2376-
/// Expect an [`ImplItemKind::Fn`] or panic.
2377-
#[track_caller]
2378-
pub fn expect_fn(&self) -> (&FnSig<'hir>, BodyId) {
2379-
let ImplItemKind::Fn(ty, body) = &self.kind else { self.expect_failed("a function") };
2380-
(ty, *body)
2381-
}
2382-
2383-
/// Expect an [`ImplItemKind::Type`] or panic.
2384-
#[track_caller]
2385-
pub fn expect_type(&self) -> &'hir Ty<'hir> {
2386-
let ImplItemKind::Type(ty) = self.kind else { self.expect_failed("a type") };
2387-
ty
2388-
}
2389-
2390-
#[track_caller]
2391-
fn expect_failed(&self, expected: &'static str) -> ! {
2392-
panic!("expected {expected} item, found {self:?}")
2383+
expect_methods_self_kind! {
2384+
expect_const, (&'hir Ty<'hir>, BodyId), ImplItemKind::Const(ty, body), (ty, *body);
2385+
expect_fn, (&FnSig<'hir>, BodyId), ImplItemKind::Fn(ty, body), (ty, *body);
2386+
expect_type, &'hir Ty<'hir>, ImplItemKind::Type(ty), ty;
23932387
}
23942388
}
23952389

@@ -3075,134 +3069,51 @@ impl<'hir> Item<'hir> {
30753069
ItemId { owner_id: self.owner_id }
30763070
}
30773071

3078-
/// Expect an [`ItemKind::ExternCrate`] or panic.
3079-
#[track_caller]
3080-
pub fn expect_extern_crate(&self) -> Option<Symbol> {
3081-
let ItemKind::ExternCrate(s) = self.kind else { self.expect_failed("an extern crate") };
3082-
s
3083-
}
3072+
expect_methods_self_kind! {
3073+
expect_extern_crate, Option<Symbol>, ItemKind::ExternCrate(s), *s;
30843074

3085-
/// Expect an [`ItemKind::Use`] or panic.
3086-
#[track_caller]
3087-
pub fn expect_use(&self) -> (&'hir UsePath<'hir>, UseKind) {
3088-
let ItemKind::Use(p, uk) = self.kind else { self.expect_failed("a use") };
3089-
(p, uk)
3090-
}
3075+
expect_use, (&'hir UsePath<'hir>, UseKind), ItemKind::Use(p, uk), (p, *uk);
30913076

3092-
/// Expect an [`ItemKind::Static`] or panic.
3093-
#[track_caller]
3094-
pub fn expect_static(&self) -> (&'hir Ty<'hir>, Mutability, BodyId) {
3095-
let ItemKind::Static(ty, mutbl, body) = self.kind else { self.expect_failed("a static") };
3096-
(ty, mutbl, body)
3097-
}
3098-
/// Expect an [`ItemKind::Const`] or panic.
3099-
#[track_caller]
3100-
pub fn expect_const(&self) -> (&'hir Ty<'hir>, &'hir Generics<'hir>, BodyId) {
3101-
let ItemKind::Const(ty, gen, body) = self.kind else { self.expect_failed("a constant") };
3102-
(ty, gen, body)
3103-
}
3104-
/// Expect an [`ItemKind::Fn`] or panic.
3105-
#[track_caller]
3106-
pub fn expect_fn(&self) -> (&FnSig<'hir>, &'hir Generics<'hir>, BodyId) {
3107-
let ItemKind::Fn(sig, gen, body) = &self.kind else { self.expect_failed("a function") };
3108-
(sig, gen, *body)
3109-
}
3077+
expect_static, (&'hir Ty<'hir>, Mutability, BodyId),
3078+
ItemKind::Static(ty, mutbl, body), (ty, *mutbl, *body);
31103079

3111-
/// Expect an [`ItemKind::Macro`] or panic.
3112-
#[track_caller]
3113-
pub fn expect_macro(&self) -> (&ast::MacroDef, MacroKind) {
3114-
let ItemKind::Macro(def, mk) = &self.kind else { self.expect_failed("a macro") };
3115-
(def, *mk)
3116-
}
3080+
expect_const, (&'hir Ty<'hir>, &'hir Generics<'hir>, BodyId),
3081+
ItemKind::Const(ty, gen, body), (ty, gen, *body);
31173082

3118-
/// Expect an [`ItemKind::Mod`] or panic.
3119-
#[track_caller]
3120-
pub fn expect_mod(&self) -> &'hir Mod<'hir> {
3121-
let ItemKind::Mod(m) = self.kind else { self.expect_failed("a module") };
3122-
m
3123-
}
3083+
expect_fn, (&FnSig<'hir>, &'hir Generics<'hir>, BodyId),
3084+
ItemKind::Fn(sig, gen, body), (sig, gen, *body);
31243085

3125-
/// Expect an [`ItemKind::ForeignMod`] or panic.
3126-
#[track_caller]
3127-
pub fn expect_foreign_mod(&self) -> (Abi, &'hir [ForeignItemRef]) {
3128-
let ItemKind::ForeignMod { abi, items } = self.kind else {
3129-
self.expect_failed("a foreign module")
3130-
};
3131-
(abi, items)
3132-
}
3086+
expect_macro, (&ast::MacroDef, MacroKind), ItemKind::Macro(def, mk), (def, *mk);
31333087

3134-
/// Expect an [`ItemKind::GlobalAsm`] or panic.
3135-
#[track_caller]
3136-
pub fn expect_global_asm(&self) -> &'hir InlineAsm<'hir> {
3137-
let ItemKind::GlobalAsm(asm) = self.kind else { self.expect_failed("a global asm") };
3138-
asm
3139-
}
3088+
expect_mod, &'hir Mod<'hir>, ItemKind::Mod(m), m;
31403089

3141-
/// Expect an [`ItemKind::TyAlias`] or panic.
3142-
#[track_caller]
3143-
pub fn expect_ty_alias(&self) -> (&'hir Ty<'hir>, &'hir Generics<'hir>) {
3144-
let ItemKind::TyAlias(ty, gen) = self.kind else { self.expect_failed("a type alias") };
3145-
(ty, gen)
3146-
}
3090+
expect_foreign_mod, (Abi, &'hir [ForeignItemRef]),
3091+
ItemKind::ForeignMod { abi, items }, (*abi, items);
31473092

3148-
/// Expect an [`ItemKind::OpaqueTy`] or panic.
3149-
#[track_caller]
3150-
pub fn expect_opaque_ty(&self) -> &OpaqueTy<'hir> {
3151-
let ItemKind::OpaqueTy(ty) = &self.kind else { self.expect_failed("an opaque type") };
3152-
ty
3153-
}
3093+
expect_global_asm, &'hir InlineAsm<'hir>, ItemKind::GlobalAsm(asm), asm;
31543094

3155-
/// Expect an [`ItemKind::Enum`] or panic.
3156-
#[track_caller]
3157-
pub fn expect_enum(&self) -> (&EnumDef<'hir>, &'hir Generics<'hir>) {
3158-
let ItemKind::Enum(def, gen) = &self.kind else { self.expect_failed("an enum") };
3159-
(def, gen)
3160-
}
3095+
expect_ty_alias, (&'hir Ty<'hir>, &'hir Generics<'hir>),
3096+
ItemKind::TyAlias(ty, gen), (ty, gen);
31613097

3162-
/// Expect an [`ItemKind::Struct`] or panic.
3163-
#[track_caller]
3164-
pub fn expect_struct(&self) -> (&VariantData<'hir>, &'hir Generics<'hir>) {
3165-
let ItemKind::Struct(data, gen) = &self.kind else { self.expect_failed("a struct") };
3166-
(data, gen)
3167-
}
3098+
expect_opaque_ty, &OpaqueTy<'hir>, ItemKind::OpaqueTy(ty), ty;
31683099

3169-
/// Expect an [`ItemKind::Union`] or panic.
3170-
#[track_caller]
3171-
pub fn expect_union(&self) -> (&VariantData<'hir>, &'hir Generics<'hir>) {
3172-
let ItemKind::Union(data, gen) = &self.kind else { self.expect_failed("a union") };
3173-
(data, gen)
3174-
}
3100+
expect_enum, (&EnumDef<'hir>, &'hir Generics<'hir>), ItemKind::Enum(def, gen), (def, gen);
31753101

3176-
/// Expect an [`ItemKind::Trait`] or panic.
3177-
#[track_caller]
3178-
pub fn expect_trait(
3179-
self,
3180-
) -> (IsAuto, Unsafety, &'hir Generics<'hir>, GenericBounds<'hir>, &'hir [TraitItemRef]) {
3181-
let ItemKind::Trait(is_auto, unsafety, gen, bounds, items) = self.kind else {
3182-
self.expect_failed("a trait")
3183-
};
3184-
(is_auto, unsafety, gen, bounds, items)
3185-
}
3102+
expect_struct, (&VariantData<'hir>, &'hir Generics<'hir>),
3103+
ItemKind::Struct(data, gen), (data, gen);
31863104

3187-
/// Expect an [`ItemKind::TraitAlias`] or panic.
3188-
#[track_caller]
3189-
pub fn expect_trait_alias(&self) -> (&'hir Generics<'hir>, GenericBounds<'hir>) {
3190-
let ItemKind::TraitAlias(gen, bounds) = self.kind else {
3191-
self.expect_failed("a trait alias")
3192-
};
3193-
(gen, bounds)
3194-
}
3105+
expect_union, (&VariantData<'hir>, &'hir Generics<'hir>),
3106+
ItemKind::Union(data, gen), (data, gen);
31953107

3196-
/// Expect an [`ItemKind::Impl`] or panic.
3197-
#[track_caller]
3198-
pub fn expect_impl(&self) -> &'hir Impl<'hir> {
3199-
let ItemKind::Impl(imp) = self.kind else { self.expect_failed("an impl") };
3200-
imp
3201-
}
3108+
expect_trait,
3109+
(IsAuto, Unsafety, &'hir Generics<'hir>, GenericBounds<'hir>, &'hir [TraitItemRef]),
3110+
ItemKind::Trait(is_auto, unsafety, gen, bounds, items),
3111+
(*is_auto, *unsafety, gen, bounds, items);
32023112

3203-
#[track_caller]
3204-
fn expect_failed(&self, expected: &'static str) -> ! {
3205-
panic!("expected {expected} item, found {self:?}")
3113+
expect_trait_alias, (&'hir Generics<'hir>, GenericBounds<'hir>),
3114+
ItemKind::TraitAlias(gen, bounds), (gen, bounds);
3115+
3116+
expect_impl, &'hir Impl<'hir>, ItemKind::Impl(imp), imp;
32063117
}
32073118
}
32083119

@@ -3574,32 +3485,11 @@ impl<'hir> OwnerNode<'hir> {
35743485
}
35753486
}
35763487

3577-
pub fn expect_item(self) -> &'hir Item<'hir> {
3578-
match self {
3579-
OwnerNode::Item(n) => n,
3580-
_ => panic!(),
3581-
}
3582-
}
3583-
3584-
pub fn expect_foreign_item(self) -> &'hir ForeignItem<'hir> {
3585-
match self {
3586-
OwnerNode::ForeignItem(n) => n,
3587-
_ => panic!(),
3588-
}
3589-
}
3590-
3591-
pub fn expect_impl_item(self) -> &'hir ImplItem<'hir> {
3592-
match self {
3593-
OwnerNode::ImplItem(n) => n,
3594-
_ => panic!(),
3595-
}
3596-
}
3597-
3598-
pub fn expect_trait_item(self) -> &'hir TraitItem<'hir> {
3599-
match self {
3600-
OwnerNode::TraitItem(n) => n,
3601-
_ => panic!(),
3602-
}
3488+
expect_methods_self! {
3489+
expect_item, &'hir Item<'hir>, OwnerNode::Item(n), n;
3490+
expect_foreign_item, &'hir ForeignItem<'hir>, OwnerNode::ForeignItem(n), n;
3491+
expect_impl_item, &'hir ImplItem<'hir>, OwnerNode::ImplItem(n), n;
3492+
expect_trait_item, &'hir TraitItem<'hir>, OwnerNode::TraitItem(n), n;
36033493
}
36043494
}
36053495

@@ -3852,190 +3742,33 @@ impl<'hir> Node<'hir> {
38523742
}
38533743
}
38543744

3855-
/// Expect a [`Node::Param`] or panic.
3856-
#[track_caller]
3857-
pub fn expect_param(self) -> &'hir Param<'hir> {
3858-
let Node::Param(this) = self else { self.expect_failed("a parameter") };
3859-
this
3860-
}
3861-
3862-
/// Expect a [`Node::Item`] or panic.
3863-
#[track_caller]
3864-
pub fn expect_item(self) -> &'hir Item<'hir> {
3865-
let Node::Item(this) = self else { self.expect_failed("a item") };
3866-
this
3867-
}
3868-
3869-
/// Expect a [`Node::ForeignItem`] or panic.
3870-
#[track_caller]
3871-
pub fn expect_foreign_item(self) -> &'hir ForeignItem<'hir> {
3872-
let Node::ForeignItem(this) = self else { self.expect_failed("a foreign item") };
3873-
this
3874-
}
3875-
3876-
/// Expect a [`Node::TraitItem`] or panic.
3877-
#[track_caller]
3878-
pub fn expect_trait_item(self) -> &'hir TraitItem<'hir> {
3879-
let Node::TraitItem(this) = self else { self.expect_failed("a trait item") };
3880-
this
3881-
}
3882-
3883-
/// Expect a [`Node::ImplItem`] or panic.
3884-
#[track_caller]
3885-
pub fn expect_impl_item(self) -> &'hir ImplItem<'hir> {
3886-
let Node::ImplItem(this) = self else { self.expect_failed("an implementation item") };
3887-
this
3888-
}
3889-
3890-
/// Expect a [`Node::Variant`] or panic.
3891-
#[track_caller]
3892-
pub fn expect_variant(self) -> &'hir Variant<'hir> {
3893-
let Node::Variant(this) = self else { self.expect_failed("a variant") };
3894-
this
3895-
}
3896-
3897-
/// Expect a [`Node::Field`] or panic.
3898-
#[track_caller]
3899-
pub fn expect_field(self) -> &'hir FieldDef<'hir> {
3900-
let Node::Field(this) = self else { self.expect_failed("a field definition") };
3901-
this
3902-
}
3903-
3904-
/// Expect a [`Node::AnonConst`] or panic.
3905-
#[track_caller]
3906-
pub fn expect_anon_const(self) -> &'hir AnonConst {
3907-
let Node::AnonConst(this) = self else { self.expect_failed("an anonymous constant") };
3908-
this
3909-
}
3910-
3911-
/// Expect a [`Node::ConstBlock`] or panic.
3912-
#[track_caller]
3913-
pub fn expect_inline_const(self) -> &'hir ConstBlock {
3914-
let Node::ConstBlock(this) = self else { self.expect_failed("an inline constant") };
3915-
this
3916-
}
3917-
3918-
/// Expect a [`Node::Expr`] or panic.
3919-
#[track_caller]
3920-
pub fn expect_expr(self) -> &'hir Expr<'hir> {
3921-
let Node::Expr(this) = self else { self.expect_failed("an expression") };
3922-
this
3923-
}
3924-
/// Expect a [`Node::ExprField`] or panic.
3925-
#[track_caller]
3926-
pub fn expect_expr_field(self) -> &'hir ExprField<'hir> {
3927-
let Node::ExprField(this) = self else { self.expect_failed("an expression field") };
3928-
this
3929-
}
3930-
3931-
/// Expect a [`Node::Stmt`] or panic.
3932-
#[track_caller]
3933-
pub fn expect_stmt(self) -> &'hir Stmt<'hir> {
3934-
let Node::Stmt(this) = self else { self.expect_failed("a statement") };
3935-
this
3936-
}
3937-
3938-
/// Expect a [`Node::PathSegment`] or panic.
3939-
#[track_caller]
3940-
pub fn expect_path_segment(self) -> &'hir PathSegment<'hir> {
3941-
let Node::PathSegment(this) = self else { self.expect_failed("a path segment") };
3942-
this
3943-
}
3944-
3945-
/// Expect a [`Node::Ty`] or panic.
3946-
#[track_caller]
3947-
pub fn expect_ty(self) -> &'hir Ty<'hir> {
3948-
let Node::Ty(this) = self else { self.expect_failed("a type") };
3949-
this
3950-
}
3951-
3952-
/// Expect a [`Node::TypeBinding`] or panic.
3953-
#[track_caller]
3954-
pub fn expect_type_binding(self) -> &'hir TypeBinding<'hir> {
3955-
let Node::TypeBinding(this) = self else { self.expect_failed("a type binding") };
3956-
this
3957-
}
3958-
3959-
/// Expect a [`Node::TraitRef`] or panic.
3960-
#[track_caller]
3961-
pub fn expect_trait_ref(self) -> &'hir TraitRef<'hir> {
3962-
let Node::TraitRef(this) = self else { self.expect_failed("a trait reference") };
3963-
this
3964-
}
3965-
3966-
/// Expect a [`Node::Pat`] or panic.
3967-
#[track_caller]
3968-
pub fn expect_pat(self) -> &'hir Pat<'hir> {
3969-
let Node::Pat(this) = self else { self.expect_failed("a pattern") };
3970-
this
3971-
}
3972-
3973-
/// Expect a [`Node::PatField`] or panic.
3974-
#[track_caller]
3975-
pub fn expect_pat_field(self) -> &'hir PatField<'hir> {
3976-
let Node::PatField(this) = self else { self.expect_failed("a pattern field") };
3977-
this
3978-
}
3979-
3980-
/// Expect a [`Node::Arm`] or panic.
3981-
#[track_caller]
3982-
pub fn expect_arm(self) -> &'hir Arm<'hir> {
3983-
let Node::Arm(this) = self else { self.expect_failed("an arm") };
3984-
this
3985-
}
3986-
3987-
/// Expect a [`Node::Block`] or panic.
3988-
#[track_caller]
3989-
pub fn expect_block(self) -> &'hir Block<'hir> {
3990-
let Node::Block(this) = self else { self.expect_failed("a block") };
3991-
this
3992-
}
3993-
3994-
/// Expect a [`Node::Local`] or panic.
3995-
#[track_caller]
3996-
pub fn expect_local(self) -> &'hir Local<'hir> {
3997-
let Node::Local(this) = self else { self.expect_failed("a local") };
3998-
this
3999-
}
4000-
4001-
/// Expect a [`Node::Ctor`] or panic.
4002-
#[track_caller]
4003-
pub fn expect_ctor(self) -> &'hir VariantData<'hir> {
4004-
let Node::Ctor(this) = self else { self.expect_failed("a constructor") };
4005-
this
4006-
}
4007-
4008-
/// Expect a [`Node::Lifetime`] or panic.
4009-
#[track_caller]
4010-
pub fn expect_lifetime(self) -> &'hir Lifetime {
4011-
let Node::Lifetime(this) = self else { self.expect_failed("a lifetime") };
4012-
this
4013-
}
4014-
4015-
/// Expect a [`Node::GenericParam`] or panic.
4016-
#[track_caller]
4017-
pub fn expect_generic_param(self) -> &'hir GenericParam<'hir> {
4018-
let Node::GenericParam(this) = self else { self.expect_failed("a generic parameter") };
4019-
this
4020-
}
4021-
4022-
/// Expect a [`Node::Crate`] or panic.
4023-
#[track_caller]
4024-
pub fn expect_crate(self) -> &'hir Mod<'hir> {
4025-
let Node::Crate(this) = self else { self.expect_failed("a crate") };
4026-
this
4027-
}
4028-
4029-
/// Expect a [`Node::Infer`] or panic.
4030-
#[track_caller]
4031-
pub fn expect_infer(self) -> &'hir InferArg {
4032-
let Node::Infer(this) = self else { self.expect_failed("an infer") };
4033-
this
4034-
}
4035-
4036-
#[track_caller]
4037-
fn expect_failed(&self, expected: &'static str) -> ! {
4038-
panic!("expected {expected} node, found {self:?}")
3745+
expect_methods_self! {
3746+
expect_param, &'hir Param<'hir>, Node::Param(n), n;
3747+
expect_item, &'hir Item<'hir>, Node::Item(n), n;
3748+
expect_foreign_item, &'hir ForeignItem<'hir>, Node::ForeignItem(n), n;
3749+
expect_trait_item, &'hir TraitItem<'hir>, Node::TraitItem(n), n;
3750+
expect_impl_item, &'hir ImplItem<'hir>, Node::ImplItem(n), n;
3751+
expect_variant, &'hir Variant<'hir>, Node::Variant(n), n;
3752+
expect_field, &'hir FieldDef<'hir>, Node::Field(n), n;
3753+
expect_anon_const, &'hir AnonConst, Node::AnonConst(n), n;
3754+
expect_inline_const, &'hir ConstBlock, Node::ConstBlock(n), n;
3755+
expect_expr, &'hir Expr<'hir>, Node::Expr(n), n;
3756+
expect_expr_field, &'hir ExprField<'hir>, Node::ExprField(n), n;
3757+
expect_stmt, &'hir Stmt<'hir>, Node::Stmt(n), n;
3758+
expect_path_segment, &'hir PathSegment<'hir>, Node::PathSegment(n), n;
3759+
expect_ty, &'hir Ty<'hir>, Node::Ty(n), n;
3760+
expect_type_binding, &'hir TypeBinding<'hir>, Node::TypeBinding(n), n;
3761+
expect_trait_ref, &'hir TraitRef<'hir>, Node::TraitRef(n), n;
3762+
expect_pat, &'hir Pat<'hir>, Node::Pat(n), n;
3763+
expect_pat_field, &'hir PatField<'hir>, Node::PatField(n), n;
3764+
expect_arm, &'hir Arm<'hir>, Node::Arm(n), n;
3765+
expect_block, &'hir Block<'hir>, Node::Block(n), n;
3766+
expect_local, &'hir Local<'hir>, Node::Local(n), n;
3767+
expect_ctor, &'hir VariantData<'hir>, Node::Ctor(n), n;
3768+
expect_lifetime, &'hir Lifetime, Node::Lifetime(n), n;
3769+
expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;
3770+
expect_crate, &'hir Mod<'hir>, Node::Crate(n), n;
3771+
expect_infer, &'hir InferArg, Node::Infer(n), n;
40393772
}
40403773
}
40413774

0 commit comments

Comments
 (0)
Please sign in to comment.