diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-07-14 19:24:06 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-14 19:24:06 +0530 |
| commit | 39936fd0b72ab9f25590ef6a2ffda0b08ff147e5 (patch) | |
| tree | 2630fd6d5c100dc4428bee76b53c80fefe9f1d87 /compiler/rustc_codegen_llvm/src | |
| parent | d3a1aa0b4380b7ab217a1e2889a4217e70237f61 (diff) | |
| parent | 96d34dc9ff557c189fef19cb00b36f5cd5c7ac49 (diff) | |
| download | rust-39936fd0b72ab9f25590ef6a2ffda0b08ff147e5.tar.gz rust-39936fd0b72ab9f25590ef6a2ffda0b08ff147e5.zip | |
Rollup merge of #99222 - atsuzaki:generic_const_err, r=lcnr
Better error message for generic_const_exprs inference failure
Fixes #90531
This code:
```rs
#![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:
```rs
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
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
