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

Method end

crates/rustc_codegen_spirv/src/abi.rs:225–262  ·  view source on GitHub ↗
(
        &self,
        cx: &CodegenCx<'tcx>,
        span: Span,
        pointee: PointeeTy<'tcx>,
        pointee_spv: Word,
    )

Source from the content-addressed store, hash-verified

223 }
224
225 fn end(
226 &self,
227 cx: &CodegenCx<'tcx>,
228 span: Span,
229 pointee: PointeeTy<'tcx>,
230 pointee_spv: Word,
231 ) -> Word {
232 match self.map.borrow_mut().entry(pointee) {
233 // We should have hit begin() on this type already, which always inserts an entry.
234 Entry::Vacant(_) => {
235 span_bug!(span, "RecursivePointeeCache::end should always have entry")
236 }
237 Entry::Occupied(mut entry) => match *entry.get() {
238 // State: There have been no recursive references to this type while defining it, and so no
239 // OpTypeForwardPointer has been emitted. This is the most common case.
240 PointeeDefState::Defining => {
241 let id = SpirvType::Pointer {
242 pointee: pointee_spv,
243 }
244 .def(span, cx);
245 entry.insert(PointeeDefState::Defined(id));
246 id
247 }
248 // State: There was a recursive reference to this type, and so an OpTypeForwardPointer has been emitted.
249 // Make sure to use the same ID.
250 PointeeDefState::DefiningWithForward(id) => {
251 entry.insert(PointeeDefState::Defined(id));
252 SpirvType::Pointer {
253 pointee: pointee_spv,
254 }
255 .def_with_id(cx, span, id)
256 }
257 PointeeDefState::Defined(_) => {
258 span_bug!(span, "RecursivePointeeCache::end defined pointer twice")
259 }
260 },
261 }
262 }
263}
264
265#[derive(Eq, PartialEq, Hash, Copy, Clone, Debug)]

Callers 1

trans_scalarFunction · 0.80

Calls 4

insertMethod · 0.80
def_with_idMethod · 0.80
getMethod · 0.45
defMethod · 0.45

Tested by

no test coverage detected