rust/compiler
Dylan DPC 39936fd0b7
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
2022-07-14 19:24:06 +05:30
..
rustc
rustc_apfloat
rustc_arena
rustc_ast
rustc_ast_lowering Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC 2022-07-14 11:00:30 +00:00
rustc_ast_passes
rustc_ast_pretty
rustc_attr
rustc_borrowck Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC 2022-07-14 11:00:30 +00:00
rustc_builtin_macros Rollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkov 2022-07-14 19:24:05 +05:30
rustc_codegen_cranelift Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_codegen_gcc Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_codegen_llvm Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_codegen_ssa Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_const_eval Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_data_structures
rustc_driver Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_error_codes
rustc_error_messages
rustc_errors
rustc_expand Rollup merge of #98580 - PrestonFrom:issue_98466, r=estebank 2022-07-14 19:24:03 +05:30
rustc_feature Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot 2022-07-14 14:14:21 +05:30
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot 2022-07-14 14:14:21 +05:30
rustc_hir_pretty Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot 2022-07-14 14:14:21 +05:30
rustc_incremental Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_index
rustc_infer Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr 2022-07-14 19:24:04 +05:30
rustc_interface Rollup merge of #98580 - PrestonFrom:issue_98466, r=estebank 2022-07-14 19:24:03 +05:30
rustc_lexer
rustc_lint Rollup merge of #98580 - PrestonFrom:issue_98466, r=estebank 2022-07-14 19:24:03 +05:30
rustc_lint_defs
rustc_llvm
rustc_log
rustc_macros
rustc_metadata Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr 2022-07-14 19:24:04 +05:30
rustc_middle Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr 2022-07-14 19:24:04 +05:30
rustc_mir_build Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC 2022-07-14 11:00:30 +00:00
rustc_mir_dataflow Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_mir_transform Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiser 2022-07-14 08:14:31 +00:00
rustc_monomorphize Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_parse Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot 2022-07-14 14:14:21 +05:30
rustc_parse_format
rustc_passes Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC 2022-07-14 11:00:30 +00:00
rustc_plugin_impl
rustc_privacy
rustc_query_impl
rustc_query_system Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_resolve Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot 2022-07-14 14:14:21 +05:30
rustc_save_analysis Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot 2022-07-14 14:14:21 +05:30
rustc_serialize
rustc_session Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_smir
rustc_span Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC 2022-07-14 11:00:30 +00:00
rustc_symbol_mangling
rustc_target
rustc_trait_selection Rollup merge of #99222 - atsuzaki:generic_const_err, r=lcnr 2022-07-14 19:24:06 +05:30
rustc_traits
rustc_ty_utils Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr 2022-07-14 19:24:04 +05:30
rustc_type_ir
rustc_typeck Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC 2022-07-14 11:00:30 +00:00