File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -490,10 +490,11 @@ impl<T: sealed::Context> Features<T> {
490
490
/// Converts `Features<T>` to `Features<C>`. Only known `T` features relevant to context `C` are
491
491
/// included in the result.
492
492
fn to_context_internal < C : sealed:: Context > ( & self ) -> Features < C > {
493
- let byte_count = C :: KNOWN_FEATURE_MASK . len ( ) ;
493
+ let from_byte_count = T :: KNOWN_FEATURE_MASK . len ( ) ;
494
+ let to_byte_count = C :: KNOWN_FEATURE_MASK . len ( ) ;
494
495
let mut flags = Vec :: new ( ) ;
495
496
for ( i, byte) in self . flags . iter ( ) . enumerate ( ) {
496
- if i < byte_count {
497
+ if i < from_byte_count && i < to_byte_count {
497
498
let known_source_features = T :: KNOWN_FEATURE_MASK [ i] ;
498
499
let known_target_features = C :: KNOWN_FEATURE_MASK [ i] ;
499
500
flags. push ( byte & known_source_features & known_target_features) ;
You can’t perform that action at this time.
0 commit comments