This website requires JavaScript.
Explore
Help
Register
Sign In
mikros
/
rust
Watch
1
Star
0
Fork
0
You've already forked rust
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
948172b93f
rust
/
src
/
test
/
run-pass
/
cast-region-to-uint.rs
4 lines
67 B
Rust
Raw
Normal View
History
Unescape
Escape
allow region ptrs to be cast to uints
2012-05-18 21:05:31 -05:00
fn
main
(
)
{
let
x
=
3
;
Make comparisons between region pointers work Region pointers were considered a scalar type, so compare_scalar_type would get called to compare region pointers in trans. This would fail, since compare_scalar_type has no case for region pointers. Changed type_is_scalar to return false for region pointers. This had the side effect of breaking casts to types of the form &T. To ameliorate that, I added library functions ptr::assimilate (taking a &T to a *T) and ptr::to_uint (taking a &T to a uint), both of which use reinterpret_cast. While I was at it, I removed ty::type_has_resources, which is dead code.
2012-08-02 16:23:04 -05:00
debug!
{
"
&x=%x
"
,
ptr
::
to_uint
(
&
x
)
}
;
allow region ptrs to be cast to uints
2012-05-18 21:05:31 -05:00
}
Reference in New Issue
Copy Permalink