Skip to content

Commit

Permalink
Use exhaustive match to filter
Browse files Browse the repository at this point in the history
  • Loading branch information
adpaco-aws committed Mar 11, 2024
1 parent c25fd71 commit a54683b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions compiler/rustc_smir/src/rustc_smir/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,13 +591,23 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
fn intrinsic_name(&self, def: InstanceDef) -> Option<Symbol> {
let tables = self.0.borrow_mut();
let instance = tables.instances[def];
if !(matches!(instance.def, ty::InstanceDef::Intrinsic(..))
|| matches!(instance.def, ty::InstanceDef::Item(..)))
{
return None;
match instance.def {
ty::InstanceDef::Intrinsic(..) | ty::InstanceDef::Item(..) => {
let intrinsic = tables.tcx.intrinsic(instance.def_id())?;
Some(intrinsic.name.to_string())
}
ty::InstanceDef::VTableShim(..)
| ty::InstanceDef::ReifyShim(..)
| ty::InstanceDef::Virtual(..)
| ty::InstanceDef::ThreadLocalShim(..)
| ty::InstanceDef::ClosureOnceShim { .. }
| ty::InstanceDef::ConstructCoroutineInClosureShim { .. }
| ty::InstanceDef::CoroutineKindShim { .. }
| ty::InstanceDef::DropGlue(..)
| ty::InstanceDef::FnPtrShim(..)
| ty::InstanceDef::CloneShim(..)
| ty::InstanceDef::FnPtrAddrShim(..) => None,
}
let intrinsic = tables.tcx.intrinsic(instance.def_id())?;
Some(intrinsic.name.to_string())
}

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

0 comments on commit a54683b

Please sign in to comment.