diff options
Diffstat (limited to 'tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs')
-rw-r--r-- | tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs new file mode 100644 index 000000000..cf68850cc --- /dev/null +++ b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs @@ -0,0 +1,10 @@ +// run-rustfix + +fn main() { + let _ptr1: *const u32 = std::ptr::null(); + let _ptr2: *const u32 = std::ptr::null(); + let _a = _ptr1 + 5; //~ ERROR cannot add + let _b = _ptr1 - 5; //~ ERROR cannot subtract + let _c = _ptr2 - _ptr1; //~ ERROR cannot subtract + let _d = _ptr1[5]; //~ ERROR cannot index +} |