You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to see if two &Trait refer to the same object. It sounds like the correct way to do this is by casting to *const Trait and comparing those pointers for equality, however this produces an ICE. Here's a simple repro on playpen and pasted below:
traitMyTrait{}structFoo;implMyTraitforFoo{}fnmain(){let x = Foo;let a = &x;let y = Foo;let z = &y as&MyTrait;if a as*constMyTrait == z as*constMyTrait{println!("They match");}}
Below is the output of compiling the reproduction with RUST_BACKTRACE=1 on rustc 1.3.0-nightly (4dfe7a16c 2015-07-30)
Hey all,
I'm trying to see if two &Trait refer to the same object. It sounds like the correct way to do this is by casting to
*const Trait
and comparing those pointers for equality, however this produces an ICE. Here's a simple repro on playpen and pasted below:Below is the output of compiling the reproduction with
RUST_BACKTRACE=1
onrustc 1.3.0-nightly (4dfe7a16c 2015-07-30)
The text was updated successfully, but these errors were encountered: