-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Expand file tree
/
Copy pathprint3.rs
More file actions
25 lines (21 loc) · 606 Bytes
/
Copy pathprint3.rs
File metadata and controls
25 lines (21 loc) · 606 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//@ known-bug: #107975
//@ compile-flags: -Copt-level=2
//@ run-pass
// https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499
use std::ptr;
fn main() {
let a: usize = {
let v = 0;
ptr::from_ref(&v).expose_provenance()
};
let b: usize = {
let v = 0;
ptr::from_ref(&v).expose_provenance()
};
assert_ne!(a, b);
assert_ne!(a, b);
let c = a;
assert_eq!(format!("{} {} {}", a == b, a == c, b == c), "false true false");
println!("{a} {b}");
assert_eq!(format!("{} {} {}", a == b, a == c, b == c), "true true true");
}