@@ -163,40 +163,30 @@ impl<'b> NativeContext<'_, 'b> {
163
163
// used in test scenarios so we have some special knowledge that makes this work. In the new VM
164
164
// however this is _MUCH_ nicer as we don't need to pass the datastore as the VM's linkage
165
165
// tables must have the type present.
166
- pub fn type_tag_to_fully_annotated_layout (
166
+ pub fn type_tag_to_fully_annotated_layout_for_test_scenario_only (
167
167
& self ,
168
168
tag : & TypeTag ,
169
169
store : & impl DataStore ,
170
- ) -> PartialVMResult < Option < A :: MoveTypeLayout > > {
171
- match self
172
- . resolver
170
+ ) -> PartialVMResult < A :: MoveTypeLayout > {
171
+ self . resolver
173
172
. loader ( )
174
173
. get_fully_annotated_type_layout ( tag, store)
175
- {
176
- Ok ( ty_layout) => Ok ( Some ( ty_layout) ) ,
177
- Err ( e) if e. major_status ( ) . status_type ( ) == StatusType :: InvariantViolation => {
178
- Err ( e. to_partial ( ) )
179
- }
180
- Err ( _) => Ok ( None ) ,
181
- }
174
+ . map_err ( |e| e. to_partial ( ) )
182
175
}
183
176
184
177
// TODO: This is a bit hacky right now since we need to pass the store, however this is only
185
178
// used in test scenarios so we have some special knowledge that makes this work. In the new VM
186
179
// however this is _MUCH_ nicer as we don't need to pass the datastore as the VM's linkage
187
180
// tables must have the type present.
188
- pub fn type_tag_to_layout (
181
+ pub fn type_tag_to_layout_for_test_scenario_only (
189
182
& self ,
190
183
tag : & TypeTag ,
191
184
store : & impl DataStore ,
192
- ) -> PartialVMResult < Option < R :: MoveTypeLayout > > {
193
- match self . resolver . loader ( ) . get_type_layout ( tag, store) {
194
- Ok ( ty_layout) => Ok ( Some ( ty_layout) ) ,
195
- Err ( e) if e. major_status ( ) . status_type ( ) == StatusType :: InvariantViolation => {
196
- Err ( e. to_partial ( ) )
197
- }
198
- Err ( _) => Ok ( None ) ,
199
- }
185
+ ) -> PartialVMResult < R :: MoveTypeLayout > {
186
+ self . resolver
187
+ . loader ( )
188
+ . get_type_layout ( tag, store)
189
+ . map_err ( |e| e. to_partial ( ) )
200
190
}
201
191
202
192
pub fn type_to_abilities ( & self , ty : & Type ) -> PartialVMResult < AbilitySet > {
0 commit comments