Skip to content

Commit 5626cc0

Browse files
committed
Cover new intrinsic kinds
1 parent 2b87745 commit 5626cc0

2 files changed

Lines changed: 34 additions & 26 deletions

File tree

compiler/src/passes/instr/decision.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ fn decide_instance_kind(kind: &InstanceKind) -> bool {
7272
| Virtual(..)
7373
| ConstructCoroutineInClosureShim { .. }
7474
| ThreadLocalShim(..)
75+
| FutureDropPollShim(..)
7576
| DropGlue(..)
7677
| FnPtrAddrShim(..)
78+
| AsyncDropGlue(..)
7779
| AsyncDropGlueCtorShim(..) => false,
7880
}
7981
}

compiler/src/utils/mod.rs

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -196,38 +196,44 @@ pub(crate) mod mir {
196196

197197
impl<'tcx> InstanceKindExt<'tcx> for InstanceKind<'tcx> {
198198
fn discriminant(&self) -> InstanceKindDiscr {
199+
use InstanceKind::*;
199200
match self {
200-
InstanceKind::Item(..) => 0,
201-
InstanceKind::Intrinsic(..) => 1,
202-
InstanceKind::VTableShim(..) => 2,
203-
InstanceKind::ReifyShim(..) => 3,
204-
InstanceKind::FnPtrShim(..) => 4,
205-
InstanceKind::Virtual(..) => 5,
206-
InstanceKind::ClosureOnceShim { .. } => 6,
207-
InstanceKind::ConstructCoroutineInClosureShim { .. } => 7,
208-
InstanceKind::ThreadLocalShim(..) => 8,
209-
InstanceKind::DropGlue(..) => 9,
210-
InstanceKind::CloneShim(..) => 10,
211-
InstanceKind::FnPtrAddrShim(..) => 11,
212-
InstanceKind::AsyncDropGlueCtorShim(..) => 12,
201+
Item(..) => 0,
202+
Intrinsic(..) => 1,
203+
VTableShim(..) => 2,
204+
ReifyShim(..) => 3,
205+
FnPtrShim(..) => 4,
206+
Virtual(..) => 5,
207+
ClosureOnceShim { .. } => 6,
208+
ConstructCoroutineInClosureShim { .. } => 7,
209+
ThreadLocalShim(..) => 8,
210+
FutureDropPollShim(..) => 9,
211+
DropGlue(..) => 10,
212+
CloneShim(..) => 11,
213+
FnPtrAddrShim(..) => 12,
214+
AsyncDropGlueCtorShim(..) => 13,
215+
AsyncDropGlue(..) => 14,
213216
}
214217
}
215218

216219
fn has_identical_polymorphic_body(&self) -> bool {
220+
use InstanceKind::*;
217221
match self {
218-
InstanceKind::Item(..) => true,
219-
InstanceKind::Intrinsic(..) => false, // Should not even have a body
220-
InstanceKind::VTableShim(..) => false, // Opaque for MIR
221-
InstanceKind::ReifyShim(..) => false, // Opaque for MIR
222-
InstanceKind::FnPtrShim(..) => false, // Different for different signatures
223-
InstanceKind::Virtual(..) => false, // Opaque for MIR
224-
InstanceKind::ClosureOnceShim { .. } => true, // Always <Self as FnMut>::call_mut
225-
InstanceKind::ConstructCoroutineInClosureShim { .. } => false,
226-
InstanceKind::ThreadLocalShim(..) => true, // Should not even have generic parameters (not sure)
227-
InstanceKind::DropGlue(..) => false, // Different for different types
228-
InstanceKind::CloneShim(..) => false, // Different for different types
229-
InstanceKind::FnPtrAddrShim(..) => false, // Different for different types
230-
InstanceKind::AsyncDropGlueCtorShim(..) => false, // Different for different types
222+
Item(..) => true,
223+
Intrinsic(..) => false, // Should not even have a body
224+
VTableShim(..) => false, // Opaque for MIR
225+
ReifyShim(..) => false, // Opaque for MIR
226+
FnPtrShim(..) => false, // Different for different signatures
227+
Virtual(..) => false, // Opaque for MIR
228+
ClosureOnceShim { .. } => true, // Always <Self as FnMut>::call_mut
229+
ConstructCoroutineInClosureShim { .. } => false,
230+
ThreadLocalShim(..) => true, // Should not even have generic parameters (not sure)
231+
FutureDropPollShim(..) => false, // Different for different types (not sure)
232+
DropGlue(..) => false, // Different for different types
233+
CloneShim(..) => false, // Different for different types
234+
FnPtrAddrShim(..) => false, // Different for different types
235+
AsyncDropGlueCtorShim(..) => false, // Different for different types
236+
AsyncDropGlue(..) => false, // Different for different types
231237
}
232238
}
233239

0 commit comments

Comments
 (0)