This commit is contained in:
bjorn3 2018-12-02 14:35:11 +01:00
parent fe88440bd2
commit a0056333f1
3 changed files with 5 additions and 4 deletions

View File

@ -1471,7 +1471,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
}
impl StaticBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
fn get_static(&self, def_id: DefId) -> &'ll Value {
fn get_static(&mut self, def_id: DefId) -> &'ll Value {
// Forward to the `get_static` method of `CodegenCx`
self.cx().get_static(def_id)
}

View File

@ -80,7 +80,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> {
Self::alloca(bx, ptr_layout, name)
}
pub fn len<Cx: CodegenMethods<'tcx, Value = V>>(
pub fn len<Cx: ConstMethods<'tcx, Value = V>>(
&self,
cx: &Cx
) -> V {
@ -447,7 +447,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// NB: The layout of a static may be unsized as is the case when working
// with a static that is an extern_type.
let layout = cx.layout_of(self.monomorphize(&ty));
PlaceRef::new_thin_place(bx, bx.get_static(def_id), layout, layout.align.abi)
let static_ = bx.get_static(def_id);
PlaceRef::new_thin_place(bx, static_, layout, layout.align.abi)
},
mir::Place::Projection(box mir::Projection {
ref base,

View File

@ -8,5 +8,5 @@ pub trait StaticMethods: BackendTypes {
}
pub trait StaticBuilderMethods<'tcx>: BackendTypes {
fn get_static(&self, def_id: DefId) -> Self::Value;
fn get_static(&mut self, def_id: DefId) -> Self::Value;
}