Skip to content

Commit a54683b

Browse files
committed
Use exhaustive match to filter
1 parent c25fd71 commit a54683b

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Diff for: compiler/rustc_smir/src/rustc_smir/context.rs

+16-6
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,23 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
591591
fn intrinsic_name(&self, def: InstanceDef) -> Option<Symbol> {
592592
let tables = self.0.borrow_mut();
593593
let instance = tables.instances[def];
594-
if !(matches!(instance.def, ty::InstanceDef::Intrinsic(..))
595-
|| matches!(instance.def, ty::InstanceDef::Item(..)))
596-
{
597-
return None;
594+
match instance.def {
595+
ty::InstanceDef::Intrinsic(..) | ty::InstanceDef::Item(..) => {
596+
let intrinsic = tables.tcx.intrinsic(instance.def_id())?;
597+
Some(intrinsic.name.to_string())
598+
}
599+
ty::InstanceDef::VTableShim(..)
600+
| ty::InstanceDef::ReifyShim(..)
601+
| ty::InstanceDef::Virtual(..)
602+
| ty::InstanceDef::ThreadLocalShim(..)
603+
| ty::InstanceDef::ClosureOnceShim { .. }
604+
| ty::InstanceDef::ConstructCoroutineInClosureShim { .. }
605+
| ty::InstanceDef::CoroutineKindShim { .. }
606+
| ty::InstanceDef::DropGlue(..)
607+
| ty::InstanceDef::FnPtrShim(..)
608+
| ty::InstanceDef::CloneShim(..)
609+
| ty::InstanceDef::FnPtrAddrShim(..) => None,
598610
}
599-
let intrinsic = tables.tcx.intrinsic(instance.def_id())?;
600-
Some(intrinsic.name.to_string())
601611
}
602612

603613
fn ty_layout(&self, ty: Ty) -> Result<Layout, Error> {

0 commit comments

Comments
 (0)