1
Fork 0

move pretty into stable_mir

This commit is contained in:
Oğuz Ağcayazı 2023-11-15 10:12:17 +03:00 committed by ouz-a
parent 3883645a9b
commit 71c990470a
6 changed files with 308 additions and 305 deletions

View file

@ -19,9 +19,9 @@
use crate::mir::mono::InstanceDef;
use crate::mir::Body;
use std::cell::Cell;
use std::fmt;
use std::fmt::Debug;
use std::{cell::Cell, io};
use self::ty::{
GenericPredicates, Generics, ImplDef, ImplTrait, IndexedVal, LineInfo, Span, TraitDecl,
@ -37,6 +37,8 @@ pub mod ty;
pub mod visitor;
use crate::ty::{AdtDef, AdtKind, ClosureDef, ClosureKind};
use crate::mir::pretty::function_name;
use crate::mir::Mutability;
pub use error::*;
use mir::mono::Instance;
use ty::{FnDef, GenericArgs};
@ -137,6 +139,11 @@ impl CrateItem {
pub fn ty(&self) -> Ty {
with(|cx| cx.def_ty(self.0))
}
pub fn dump<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
writeln!(w, "{}", function_name(*self))?;
self.body().dump(w)
}
}
/// Return the function where execution starts if the current