diff options
Diffstat (limited to 'compiler/stable_mir/src/mir/mono.rs')
| -rw-r--r-- | compiler/stable_mir/src/mir/mono.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/stable_mir/src/mir/mono.rs b/compiler/stable_mir/src/mir/mono.rs index 8562bfd3905..8c43f2c4b8f 100644 --- a/compiler/stable_mir/src/mir/mono.rs +++ b/compiler/stable_mir/src/mir/mono.rs @@ -1,7 +1,7 @@ use crate::mir::Body; use crate::ty::{ClosureDef, ClosureKind, FnDef, GenericArgs, IndexedVal, Ty}; use crate::{with, CrateItem, DefId, Error, ItemKind, Opaque}; -use std::fmt::Debug; +use std::fmt::{Debug, Formatter}; #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub enum MonoItem { @@ -10,7 +10,7 @@ pub enum MonoItem { GlobalAsm(Opaque), } -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] pub struct Instance { /// The type of instance. pub kind: InstanceKind, @@ -83,6 +83,15 @@ impl Instance { } } +impl Debug for Instance { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Instance") + .field("kind", &self.kind) + .field("def", &self.mangled_name()) + .finish() + } +} + /// Try to convert a crate item into an instance. /// The item cannot be generic in order to be converted into an instance. impl TryFrom<CrateItem> for Instance { |
