MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / invalid_assignment

Function invalid_assignment

cranelift/interpreter/src/frame.rs:168–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166 #[test]
167 #[should_panic(expected = "assertion failed: name.index() < self.registers.len()")]
168 fn invalid_assignment() {
169 let func = function("function %test(i32) -> i32 { block0(v10:i32): return v10 }");
170 let mut frame = Frame::new(&func);
171 let fortytwo = DataValue::I32(42);
172
173 // Since the SSA value ref points to 42 and the function only has 11 slots, this should
174 // fail. TODO currently this is a panic under the assumption we will not set indexes outside
175 // of the valid SSA value range but it might be better as a result.
176 frame.set(ValueRef::from_u32(11), fortytwo.clone());
177 }
178
179 #[test]
180 #[should_panic(expected = "assertion failed: name.index() < self.registers.len()")]

Callers

nothing calls this directly

Calls 4

functionFunction · 0.85
newFunction · 0.50
setMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected