@@ -86,7 +86,6 @@ pub enum Intrinsic {
86
86
MinNumF32 ,
87
87
MinNumF64 ,
88
88
MulWithOverflow ,
89
- NeedsDrop ,
90
89
PowF32 ,
91
90
PowF64 ,
92
91
PowIF32 ,
@@ -132,8 +131,6 @@ pub enum Intrinsic {
132
131
Transmute ,
133
132
TruncF32 ,
134
133
TruncF64 ,
135
- TypeId ,
136
- TypeName ,
137
134
TypedSwap ,
138
135
UnalignedVolatileLoad ,
139
136
UncheckedDiv ,
@@ -321,10 +318,10 @@ impl Intrinsic {
321
318
assert_sig_matches ! ( sig, _, _ => RigidTy :: Tuple ( _) ) ;
322
319
Self :: MulWithOverflow
323
320
}
324
- "needs_drop" => {
325
- assert_sig_matches ! ( sig , => RigidTy :: Bool ) ;
326
- Self :: NeedsDrop
327
- }
321
+ // For const eval of nullary intrinsics, see https://github.com/rust-lang/rust/pull/142839
322
+ "needs_drop" => unreachable ! (
323
+ "Expected nullary intrinsic `core::intrinsics::type_id` to be const-evaluated before codegen"
324
+ ) ,
328
325
// As of https://github.com/rust-lang/rust/pull/110822 the `offset` intrinsic is lowered to `mir::BinOp::Offset`
329
326
"offset" => unreachable ! (
330
327
"Expected `core::intrinsics::unreachable` to be handled by `BinOp::OffSet`"
@@ -374,14 +371,12 @@ impl Intrinsic {
374
371
assert_sig_matches ! ( sig, _ => _) ;
375
372
Self :: Transmute
376
373
}
377
- "type_id" => {
378
- assert_sig_matches ! ( sig, => RigidTy :: Uint ( UintTy :: U128 ) ) ;
379
- Self :: TypeId
380
- }
381
- "type_name" => {
382
- assert_sig_matches ! ( sig, => RigidTy :: Ref ( _, _, Mutability :: Not ) ) ;
383
- Self :: TypeName
384
- }
374
+ "type_id" => unreachable ! (
375
+ "Expected nullary intrinsic `core::intrinsics::type_id` to be const-evaluated before codegen"
376
+ ) ,
377
+ "type_name" => unreachable ! (
378
+ "Expected nullary intrinsic `core::intrinsics::type_name` to be const-evaluated before codegen"
379
+ ) ,
385
380
"typed_swap_nonoverlapping" => {
386
381
assert_sig_matches ! ( sig, RigidTy :: RawPtr ( _, Mutability :: Mut ) , RigidTy :: RawPtr ( _, Mutability :: Mut ) => RigidTy :: Tuple ( _) ) ;
387
382
Self :: TypedSwap
@@ -409,6 +404,9 @@ impl Intrinsic {
409
404
"unreachable" => unreachable ! (
410
405
"Expected `std::intrinsics::unreachable` to be handled by `TerminatorKind::Unreachable`"
411
406
) ,
407
+ "variant_count" => unreachable ! (
408
+ "Expected nullary intrinsic `core::intrinsics::variant_count` to be const-evaluated before codegen"
409
+ ) ,
412
410
"volatile_copy_memory" => {
413
411
assert_sig_matches ! ( sig, RigidTy :: RawPtr ( _, Mutability :: Mut ) , RigidTy :: RawPtr ( _, Mutability :: Not ) , RigidTy :: Uint ( UintTy :: Usize ) => RigidTy :: Tuple ( _) ) ;
414
412
Self :: VolatileCopyMemory
0 commit comments