MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / from_const_alloc

Method from_const_alloc

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs:345–356  ·  view source on GitHub ↗
(
        &self,
        layout: TyAndLayout<'tcx>,
        alloc: ConstAllocation<'tcx>,
        offset: Size,
    )

Source from the content-addressed store, hash-verified

343 undef
344 }
345 fn from_const_alloc(
346 &self,
347 layout: TyAndLayout<'tcx>,
348 alloc: ConstAllocation<'tcx>,
349 offset: Size,
350 ) -> PlaceRef<'tcx, Self::Value> {
351 assert_eq!(offset, Size::ZERO);
352 let ty = layout.spirv_type(DUMMY_SP, self);
353 let init = self.create_const_alloc(alloc, ty);
354 let result = self.static_addr_of(init, alloc.inner().align, None);
355 PlaceRef::new_sized(result, layout)
356 }
357
358 fn const_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value {
359 if val.ty == ty {

Callers

nothing calls this directly

Calls 3

spirv_typeMethod · 0.80
create_const_allocMethod · 0.80
static_addr_ofMethod · 0.80

Tested by

no test coverage detected