-
Notifications
You must be signed in to change notification settings - Fork 13.3k
example for --explain E0018 claims to demo it, but does not #25326
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
For reference, here's some code which (I believe) does fail with this: https://github.com/rust-lang/rust/blob/master/src/test/compile-fail/issue-18294.rs |
Yes, it seems like the example in the explanation have lost the |
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
May 27, 2015
Merged
bors
added a commit
that referenced
this issue
May 28, 2015
XMPPwocky
pushed a commit
to XMPPwocky/rust
that referenced
this issue
May 29, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
example for --explain E0018 claims to demo it, but does not
I was reading over
http://doc.rust-lang.org/error-index.html#E0018
And I thought: "this should compile fine. If that yields an error, it's a bug."
So I checked. It does not yield the error.
Here is the text in question:
The value of static and const variables must be known at compile time. You can't cast a pointer as an integer because we can't know what value the address will take.
However, pointers to other constants' addresses are allowed in constants, example:
Therefore, casting one of these non-constant pointers to an integer results in a non-constant integer which lead to this error. Example:
The text was updated successfully, but these errors were encountered: