Rename StaticMethods::static_ptrcast to ConstMethods::const_ptrcast
This commit is contained in:
parent
59682d3e2a
commit
aaca5a38ee
6 changed files with 8 additions and 8 deletions
|
|
@ -81,7 +81,7 @@ pub fn get_fn(
|
|||
// other weird situations. Annoying.
|
||||
if cx.val_ty(llfn) != llptrty {
|
||||
debug!("get_fn: casting {:?} to {:?}", llfn, llptrty);
|
||||
cx.static_ptrcast(llfn, llptrty)
|
||||
cx.const_ptrcast(llfn, llptrty)
|
||||
} else {
|
||||
debug!("get_fn: not casting pointer!");
|
||||
llfn
|
||||
|
|
|
|||
|
|
@ -366,6 +366,10 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
let llval = self.static_bitcast(llval, self.type_ptr_to(layout.llvm_type(self)));
|
||||
PlaceRef::new_sized(llval, layout, alloc.align)
|
||||
}
|
||||
|
||||
fn const_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
|
||||
consts::ptrcast(val, ty)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn val_ty(v: &'ll Value) -> &'ll Type {
|
||||
|
|
|
|||
|
|
@ -180,10 +180,6 @@ impl CodegenCx<'ll, 'tcx> {
|
|||
}
|
||||
|
||||
impl StaticMethods for CodegenCx<'ll, 'tcx> {
|
||||
fn static_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
|
||||
ptrcast(val, ty)
|
||||
}
|
||||
|
||||
fn static_addr_of_mut(
|
||||
&self,
|
||||
cv: &'ll Value,
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ pub fn unsized_info<'tcx, Cx: CodegenMethods<'tcx>>(
|
|||
(_, &ty::Dynamic(ref data, ..)) => {
|
||||
let vtable_ptr = cx.layout_of(cx.tcx().mk_mut_ptr(target))
|
||||
.field(cx, FAT_PTR_EXTRA);
|
||||
cx.static_ptrcast(meth::get_vtable(cx, source, data.principal()),
|
||||
cx.const_ptrcast(meth::get_vtable(cx, source, data.principal()),
|
||||
cx.backend_type(vtable_ptr))
|
||||
}
|
||||
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}",
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ use syntax::symbol::LocalInternedString;
|
|||
|
||||
pub trait ConstMethods<'tcx>: BackendTypes {
|
||||
// Constant constructors
|
||||
|
||||
fn const_null(&self, t: Self::Type) -> Self::Value;
|
||||
fn const_undef(&self, t: Self::Type) -> Self::Value;
|
||||
fn const_int(&self, t: Self::Type, i: i64) -> Self::Value;
|
||||
|
|
@ -61,4 +60,6 @@ pub trait ConstMethods<'tcx>: BackendTypes {
|
|||
alloc: &Allocation,
|
||||
offset: layout::Size,
|
||||
) -> PlaceRef<'tcx, Self::Value>;
|
||||
|
||||
fn const_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ use rustc::hir::def_id::DefId;
|
|||
use rustc::ty::layout::Align;
|
||||
|
||||
pub trait StaticMethods: BackendTypes {
|
||||
fn static_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value;
|
||||
fn static_addr_of_mut(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
|
||||
fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
|
||||
fn get_static(&self, def_id: DefId) -> Self::Value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue