(module: &mut ObjectModule)
| 32 | } |
| 33 | |
| 34 | fn define_simple_function(module: &mut ObjectModule) -> FuncId { |
| 35 | let sig = Signature { |
| 36 | params: vec![], |
| 37 | returns: vec![], |
| 38 | call_conv: CallConv::SystemV, |
| 39 | }; |
| 40 | |
| 41 | let func_id = module |
| 42 | .declare_function("abc", Linkage::Local, &sig) |
| 43 | .unwrap(); |
| 44 | |
| 45 | let mut ctx = Context::new(); |
| 46 | ctx.func = Function::with_name_signature(UserFuncName::user(0, func_id.as_u32()), sig); |
| 47 | let mut func_ctx = FunctionBuilderContext::new(); |
| 48 | { |
| 49 | let mut bcx: FunctionBuilder = FunctionBuilder::new(&mut ctx.func, &mut func_ctx); |
| 50 | let block = bcx.create_block(); |
| 51 | bcx.switch_to_block(block); |
| 52 | bcx.ins().return_(&[]); |
| 53 | } |
| 54 | |
| 55 | module.define_function(func_id, &mut ctx).unwrap(); |
| 56 | |
| 57 | func_id |
| 58 | } |
| 59 | |
| 60 | #[test] |
| 61 | #[should_panic(expected = "Result::unwrap()` on an `Err` value: DuplicateDefinition(\"abc\")")] |
no test coverage detected