@@ -359,20 +359,25 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
359
359
let next_opaque = self . next_opaque . as_mut ( ) ?;
360
360
let disambiguator = * next_opaque;
361
361
* next_opaque += 1 ;
362
- assert_ne ! ( disambiguator, 0 ) ;
362
+ // `disambiguator: 0` means deterministic.
363
+ debug_assert_ne ! ( disambiguator, 0 ) ;
363
364
disambiguator
364
365
} ;
365
366
Some ( self . insert ( Value :: Constant { value, disambiguator } ) )
366
367
}
367
368
368
369
fn insert_bool ( & mut self , flag : bool ) -> VnIndex {
369
370
// Booleans are deterministic.
370
- self . insert ( Value :: Constant { value : Const :: from_bool ( self . tcx , flag) , disambiguator : 0 } )
371
+ let value = Const :: from_bool ( self . tcx , flag) ;
372
+ debug_assert ! ( value. is_deterministic( ) ) ;
373
+ self . insert ( Value :: Constant { value, disambiguator : 0 } )
371
374
}
372
375
373
376
fn insert_scalar ( & mut self , scalar : Scalar , ty : Ty < ' tcx > ) -> VnIndex {
374
- self . insert_constant ( Const :: from_scalar ( self . tcx , scalar, ty) )
375
- . expect ( "scalars are deterministic" )
377
+ // Scalars are deterministic.
378
+ let value = Const :: from_scalar ( self . tcx , scalar, ty) ;
379
+ debug_assert ! ( value. is_deterministic( ) ) ;
380
+ self . insert ( Value :: Constant { value, disambiguator : 0 } )
376
381
}
377
382
378
383
fn insert_tuple ( & mut self , values : Vec < VnIndex > ) -> VnIndex {
@@ -1391,7 +1396,7 @@ impl<'tcx> VnState<'_, 'tcx> {
1391
1396
// deterministic, adding an additional mention of it in MIR will not give the same value as
1392
1397
// the former mention.
1393
1398
if let Value :: Constant { value, disambiguator : 0 } = * self . get ( index) {
1394
- assert ! ( value. is_deterministic( ) ) ;
1399
+ debug_assert ! ( value. is_deterministic( ) ) ;
1395
1400
return Some ( ConstOperand { span : DUMMY_SP , user_ty : None , const_ : value } ) ;
1396
1401
}
1397
1402
0 commit comments