-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Description
As per the discussion on twitter
This piece of code in release mode has weird behavior when comparing 2 pointers twice. This behavior happens only in release mode and does appear on stable.
It looks like a LLVM optimization to me, @eddyb thinks it "might be an accidental optimization"
fn foo(_: i32) -> i32 {
1
}
fn bar(_: i32) -> i32 {
1
}
fn main() {
let x: fn(i32) -> i32 = foo;
let y: fn(i32) -> i32 = bar;
if x == y {
println!("true")
} else {
println!("false {:?}", x);
}
if x == y {
println!("true")
} else {
println!("false {:?}", x);
}
}
false 0x55eabbd342f0
true
Metadata
Metadata
Assignees
Labels
No labels