-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Cannot get a 'static reference to an explicit memory location #18267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Pointer arithmetic is not implemented. rust-lang/rfcs#259 |
Ah, this is unfortunate... I didn't expect pointer arithmetic was involved in that expression. |
Should I close this issue right now? I feel like even if we don't consider the lack of pointer arithmetic in constant expression a bug in current rust the error message itself could be improved. |
Updated error:
|
This fails with a regular build error on the latest nightly:
|
Right. However, we may still want to make that code work somehow. |
Given that this would add a new feature, and now has a regular error, I'm going to close it in favor of an RFC. Thanks! |
minor: Sync from downstream
I was playing around trying to get rust to let me get a reference to an explicit memory location (in order to be able to map HW registers in a nice way for the Zinc project) and ended up with that code:
Which produces the following error:
rustc: /build/rust-git/src/rust/src/llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::GlobalVariable; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::GlobalVariable*]: Assertion
isa(Val) && "cast() argument of incompatible type!"' failed.`Casting the raw pointer in an intermediate function builds and runs fine however (assuming you have something mapped at
0x100
of course):The text was updated successfully, but these errors were encountered: