Add stable Instance::body() and RustcInternal trait
The `Instance::body()` returns a monomorphized body. For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal. Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed.
This commit is contained in:
parent
cc705b8012
commit
6ed2a76bcc
10 changed files with 218 additions and 7 deletions
|
@ -39,6 +39,7 @@ pub mod visitor;
|
|||
|
||||
pub use error::*;
|
||||
use mir::mono::Instance;
|
||||
use ty::{FnDef, GenericArgs};
|
||||
|
||||
/// Use String for now but we should replace it.
|
||||
pub type Symbol = String;
|
||||
|
@ -233,6 +234,9 @@ pub trait Context {
|
|||
|
||||
/// Item requires monomorphization.
|
||||
fn requires_monomorphization(&self, def_id: DefId) -> bool;
|
||||
|
||||
/// Resolve an instance from the given function definition and generic arguments.
|
||||
fn resolve_instance(&mut self, def: FnDef, args: &GenericArgs) -> Option<Instance>;
|
||||
}
|
||||
|
||||
// A thread local variable that stores a pointer to the tables mapping between TyCtxt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue