about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2022-06-16diagnostics: fix trailing spaceklensy-5/+5
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-2/+6
2022-06-13Rollup merge of #98050 - JohnTitor:issue-67945, r=compiler-errorsMatthias Krüger-0/+107
Add some more regression tests for #67945 Closes #67945, added two tests from https://github.com/rust-lang/rust/issues/67945#issuecomment-572617285, other snippets were already added in #71952 and #77439 r? `@compiler-errors`
2022-06-13Rollup merge of #97709 - compiler-errors:normalize-const-param-ty, r=oli-obkMatthias Krüger-0/+88
Normalize consts' tys when relating with `adt_const_params` Fixes #97007
2022-06-13Add some more regression tests for #67945Yuki Okushi-0/+107
2022-06-11Auto merge of #95880 - cjgillot:def-ident-span, r=petrochenkovbors-0/+12
Handle `def_ident_span` like `def_span`. `def_ident_span` had an ad-hoc status in the compiler. This PR refactors it to be a first-class citizen like `def_span`: - it gets encoded in the main metadata loop, instead of the visitor; - its implementation is updated to mirror the one of `def_span`. We do not remove the `Option` in the return type, since some items do not have an ident, AnonConsts for instance.
2022-06-11Rollup merge of #97703 - lcnr:post-89862, r=estebankDylan DPC-10/+10
some additional `need_type_info.rs` cleanup also fixes #97698, fixes #97806 cc `@estebank`
2022-06-11Rollup merge of #96868 - nrc:turbo-stable, r=jhpratt,nbdd0121,nagisaDylan DPC-32/+0
Stabilize explicit_generic_args_with_impl_trait This is a stabilisation PR for `explicit_generic_args_with_impl_trait`. * [tracking issue](https://github.com/rust-lang/rust/issues/83701) - [Stabilisation report](https://github.com/rust-lang/rust/issues/83701#issuecomment-1109949897) - [FCP entered](https://github.com/rust-lang/rust/issues/83701#issuecomment-1120285703) * [implementation PR](https://github.com/rust-lang/rust/pull/86176) * [Reference PR](https://github.com/rust-lang/reference/pull/1212) * There is no mention of using the turbofish operator in the book (other than an entry in the operator list in the appendix), so there is no documentation to change/add there, unless we felt like we should add a section on using turbofish, but that seems orthogonal to `explicit_generic_args_with_impl_trait`
2022-06-10Bless tests.Camille GILLOT-0/+12
2022-06-08dedup diagnostics default params handlinglcnr-10/+10
2022-06-06Deactivate feature gate explicit_generic_args_with_impl_traitNick Cameron-32/+0
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-06-03Fully stabilize NLLJack Huey-32/+2
2022-06-03Normalize consts' tys when relating with adt_const_paramsMichael Goulet-0/+88
2022-06-02add new `emit_inference_failure_err`lcnr-36/+43
2022-06-01Mention filename in suggestion when it differs from primary spanEsteban Küber-0/+1
2022-05-25Rollup merge of #97351 - ↵Dylan DPC-2/+25
b-naber:adt-const-params-structural-match-violation, r=michaelwoerister Output correct type responsible for structural match violation Previously we included the outermost type that caused a structural match violation in the error message and stated that that type must be annotated with `#[derive(Eq, PartialEq)]` even if it already had that annotation. This PR outputs the correct type in the error message. Fixes https://github.com/rust-lang/rust/issues/97278
2022-05-25Rollup merge of #97105 - JulianKnodt:const_dep_gen_const_expr, r=lcnrDylan DPC-0/+111
Add tests for lint on type dependent on consts r? `@lcnr`
2022-05-24add and update testsb-naber-2/+25
2022-05-22Use revisions for NLL in const-generics and matchJack Huey-4/+8
2022-05-20Rollup merge of #97109 - ↵Matthias Krüger-0/+6
TaKO8Ki:fix-misleading-cannot-infer-type-for-type-parameter-error, r=oli-obk Fix misleading `cannot infer type for type parameter` error closes #93198
2022-05-20report ambiguous type parameters when their parents are impl or fnTakayuki Maeda-0/+6
fix ci error emit err for `impl_item`
2022-05-19Add regression test for #88119Yuki Okushi-0/+35
2022-05-17Add tests for lint on type dependent on constskadmin-0/+111
2022-05-13Check that closures satisfy their where boundsOli Scherer-7/+20
2022-05-11Gracefully fail to resolve associated items instead of `delay_span_bug`.Camille GILLOT-5/+33
2022-05-11Rollup merge of #96717 - BoxyUwU:gats_const_param_types_mismatch_err, r=lcnrYuki Okushi-15/+124
Handle mismatched generic param kinds in trait impls betterly - Check that generic params on a generic associated type are the same as in the trait definition - Check that const generics are not used in place of type generics (and the other way round too) r? `@lcnr`
2022-05-08Rollup merge of #96830 - JohnTitor:issue-96654, r=compiler-errorsMatthias Krüger-1/+16
Add and tweak const-generics tests Closes #96654 Also correct the src/test/ui/const-generics/issues/issue-77357.rs test's issue number.
2022-05-08Auto merge of #96155 - jackh726:param-heuristics-followup, r=estebankbors-29/+0
Followups for method call error change Each commit is self-contained. Fixes most of the followup reviews from that PR. r? `@estebank`
2022-05-08Correct the issue number of a testYuki Okushi-1/+1
2022-05-08Add regression test for #96654Yuki Okushi-0/+15
2022-05-06Remove previously deleted test filesJack Huey-29/+0
2022-05-07Make the test `check-pass` not to produce a JSON fileYuki Okushi-1/+1
`run-pass` produces a JSON file when enabling save analysis.
2022-05-06wording tweaksEllen-15/+15
2022-05-05 make `compare_generic_param_kinds` errors consistentEllen-39/+84
2022-05-05exit out of `compare_number_of_generics` earlyEllen-29/+16
2022-05-05 handle mismatched generic parameter kindsEllen-0/+77
2022-05-01Enable full revision in const generics ui testsAlex Macleod-71/+291
2022-04-30Auto merge of #95776 - cjgillot:ast-lifetimes-static, r=petrochenkovbors-68/+236
Enforce static lifetimes in consts during late resolution This PR moves the handling of implicitly and explicitly static lifetimes in constants from HIR to the AST.
2022-04-30Bless tests.Camille GILLOT-67/+225
2022-04-29Auto merge of #95819 - oli-obk:mir_can't_hold_all_these_lifetimes, r=estebankbors-6/+6
Enforce Copy bounds for repeat elements while considering lifetimes fixes https://github.com/rust-lang/rust/issues/95477 this is a breaking change in order to fix a soundness bug. Before this PR we only checked whether the repeat element type had an `impl Copy`, but not whether that impl also had the appropriate lifetimes. E.g. if the impl was for `YourType<'static>` and not a general `'a`, then copying any type other than a `'static` one should have been rejected, but wasn't. r? `@lcnr`
2022-04-29Bless tests.Camille GILLOT-1/+11
2022-04-28Revert diagnostic duplication and accidental stabilizationOli Scherer-49/+3
2022-04-28Update the diagnostic message to match the new spanOli Scherer-2/+2
2022-04-28Check that repeat expression elements are Copy (ignoring lifetimes) in ↵Oli Scherer-4/+4
typeck and that they are Copy (with proper lifetime checks) in borrowck
2022-04-17show suggestion to replace generic bounds with associated types in more casesRobin Appelman-1/+1
2022-04-16Implementation for 65853Jack Huey-10/+50
This attempts to bring better error messages to invalid method calls, by applying some heuristics to identify common mistakes. The algorithm is inspired by Levenshtein distance and longest common sub-sequence. In essence, we treat the types of the function, and the types of the arguments you provided as two "words" and compute the edits to get from one to the other. We then modify that algorithm to detect 4 cases: - A function input is missing - An extra argument was provided - The type of an argument is straight up invalid - Two arguments have been swapped - A subset of the arguments have been shuffled (We detect the last two as separate cases so that we can detect two swaps, instead of 4 parameters permuted.) It helps to understand this argument by paying special attention to terminology: "inputs" refers to the inputs being *expected* by the function, and "arguments" refers to what has been provided at the call site. The basic sketch of the algorithm is as follows: - Construct a boolean grid, with a row for each argument, and a column for each input. The cell [i, j] is true if the i'th argument could satisfy the j'th input. - If we find an argument that could satisfy no inputs, provided for an input that can't be satisfied by any other argument, we consider this an "invalid type". - Extra arguments are those that can't satisfy any input, provided for an input that *could* be satisfied by another argument. - Missing inputs are inputs that can't be satisfied by any argument, where the provided argument could satisfy another input - Swapped / Permuted arguments are identified with a cycle detection algorithm. As each issue is found, we remove the relevant inputs / arguments and check for more issues. If we find no issues, we match up any "valid" arguments, and start again. Note that there's a lot of extra complexity: - We try to stay efficient on the happy path, only computing the diagonal until we find a problem, and then filling in the rest of the matrix. - Closure arguments are wrapped in a tuple and need to be unwrapped - We need to resolve closure types after the rest, to allow the most specific type constraints - We need to handle imported C functions that might be variadic in their inputs. I tried to document a lot of this in comments in the code and keep the naming clear.
2022-04-12Rollup merge of #95820 - OliverMD:95150, r=lcnrfee1-dead-20/+4
simplify const params diagnostic on stable Resolves #95150
2022-04-11simplify const params diagnostic on stableOliver Downard-20/+4
2022-04-09Bless tests.Camille GILLOT-0/+3
2022-04-05Rollup merge of #95654 - notriddle:notriddle/issue-95616, r=davidtwcoDylan DPC-21/+21
diagnostics: use correct span for const generics Fixes #95616