mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Implement some traits for FunctionCx
This commit is contained in:
parent
f62381865f
commit
c53d58f923
@ -1,4 +1,7 @@
|
||||
extern crate rustc_target;
|
||||
|
||||
use syntax::ast::{IntTy, UintTy};
|
||||
use self::rustc_target::spec::{HasTargetSpec, Target};
|
||||
|
||||
use cretonne_module::{Module, Linkage, FuncId};
|
||||
|
||||
@ -277,6 +280,24 @@ impl<'a, 'tcx: 'a> LayoutOf for &'a FunctionCx<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> layout::HasTyCtxt<'tcx> for &'a FunctionCx<'a, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> layout::HasDataLayout for &'a FunctionCx<'a, 'tcx> {
|
||||
fn data_layout(&self) -> &layout::TargetDataLayout {
|
||||
&self.tcx.data_layout
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> HasTargetSpec for &'a FunctionCx<'a, 'tcx> {
|
||||
fn target_spec(&self) -> &Target {
|
||||
&self.tcx.sess.target.target
|
||||
}
|
||||
}
|
||||
|
||||
impl<'f, 'tcx> FunctionCx<'f, 'tcx> {
|
||||
pub fn monomorphize<T>(&self, value: &T) -> T
|
||||
where T: TypeFoldable<'tcx>
|
||||
|
Loading…
Reference in New Issue
Block a user