This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ use rustc_data_structures::fx::FxHashMap;
1818use rustc_hir:: def_id:: { CrateNum , DefId } ;
1919use rustc_serialize:: { Decodable , Decoder , Encodable , Encoder } ;
2020use rustc_span:: Span ;
21- use std:: convert:: { TryFrom , TryInto } ;
2221use std:: hash:: Hash ;
2322use std:: intrinsics;
2423use std:: marker:: DiscriminantKind ;
8180 E : TyEncoder < ' tcx > ,
8281 M : for < ' b > Fn ( & ' b mut E ) -> & ' b mut FxHashMap < T , usize > ,
8382 T : EncodableWithShorthand < ' tcx , E > ,
84- <T :: Variant as DiscriminantKind >:: Discriminant : Ord + TryFrom < usize > ,
83+ // The discriminant and shorthand must have the same size.
84+ T :: Variant : DiscriminantKind < Discriminant = isize > ,
8585{
8686 let existing_shorthand = cache ( encoder) . get ( value) . copied ( ) ;
8787 if let Some ( shorthand) = existing_shorthand {
9797 // The shorthand encoding uses the same usize as the
9898 // discriminant, with an offset so they can't conflict.
9999 let discriminant = intrinsics:: discriminant_value ( variant) ;
100- assert ! ( discriminant < SHORTHAND_OFFSET . try_into ( ) . ok ( ) . unwrap ( ) ) ;
100+ assert ! ( SHORTHAND_OFFSET > discriminant as usize ) ;
101101
102102 let shorthand = start + SHORTHAND_OFFSET ;
103103
You can’t perform that action at this time.
0 commit comments