diff --git a/unsafe-rust-is-cpp/src/main.rs b/unsafe-rust-is-cpp/src/main.rs index f4e2b2dc65cd2399a88305f4f0164d6b27941aa5..573fbbc94c26a678715ca5bb01980d638017bf69 100644 --- a/unsafe-rust-is-cpp/src/main.rs +++ b/unsafe-rust-is-cpp/src/main.rs @@ -36,6 +36,10 @@ pub fn rust_like_its_2025() { // So far this is the same. Let's move the rest to a function. println!("OUTPUT: {}", foo(n_mut1, n_mut2)); + // This works if you compile on debug. + // It also works if `foo` is hinted as never inlined. + // But it won't work anymore if non-inlined and compiled in release! + // You can't code in unsafe Rust like it's C++. // Unsafe Rust does not allow you to jump over the borrow rules. // It merely stops preventing you from trying.