*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 8b21b0de authored by Rebola Pardo, Adrian's avatar Rebola Pardo, Adrian
Browse files

now using the new &raw mut syntax

parent dbb93297
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ pub fn rust_like_its_1985() { ...@@ -9,7 +9,7 @@ pub fn rust_like_its_1985() {
let mut n = 0; let mut n = 0;
// Taking a raw pointer is safe! // Taking a raw pointer is safe!
let n_ptr = &mut n as *mut i32; let n_ptr = &raw mut n;
// Dereferencing a pointer is unsafe, but not necessarily UB. // Dereferencing a pointer is unsafe, but not necessarily UB.
let n_mut1 = unsafe { &mut *n_ptr }; let n_mut1 = unsafe { &mut *n_ptr };
...@@ -29,7 +29,7 @@ pub fn rust_like_its_1985() { ...@@ -29,7 +29,7 @@ pub fn rust_like_its_1985() {
pub fn rust_like_its_2025() { pub fn rust_like_its_2025() {
let mut n = 0; let mut n = 0;
let n_ptr = &mut n as *mut i32; let n_ptr = &raw mut n;
let n_mut1 = unsafe { &mut *n_ptr }; let n_mut1 = unsafe { &mut *n_ptr };
let n_mut2 = unsafe { &mut *n_ptr }; let n_mut2 = unsafe { &mut *n_ptr };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment