@@ -175,19 +175,15 @@ impl<'tcx> UnifyKey for ty::ConstVid<'tcx> {
175
175
impl < ' tcx > UnifyValue for ConstVarValue < ' tcx > {
176
176
type Error = ( & ' tcx ty:: Const < ' tcx > , & ' tcx ty:: Const < ' tcx > ) ;
177
177
178
- fn unify_values ( value1 : & Self , value2 : & Self ) -> Result < Self , Self :: Error > {
179
- let ( val , origin ) = match ( value1. val , value2. val ) {
178
+ fn unify_values ( & value1: & Self , & value2: & Self ) -> Result < Self , Self :: Error > {
179
+ Ok ( match ( value1. val , value2. val ) {
180
180
( ConstVariableValue :: Known { .. } , ConstVariableValue :: Known { .. } ) => {
181
181
bug ! ( "equating two const variables, both of which have known values" )
182
182
}
183
183
184
184
// If one side is known, prefer that one.
185
- ( ConstVariableValue :: Known { .. } , ConstVariableValue :: Unknown { .. } ) => {
186
- ( value1. val , value1. origin )
187
- }
188
- ( ConstVariableValue :: Unknown { .. } , ConstVariableValue :: Known { .. } ) => {
189
- ( value2. val , value2. origin )
190
- }
185
+ ( ConstVariableValue :: Known { .. } , ConstVariableValue :: Unknown { .. } ) => value1,
186
+ ( ConstVariableValue :: Unknown { .. } , ConstVariableValue :: Known { .. } ) => value2,
191
187
192
188
// If both sides are *unknown*, it hardly matters, does it?
193
189
(
@@ -200,11 +196,12 @@ impl<'tcx> UnifyValue for ConstVarValue<'tcx> {
200
196
// universe is the minimum of the two universes, because that is
201
197
// the one which contains the fewest names in scope.
202
198
let universe = cmp:: min ( universe1, universe2) ;
203
- ( ConstVariableValue :: Unknown { universe } , value1. origin )
199
+ ConstVarValue {
200
+ val : ConstVariableValue :: Unknown { universe } ,
201
+ origin : value1. origin ,
202
+ }
204
203
}
205
- } ;
206
-
207
- Ok ( ConstVarValue { origin, val } )
204
+ } )
208
205
}
209
206
}
210
207
0 commit comments