Skip to content

Commit aaca5a3

Browse files
committed
Rename StaticMethods::static_ptrcast to ConstMethods::const_ptrcast
1 parent 59682d3 commit aaca5a3

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/librustc_codegen_llvm/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn get_fn(
8181
// other weird situations. Annoying.
8282
if cx.val_ty(llfn) != llptrty {
8383
debug!("get_fn: casting {:?} to {:?}", llfn, llptrty);
84-
cx.static_ptrcast(llfn, llptrty)
84+
cx.const_ptrcast(llfn, llptrty)
8585
} else {
8686
debug!("get_fn: not casting pointer!");
8787
llfn

src/librustc_codegen_llvm/common.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
366366
let llval = self.static_bitcast(llval, self.type_ptr_to(layout.llvm_type(self)));
367367
PlaceRef::new_sized(llval, layout, alloc.align)
368368
}
369+
370+
fn const_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
371+
consts::ptrcast(val, ty)
372+
}
369373
}
370374

371375
pub fn val_ty(v: &'ll Value) -> &'ll Type {

src/librustc_codegen_llvm/consts.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,6 @@ impl CodegenCx<'ll, 'tcx> {
180180
}
181181

182182
impl StaticMethods for CodegenCx<'ll, 'tcx> {
183-
fn static_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
184-
ptrcast(val, ty)
185-
}
186-
187183
fn static_addr_of_mut(
188184
&self,
189185
cv: &'ll Value,

src/librustc_codegen_ssa/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub fn unsized_info<'tcx, Cx: CodegenMethods<'tcx>>(
192192
(_, &ty::Dynamic(ref data, ..)) => {
193193
let vtable_ptr = cx.layout_of(cx.tcx().mk_mut_ptr(target))
194194
.field(cx, FAT_PTR_EXTRA);
195-
cx.static_ptrcast(meth::get_vtable(cx, source, data.principal()),
195+
cx.const_ptrcast(meth::get_vtable(cx, source, data.principal()),
196196
cx.backend_type(vtable_ptr))
197197
}
198198
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}",

src/librustc_codegen_ssa/traits/consts.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use syntax::symbol::LocalInternedString;
1717

1818
pub trait ConstMethods<'tcx>: BackendTypes {
1919
// Constant constructors
20-
2120
fn const_null(&self, t: Self::Type) -> Self::Value;
2221
fn const_undef(&self, t: Self::Type) -> Self::Value;
2322
fn const_int(&self, t: Self::Type, i: i64) -> Self::Value;
@@ -61,4 +60,6 @@ pub trait ConstMethods<'tcx>: BackendTypes {
6160
alloc: &Allocation,
6261
offset: layout::Size,
6362
) -> PlaceRef<'tcx, Self::Value>;
63+
64+
fn const_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value;
6465
}

src/librustc_codegen_ssa/traits/statics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use rustc::hir::def_id::DefId;
1313
use rustc::ty::layout::Align;
1414

1515
pub trait StaticMethods: BackendTypes {
16-
fn static_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value;
1716
fn static_addr_of_mut(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
1817
fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
1918
fn get_static(&self, def_id: DefId) -> Self::Value;

0 commit comments

Comments
 (0)