@@ -82,9 +82,6 @@ pub struct Mir<'tcx> {
82
82
/// in scope, but a separate set of locals.
83
83
pub promoted : IndexVec < Promoted , Mir < ' tcx > > ,
84
84
85
- /// Return type of the function.
86
- pub return_ty : Ty < ' tcx > ,
87
-
88
85
/// Yield type of the function, if it is a generator.
89
86
pub yield_ty : Option < Ty < ' tcx > > ,
90
87
@@ -135,7 +132,6 @@ impl<'tcx> Mir<'tcx> {
135
132
visibility_scope_info : ClearOnDecode < IndexVec < VisibilityScope ,
136
133
VisibilityScopeInfo > > ,
137
134
promoted : IndexVec < Promoted , Mir < ' tcx > > ,
138
- return_ty : Ty < ' tcx > ,
139
135
yield_ty : Option < Ty < ' tcx > > ,
140
136
local_decls : IndexVec < Local , LocalDecl < ' tcx > > ,
141
137
arg_count : usize ,
@@ -145,14 +141,12 @@ impl<'tcx> Mir<'tcx> {
145
141
// We need `arg_count` locals, and one for the return pointer
146
142
assert ! ( local_decls. len( ) >= arg_count + 1 ,
147
143
"expected at least {} locals, got {}" , arg_count + 1 , local_decls. len( ) ) ;
148
- assert_eq ! ( local_decls[ RETURN_POINTER ] . ty, return_ty) ;
149
144
150
145
Mir {
151
146
basic_blocks,
152
147
visibility_scopes,
153
148
visibility_scope_info,
154
149
promoted,
155
- return_ty,
156
150
yield_ty,
157
151
generator_drop : None ,
158
152
generator_layout : None ,
@@ -273,6 +267,11 @@ impl<'tcx> Mir<'tcx> {
273
267
& block. terminator ( ) . source_info
274
268
}
275
269
}
270
+
271
+ /// Return the return type, it always return first element from `local_decls` array
272
+ pub fn return_ty ( & self ) -> Ty < ' tcx > {
273
+ self . local_decls [ RETURN_POINTER ] . ty
274
+ }
276
275
}
277
276
278
277
#[ derive( Clone , Debug ) ]
@@ -299,7 +298,6 @@ impl_stable_hash_for!(struct Mir<'tcx> {
299
298
visibility_scopes,
300
299
visibility_scope_info,
301
300
promoted,
302
- return_ty,
303
301
yield_ty,
304
302
generator_drop,
305
303
generator_layout,
@@ -1744,7 +1742,6 @@ impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx> {
1744
1742
visibility_scopes : self . visibility_scopes . clone ( ) ,
1745
1743
visibility_scope_info : self . visibility_scope_info . clone ( ) ,
1746
1744
promoted : self . promoted . fold_with ( folder) ,
1747
- return_ty : self . return_ty . fold_with ( folder) ,
1748
1745
yield_ty : self . yield_ty . fold_with ( folder) ,
1749
1746
generator_drop : self . generator_drop . fold_with ( folder) ,
1750
1747
generator_layout : self . generator_layout . fold_with ( folder) ,
@@ -1763,7 +1760,6 @@ impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx> {
1763
1760
self . generator_layout . visit_with ( visitor) ||
1764
1761
self . yield_ty . visit_with ( visitor) ||
1765
1762
self . promoted . visit_with ( visitor) ||
1766
- self . return_ty . visit_with ( visitor) ||
1767
1763
self . local_decls . visit_with ( visitor)
1768
1764
}
1769
1765
}
0 commit comments