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