-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ty_fixed_length_vec's length const-expr not eval'ed consistently (vs other const-exprs) #10122
Comments
See also some relevant discussion from |
Triage: updated code:
updated error:
|
@steveklabnik were you passing in the necessary Plus I think this bug dates from before we had the So I think the appropriate update looks more like this: struct foo { x: usize, y: usize }
const A : foo = foo { x: 3, y: 4 };
#[cfg(field_proj)]
const B : usize = A.x;
#[cfg(inline_val)]
const B : usize = 3;
fn main() {
let v : [i32; B] = [5, 6, 7];
println!("{:?}", v);
} which, huzzah, works now for both the |
[`drop_ref`]: don't lint idiomatic in match arm fixes rust-lang#10122 As established in issue rust-lang#9482, it is idiomatic to use a single `drop()` expression in a match arm to achieve a side-effect of a function while discarding its output. This should also apply to cases where the function returns a reference. The change to the lint's code was less than 1 line, because all the heavy lifting was done in PR rust-lang#9491. --- changelog: FP: [`drop_ref`]: No longer lints idiomatic expression in `match` arms [rust-lang#10142](rust-lang/rust-clippy#10142) <!-- changelog_checked -->
…r=HKalbasi Infer return type for async function in `generate_function` Part of rust-lang#10122 In `generate_function` assist, when we infer the return type of async function we're generating, we should retrieve the type of parent await expression rather than the call expression itself.
From: https://gist.github.com/pnkfelix/7198893
Part of #5551 metabug.
First, an illustration that field-dereference can be used in some const expressions. This compiles and runs:
But, even though the above compiles and runs, a use of
B
as the length of a fixed length vec fails to compile.The text was updated successfully, but these errors were encountered: