about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-12 17:04:32 +0200
committerGitHub <noreply@github.com>2023-04-12 17:04:32 +0200
commitbb037e6fa776f9c8e28e4f0668adeb2824c415f7 (patch)
treecab7a0d458f1a610f1ffed45dbc1d521bff01053 /library/core/src
parent2118667ffa35e4e5dd1c31fd5d8011d3bf6bd5ab (diff)
parentcecb901e683cdc1a2ffbb1e331ba4f262e2215c0 (diff)
downloadrust-bb037e6fa776f9c8e28e4f0668adeb2824c415f7.tar.gz
rust-bb037e6fa776f9c8e28e4f0668adeb2824c415f7.zip
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```
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/intrinsics/mir.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs
index 6690c1a76d5..d9d62eb759e 100644
--- a/library/core/src/intrinsics/mir.rs
+++ b/library/core/src/intrinsics/mir.rs
@@ -232,6 +232,7 @@
 //!  - `&`, `&mut`, `addr_of!`, and `addr_of_mut!` all work to create their associated rvalue.
 //!  - [`Discriminant`] and [`Len`] have associated functions.
 //!  - Unary and binary operations use their normal Rust syntax - `a * b`, `!c`, etc.
+//!  - The binary operation `Offset` can be created via [`Offset`].
 //!  - Checked binary operations are represented by wrapping the associated binop in [`Checked`].
 //!  - Array repetition syntax (`[foo; 10]`) creates the associated rvalue.
 //!
@@ -289,6 +290,7 @@ define!(
     fn Discriminant<T>(place: T) -> <T as ::core::marker::DiscriminantKind>::Discriminant
 );
 define!("mir_set_discriminant", fn SetDiscriminant<T>(place: T, index: u32));
+define!("mir_offset", fn Offset<T, U>(ptr: T, count: U) -> T);
 define!(
     "mir_field",
     /// Access the field with the given index of some place.