@@ -175,19 +175,15 @@ impl<'tcx> UnifyKey for ty::ConstVid<'tcx> {
175175impl < ' tcx > UnifyValue for ConstVarValue < ' tcx > {
176176 type Error = ( & ' tcx ty:: Const < ' tcx > , & ' tcx ty:: Const < ' tcx > ) ;
177177
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 ) {
180180 ( ConstVariableValue :: Known { .. } , ConstVariableValue :: Known { .. } ) => {
181181 bug ! ( "equating two const variables, both of which have known values" )
182182 }
183183
184184 // 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,
191187
192188 // If both sides are *unknown*, it hardly matters, does it?
193189 (
@@ -200,11 +196,12 @@ impl<'tcx> UnifyValue for ConstVarValue<'tcx> {
200196 // universe is the minimum of the two universes, because that is
201197 // the one which contains the fewest names in scope.
202198 let universe = cmp:: min ( universe1, universe2) ;
203- ( ConstVariableValue :: Unknown { universe } , value1. origin )
199+ ConstVarValue {
200+ val : ConstVariableValue :: Unknown { universe } ,
201+ origin : value1. origin ,
202+ }
204203 }
205- } ;
206-
207- Ok ( ConstVarValue { origin, val } )
204+ } )
208205 }
209206}
210207
0 commit comments