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

Method const_str

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs:170–189  ·  view source on GitHub ↗
(&self, s: &str)

Source from the content-addressed store, hash-verified

168 }
169
170 fn const_str(&self, s: &str) -> (Self::Value, Self::Value) {
171 let len = s.len();
172 let str_ty = self
173 .layout_of(self.tcx.types.str_)
174 .spirv_type(DUMMY_SP, self);
175 (
176 self.def_constant(
177 self.type_ptr_to(str_ty),
178 SpirvConst::PtrTo {
179 pointee: self
180 .constant_composite(
181 str_ty,
182 s.bytes().map(|b| self.const_u8(b).def_cx(self)),
183 )
184 .def_cx(self),
185 },
186 ),
187 self.const_usize(len as u64),
188 )
189 }
190 fn const_struct(&self, elts: &[Self::Value], _packed: bool) -> Self::Value {
191 // Presumably this will get bitcasted to the right type?
192 // FIXME(eddyb) use `AccumulateVec`s just like `rustc` itself does.

Callers

nothing calls this directly

Calls 7

spirv_typeMethod · 0.80
def_constantMethod · 0.80
type_ptr_toMethod · 0.80
def_cxMethod · 0.80
constant_compositeMethod · 0.80
const_u8Method · 0.80
const_usizeMethod · 0.80

Tested by

no test coverage detected