File tree 1 file changed +3
-3
lines changed
compiler/rustc_middle/src/ty
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;
18
18
use rustc_hir:: def_id:: { CrateNum , DefId } ;
19
19
use rustc_serialize:: { Decodable , Decoder , Encodable , Encoder } ;
20
20
use rustc_span:: Span ;
21
- use std:: convert:: { TryFrom , TryInto } ;
22
21
use std:: hash:: Hash ;
23
22
use std:: intrinsics;
24
23
use std:: marker:: DiscriminantKind ;
81
80
E : TyEncoder < ' tcx > ,
82
81
M : for < ' b > Fn ( & ' b mut E ) -> & ' b mut FxHashMap < T , usize > ,
83
82
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 > ,
85
85
{
86
86
let existing_shorthand = cache ( encoder) . get ( value) . copied ( ) ;
87
87
if let Some ( shorthand) = existing_shorthand {
97
97
// The shorthand encoding uses the same usize as the
98
98
// discriminant, with an offset so they can't conflict.
99
99
let discriminant = intrinsics:: discriminant_value ( variant) ;
100
- assert ! ( discriminant < SHORTHAND_OFFSET . try_into ( ) . ok ( ) . unwrap ( ) ) ;
100
+ assert ! ( SHORTHAND_OFFSET > discriminant as usize ) ;
101
101
102
102
let shorthand = start + SHORTHAND_OFFSET ;
103
103
You can’t perform that action at this time.
0 commit comments