File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,7 @@ pub fn generate_register() {
154
154
entry. global_name,
155
155
)
156
156
. unwrap ( ) ;
157
+ // Register all the trait items for each impl so we can dispatch to them as turbotasks
157
158
for trait_ident in & entry. trait_idents {
158
159
writeln ! (
159
160
values_code,
@@ -164,6 +165,8 @@ pub fn generate_register() {
164
165
. unwrap ( ) ;
165
166
}
166
167
writeln ! ( values_code, "}}, #[allow(unused_variables)] |value_id| {{" ) . unwrap ( ) ;
168
+ // Register all the vtables for the impls so we can dispatch to them as normal indirect
169
+ // trait calls.
167
170
for trait_ident in & entry. trait_idents {
168
171
writeln ! (
169
172
values_code,
Original file line number Diff line number Diff line change @@ -91,8 +91,8 @@ impl<T: ?Sized> VTableRegistry<T> {
91
91
debug_assert ! ( prev. is_none( ) , "{id} was already registered" ) ;
92
92
}
93
93
94
- pub ( crate ) fn get ( & self , id : & ValueTypeId ) -> Option < DynMetadata < T > > {
95
- self . map . get ( id) . map ( |r| * r . value ( ) )
94
+ pub ( crate ) fn get ( & self , id : ValueTypeId ) -> DynMetadata < T > {
95
+ * self . map . get ( & id) . unwrap ( ) . value ( )
96
96
}
97
97
}
98
98
Original file line number Diff line number Diff line change @@ -97,11 +97,10 @@ where
97
97
type Target = U ;
98
98
99
99
fn deref ( & self ) -> & Self :: Target {
100
- // This lookup will fail if the valuye type stored does not actually implement the trait,
100
+ // This lookup will fail if the value type stored does not actually implement the trait,
101
101
// which implies a bug in either the registry code or the macro code.
102
- let metadata = <Box < U > as VcValueTrait >:: get_impl_vtables ( )
103
- . get ( & self . shared_reference . type_id )
104
- . unwrap ( ) ;
102
+ let metadata =
103
+ <Box < U > as VcValueTrait >:: get_impl_vtables ( ) . get ( self . shared_reference . type_id ) ;
105
104
let downcast_ptr = std:: ptr:: from_raw_parts (
106
105
self . shared_reference . reference . 0 . as_ptr ( ) as * const ( ) ,
107
106
metadata,
You can’t perform that action at this time.
0 commit comments