Rollup merge of #110190 - cbeuw:mir-offset, r=oli-obk
Custom MIR: Support `BinOp::Offset` Since offset doesn't have an infix operator, a new function `Offset` is added which is lowered to `Rvalue::BinaryOp(BinOp::Offset, ..)` r? ```@oli-obk``` or ```@tmiasko``` or ```@JakobDegen```
This commit is contained in:
commit
bb037e6fa7
4 changed files with 28 additions and 0 deletions
|
@ -148,6 +148,11 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
|||
)),
|
||||
)
|
||||
},
|
||||
@call("mir_offset", args) => {
|
||||
let ptr = self.parse_operand(args[0])?;
|
||||
let offset = self.parse_operand(args[1])?;
|
||||
Ok(Rvalue::BinaryOp(BinOp::Offset, Box::new((ptr, offset))))
|
||||
},
|
||||
@call("mir_len", args) => Ok(Rvalue::Len(self.parse_place(args[0])?)),
|
||||
ExprKind::Borrow { borrow_kind, arg } => Ok(
|
||||
Rvalue::Ref(self.tcx.lifetimes.re_erased, *borrow_kind, self.parse_place(*arg)?)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue