summary refs log tree commit diff
path: root/src/test/ui/inference
AgeCommit message (Collapse)AuthorLines
2022-11-30Rollup merge of #104697 - dingxiangfei2009:fix-euv-control-flow, r=oli-obkMatthias Krüger-0/+46
Restore control flow on error in EUV cc `@Nilstrieb` Fix #104649 Since #98574 refactored a piece of scrutinee memory categorization out as a subroutine, there is a subtle change in handling match arms especially when the categorization process faults and bails. In the correct case, it is not supposed to continue to process the arms any more. This PR restores the original control flow in EUV. I promise to add a compile-fail test to demonstrate that this indeed fixes the issue after coming back from a nap.
2022-11-28Change multiline span ASCII art visual orderEsteban Küber-6/+6
2022-11-28inference test for #104649Ding Xiang Fei-0/+46
2022-11-10Auto merge of #103636 - chenyukang:yukang/fix-103587-sugg-if-let, ↵bors-0/+52
r=jackh276,davidtwco Recover from common if let syntax mistakes/typos Fixes #103587
2022-11-08ignore wasm in testlcnr-2/+4
2022-11-08selection failure: recompute applicable implslcnr-6/+27
2022-11-08fix #103587, Recover from common if let syntax mistakes/typosyukang-0/+52
2022-10-23Rollup merge of #103305 - c410-f3r:moar-errors, r=petrochenkovDylan DPC-0/+22
Move some tests to more reasonable places r? `@petrochenkov`
2022-10-22Update UI testsclubby789-4/+45
2022-10-20Move some tests for more reasonable placesCaio-0/+22
2022-10-16fix `own_substs` ICETakayuki Maeda-0/+32
2022-10-05stop suggesting adding generic args for turbofishTakayuki Maeda-9/+20
2022-10-01bless ui testsMaybe Waffle-2/+2
2022-08-30Stabilize GATsJack Huey-3/+1
2022-08-21Rework ambiguity errorsMichael Goulet-27/+9
2022-08-21Account for relative pathsMichael Goulet-1/+1
2022-08-21Rework point-at-argMichael Goulet-12/+32
2022-07-20Normalize the arg spans to be within the call spanMichael Goulet-15/+12
2022-07-08Fix duplicated type annotation suggestionDaniel Xu-12/+0
Before, there was more or less duplicated suggestions to add type hints. Fix by clearing more generic suggestions when a more specific suggestion is possible. This fixes #93506 .
2022-07-04`InferSource::GenericArg`, check for containslcnr-9/+8
2022-07-04resolve vars in node substslcnr-1/+6
2022-07-04update infer cost computation for typeslcnr-0/+44
2022-07-01Show source of ambiguity in a few more placesMichael Goulet-6/+15
2022-06-28fix `emit_inference_failure_err` ICElcnr-0/+100
2022-06-23Rollup merge of #98269 - compiler-errors:provide-more-segment-res, ↵Michael Goulet-8/+8
r=petrochenkov Provide a `PathSegment.res` in more cases I find that in many cases, the `res` associated with a `PathSegment` is `Res::Err` even though the path was fully resolved. A few diagnostics use this `res` and their error messages suffer because of the lack of resolved segment. This fixes it a bit, but it's obviously not complete and I'm not exactly sure if it's correct.
2022-06-21Move some tests to more reasonable directoriesCaio-0/+299
2022-06-20Provide a segment res in more casesMichael Goulet-8/+8
2022-06-16diagnostics: fix trailing spaceklensy-2/+2
2022-06-11Rollup merge of #97703 - lcnr:post-89862, r=estebankDylan DPC-0/+154
some additional `need_type_info.rs` cleanup also fixes #97698, fixes #97806 cc `@estebank`
2022-06-08add test + don't warn on `Res::SelfTy`lcnr-0/+76
2022-06-08need_type_info: don't ICE when detected ty aliaslcnr-0/+78
fixes #97698
2022-06-06Deactivate feature gate explicit_generic_args_with_impl_traitNick Cameron-3/+3
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-06-02`generic_arg_contains_target`: ignore closureslcnr-8/+8
2022-06-02use verbose suggestionslcnr-3/+6
2022-06-02add new `emit_inference_failure_err`lcnr-72/+69
2022-05-20Rollup merge of #97109 - ↵Matthias Krüger-0/+52
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/+20
fix ci error emit err for `impl_item`
2022-05-17fix misleading `cannot infer type for type parameter` errorTakayuki Maeda-0/+32
2022-05-13Add regression test for #28935Yuki Okushi-0/+9
2022-04-30Bless the UI testsScott McMurray-10/+4
2022-04-16Implementation for 65853Jack Huey-10/+66
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-03-03Cleanup feature gates.Camille GILLOT-3/+1
2022-02-08Rollup merge of #92715 - chordtoll:empty-string, r=davidtwcoMatthias Krüger-2/+11
Do not suggest char literal for zero-length strings PR #92507 adds a hint to switch to single quotes when a char is expected and a single-character string literal is provided. The check to ensure the string literal is one character long missed the 0-char case, and would incorrectly offer the hint. This PR adds the missing check, and a test case to confirm the new behavior.
2022-01-16Only suggest char literal for single-character stringschordtoll-2/+11
2022-01-14Don't use source-map when detecting struct field shorthandMichael Goulet-1/+1
2022-01-04Auto merge of #92560 - matthiaskrgr:rollup-jeli7ip, r=matthiaskrgrbors-60/+0
Rollup of 7 pull requests Successful merges: - #91587 (core::ops::unsize: improve docs for DispatchFromDyn) - #91907 (Allow `_` as the length of array types and repeat expressions) - #92515 (RustWrapper: adapt for an LLVM API change) - #92516 (Do not use deprecated -Zsymbol-mangling-version in bootstrap) - #92530 (Move `contains` method of Option and Result lower in docs) - #92546 (Update books) - #92551 (rename StackPopClean::None to Root) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-03Suggest changing quotes when str/char type mismatchchordtoll-0/+100
2021-12-23implement `generic_arg_infer` for array lengthslcnr-60/+0
2021-12-11Tweak assoc type obligation spansEsteban Kuber-1/+1
* Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors
2021-12-07Add test with multiple type params failing inferenceEsteban Kuber-12/+45