-
Notifications
You must be signed in to change notification settings - Fork 13.3k
casting in a static breaks type inference #17756
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
Labels
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Comments
This works on 1.1+: const count : usize = 2 as usize;
fn main() {
let larger : [usize; count*2];
} |
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Jun 30, 2015
Regression test added in #26668 |
bors
added a commit
that referenced
this issue
Jun 30, 2015
RalfJung
pushed a commit
to RalfJung/rust
that referenced
this issue
Aug 1, 2024
docs: Fix JSON example for rust-analyzer.workspace.discoverConfig The user does not specify `{arg}` in their JSON, and be pedantic about commas in JSON sample.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Writing the following works perfectly:
While the following:
Fails with
error: expected constant expr for vector length: can't do this op on a uint and int
. This looks like a problem with the type inference, and using2u
fixes this example, but breaks the one that previously worked.When the array is being initialized rather than having the type set:
The error is a much more cryptic
error: expected constant integer for repeat count, found variable
, and which one fails can again be swapped by multiplying by2u
instead of2
.The text was updated successfully, but these errors were encountered: