@@ -84,10 +84,10 @@ macro_rules! thir_with_elements {
8484}
8585
8686thir_with_elements ! {
87- arms: ArmId => Arm < ' tcx> => "a{}" ,
87+ arms: ArmId => Arm => "a{}" ,
8888 blocks: BlockId => Block => "b{}" ,
8989 exprs: ExprId => Expr <' tcx> => "e{}" ,
90- stmts: StmtId => Stmt < ' tcx> => "s{}" ,
90+ stmts: StmtId => Stmt => "s{}" ,
9191 params: ParamId => Param <' tcx> => "p{}" ,
9292 pats: PatId => Pat <' tcx> => "pat{}" ,
9393}
@@ -103,7 +103,7 @@ pub enum BodyTy<'tcx> {
103103#[ derive( Debug , HashStable ) ]
104104pub struct Param < ' tcx > {
105105 /// The pattern that appears in the parameter list, or None for implicit parameters.
106- pub pat : Option < Box < Pat < ' tcx > > > ,
106+ pub pat : Option < PatId > ,
107107 /// The possibly inferred type.
108108 pub ty : Ty < ' tcx > ,
109109 /// Span of the explicitly provided type, or None if inferred for closures.
@@ -198,12 +198,12 @@ pub enum BlockSafety {
198198}
199199
200200#[ derive( Debug , HashStable ) ]
201- pub struct Stmt < ' tcx > {
202- pub kind : StmtKind < ' tcx > ,
201+ pub struct Stmt {
202+ pub kind : StmtKind ,
203203}
204204
205205#[ derive( Debug , HashStable ) ]
206- pub enum StmtKind < ' tcx > {
206+ pub enum StmtKind {
207207 /// An expression with a trailing semicolon.
208208 Expr {
209209 /// The scope for this statement; may be used as lifetime of temporaries.
@@ -226,7 +226,7 @@ pub enum StmtKind<'tcx> {
226226 /// `let <PAT> = ...`
227227 ///
228228 /// If a type annotation is included, it is added as an ascription pattern.
229- pattern : Box < Pat < ' tcx > > ,
229+ pattern : PatId ,
230230
231231 /// `let pat: ty = <INIT>`
232232 initializer : Option < ExprId > ,
@@ -374,7 +374,7 @@ pub enum ExprKind<'tcx> {
374374 /// (Not to be confused with [`StmtKind::Let`], which is a normal `let` statement.)
375375 Let {
376376 expr : ExprId ,
377- pat : Box < Pat < ' tcx > > ,
377+ pat : PatId ,
378378 } ,
379379 /// A `match` expression.
380380 Match {
@@ -564,8 +564,8 @@ pub struct FruInfo<'tcx> {
564564
565565/// A `match` arm.
566566#[ derive( Debug , HashStable ) ]
567- pub struct Arm < ' tcx > {
568- pub pattern : Box < Pat < ' tcx > > ,
567+ pub struct Arm {
568+ pub pattern : PatId ,
569569 pub guard : Option < ExprId > ,
570570 pub body : ExprId ,
571571 pub lint_level : LintLevel ,
@@ -619,9 +619,9 @@ pub enum InlineAsmOperand<'tcx> {
619619}
620620
621621#[ derive( Debug , HashStable , TypeVisitable ) ]
622- pub struct FieldPat < ' tcx > {
622+ pub struct FieldPat {
623623 pub field : FieldIdx ,
624- pub pattern : Pat < ' tcx > ,
624+ pub pattern : PatId ,
625625}
626626
627627#[ derive( Debug , HashStable , TypeVisitable ) ]
@@ -721,7 +721,7 @@ impl<'tcx> Thir<'tcx> {
721721 false
722722 }
723723 PatKind :: Or { pats } => {
724- is_never_pattern = pats. iter ( ) . all ( |p| self . is_never_pattern ( p ) ) ;
724+ is_never_pattern = pats. iter ( ) . all ( |& p| self . is_never_pattern ( & self [ p ] ) ) ;
725725 false
726726 }
727727 _ => true ,
@@ -761,7 +761,7 @@ pub enum PatKind<'tcx> {
761761
762762 AscribeUserType {
763763 ascription : Ascription < ' tcx > ,
764- subpattern : Box < Pat < ' tcx > > ,
764+ subpattern : PatId ,
765765 } ,
766766
767767 /// `x`, `ref x`, `x @ P`, etc.
@@ -772,7 +772,7 @@ pub enum PatKind<'tcx> {
772772 #[ type_visitable( ignore) ]
773773 var : LocalVarId ,
774774 ty : Ty < ' tcx > ,
775- subpattern : Option < Box < Pat < ' tcx > > > ,
775+ subpattern : Option < PatId > ,
776776
777777 /// Is this the leftmost occurrence of the binding, i.e., is `var` the
778778 /// `HirId` of this pattern?
@@ -788,23 +788,23 @@ pub enum PatKind<'tcx> {
788788 adt_def : AdtDef < ' tcx > ,
789789 args : GenericArgsRef < ' tcx > ,
790790 variant_index : VariantIdx ,
791- subpatterns : Vec < FieldPat < ' tcx > > ,
791+ subpatterns : Vec < FieldPat > ,
792792 } ,
793793
794794 /// `(...)`, `Foo(...)`, `Foo{...}`, or `Foo`, where `Foo` is a variant name from an ADT with
795795 /// a single variant.
796796 Leaf {
797- subpatterns : Vec < FieldPat < ' tcx > > ,
797+ subpatterns : Vec < FieldPat > ,
798798 } ,
799799
800800 /// `box P`, `&P`, `&mut P`, etc.
801801 Deref {
802- subpattern : Box < Pat < ' tcx > > ,
802+ subpattern : PatId ,
803803 } ,
804804
805805 /// Deref pattern, written `box P` for now.
806806 DerefPattern {
807- subpattern : Box < Pat < ' tcx > > ,
807+ subpattern : PatId ,
808808 mutability : hir:: Mutability ,
809809 } ,
810810
@@ -838,7 +838,7 @@ pub enum PatKind<'tcx> {
838838 /// Otherwise, the actual pattern that the constant lowered to. As with
839839 /// other constants, inline constants are matched structurally where
840840 /// possible.
841- subpattern : Box < Pat < ' tcx > > ,
841+ subpattern : PatId ,
842842 } ,
843843
844844 Range ( Arc < PatRange < ' tcx > > ) ,
@@ -847,22 +847,22 @@ pub enum PatKind<'tcx> {
847847 /// irrefutable when there is a slice pattern and both `prefix` and `suffix` are empty.
848848 /// e.g., `&[ref xs @ ..]`.
849849 Slice {
850- prefix : Box < [ Pat < ' tcx > ] > ,
851- slice : Option < Box < Pat < ' tcx > > > ,
852- suffix : Box < [ Pat < ' tcx > ] > ,
850+ prefix : Box < [ PatId ] > ,
851+ slice : Option < PatId > ,
852+ suffix : Box < [ PatId ] > ,
853853 } ,
854854
855855 /// Fixed match against an array; irrefutable.
856856 Array {
857- prefix : Box < [ Pat < ' tcx > ] > ,
858- slice : Option < Box < Pat < ' tcx > > > ,
859- suffix : Box < [ Pat < ' tcx > ] > ,
857+ prefix : Box < [ PatId ] > ,
858+ slice : Option < PatId > ,
859+ suffix : Box < [ PatId ] > ,
860860 } ,
861861
862862 /// An or-pattern, e.g. `p | q`.
863863 /// Invariant: `pats.len() >= 2`.
864864 Or {
865- pats : Box < [ Pat < ' tcx > ] > ,
865+ pats : Box < [ PatId ] > ,
866866 } ,
867867
868868 /// A never pattern `!`.
@@ -1128,7 +1128,7 @@ mod size_asserts {
11281128 static_assert_size ! ( ExprKind <' _>, 40 ) ;
11291129 static_assert_size ! ( Pat <' _>, 64 ) ;
11301130 static_assert_size ! ( PatKind <' _>, 48 ) ;
1131- static_assert_size ! ( Stmt < ' _> , 48 ) ;
1132- static_assert_size ! ( StmtKind < ' _> , 48 ) ;
1131+ static_assert_size ! ( Stmt , 44 ) ;
1132+ static_assert_size ! ( StmtKind , 44 ) ;
11331133 // tidy-alphabetical-end
11341134}
0 commit comments