use new apis and add new function
This commit is contained in:
parent
71c990470a
commit
92657f163a
5 changed files with 20 additions and 17 deletions
|
@ -36,12 +36,12 @@ pub mod mir;
|
|||
pub mod ty;
|
||||
pub mod visitor;
|
||||
|
||||
use crate::ty::{AdtDef, AdtKind, ClosureDef, ClosureKind};
|
||||
use crate::mir::pretty::function_name;
|
||||
use crate::mir::Mutability;
|
||||
use crate::ty::{AdtDef, AdtKind, ClosureDef, ClosureKind};
|
||||
pub use error::*;
|
||||
use mir::mono::Instance;
|
||||
use ty::{FnDef, GenericArgs};
|
||||
use ty::{Const, FnDef, GenericArgs};
|
||||
|
||||
/// Use String for now but we should replace it.
|
||||
pub type Symbol = String;
|
||||
|
@ -139,7 +139,7 @@ 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)
|
||||
|
@ -230,6 +230,9 @@ pub trait Context {
|
|||
/// Returns the type of given crate item.
|
||||
fn def_ty(&self, item: DefId) -> Ty;
|
||||
|
||||
/// Returns literal value of a const as a string.
|
||||
fn const_literal(&self, cnst: &Const) -> String;
|
||||
|
||||
/// `Span` of an item
|
||||
fn span_of_an_item(&self, def_id: DefId) -> Span;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue