Skip to content

Conversation

@atsuzaki
Copy link
Contributor

Fixes #90531

This code:

#![feature(generic_const_exprs)] fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {} fn main() { let arr = [5; 5]; foo(arr); }

Will now emit the following error:

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> test.rs:1:12 | 1 | #![feature(generic_const_exprs)] | ^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information error[E0284]: type annotations needed --> test.rs:8:7 | 8 | foo(arr); | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | note: required by a bound in `foo` --> test.rs:3:56 | 3 | fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {} | ^^^^^ required by this bound in `foo` help: consider specifying the generic argument | 8 | foo::<N>(arr); | +++++ error: aborting due to previous error; 1 warning emitted

cc: @lcnr thanks a lot again for the help on this

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 13, 2022
@rust-highfive
Copy link
Contributor

r? @cjgillot

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 13, 2022
@lcnr
Copy link
Contributor

lcnr commented Jul 14, 2022

Thanks ❤️

r? @lcnr

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 14, 2022

📌 Commit 96d34dc has been approved by lcnr

It is now in the queue for this repository.

@rust-highfive rust-highfive assigned lcnr and unassigned cjgillot Jul 14, 2022
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 14, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 14, 2022
Rollup of 6 pull requests Successful merges: - rust-lang#98072 (Add provider API to error trait) - rust-lang#98580 (Emit warning when named arguments are used positionally in format) - rust-lang#99000 (Move abstract const to middle) - rust-lang#99192 (Fix spans for asm diagnostics) - rust-lang#99222 (Better error message for generic_const_exprs inference failure) - rust-lang#99236 (solaris: unbreak build on native platform) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@bors bors merged commit 39936fd into rust-lang:master Jul 14, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

6 participants