about summary refs log tree commit diff
path: root/src/test/ui/methods/method-call-err-msg.stderr
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-89/+0
2023-01-05Tweak wording of fn call with wrong number of argsEsteban Küber-4/+4
2022-12-13Inform the user which trait is meant in the diagnostic itself instead of ↵Oli Scherer-1/+1
relying on the span making it obvious
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-3/+0
available
2022-09-03Shrink suggestion span of argument mismatch errorMichael Goulet-4/+4
2022-08-12Point out a single arg if we have a single arg incompatibilityMichael Goulet-4/+4
2022-07-07Track implicit `Sized` obligations in type paramsEsteban Küber-2/+2
Suggest adding a `?Sized` bound if appropriate on E0599 by inspecting the HIR Generics. (Fix #98539)
2022-07-01Shorten def_span for more items.Camille GILLOT-9/+3
2022-06-27Use typed indices in argument mismatch algorithmMichael Goulet-1/+1
2022-06-25Rollup merge of #98298 - TaKO8Ki:point-to-type-param-definition, ↵Matthias Krüger-2/+2
r=compiler-errors Point to type parameter definition when not finding variant, method and associated item fixes #77391
2022-06-22point to type param definition when not finding variant, method and assoc typeTakayuki Maeda-2/+2
use `def_ident_span` , `body_owner_def_id` instead of `in_progress_typeck_results`, `guess_head_span` use `body_id.owner` directly add description to label
2022-06-19Make missing argument placeholder more obvious that it's a placeholderMichael Goulet-6/+6
2022-04-16Implementation for 65853Jack Huey-12/+20
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-09diagnostics: use rustc_on_unimplemented to recommend `[].iter()`Michael Howell-2/+2
To make this work, the `#[rustc_on_unimplemented]` data needs to be used to report method resolution errors, which is most of what this commit does. Fixes #94581
2021-10-05Consider unfulfilled obligations in binop errorsEsteban Kuber-0/+11
When encountering a binop where the types would have been accepted, if all the predicates had been fulfilled, include information about the predicates and suggest appropriate `#[derive]`s if possible. Point at trait(s) that needs to be `impl`emented.
2021-01-26Avoid describing a method as 'not found' when bounds are unsatisfiedAaron Hill-3/+3
Fixes #76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
2020-10-15ensure arguments are included in count mismatch spanAndy Russell-12/+24
2020-09-02pretty: trim paths of unique symbolsDan Aloni-4/+4
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-02-28Do not suggest implementing traits if present in predicatesEsteban Küber-3/+2
2020-02-28Review comments: split requirement text to multiple lines for readabilityEsteban Küber-1/+2
2020-02-28Show information of chain of bound obligationsEsteban Küber-1/+1
When the obligation that couldn't be fulfilled is specific to a nested obligation, maintain both the nested and parent obligations around for more accurate and detailed error reporting.
2020-02-28Track all predicates in errors, not just trait obligationsEsteban Küber-1/+3
Surface associated type projection bounds that could not be fulfilled in E0599 errors. Always present the list of unfulfilled trait bounds, regardless of whether we're pointing at the ADT or trait that didn't satisfy it.
2020-02-28Deduplicate information in E0599Esteban Küber-3/+1
2020-02-28Reduce vebosity of E0599Esteban Küber-1/+0
2020-02-28Add more context to E0599 errorsEsteban Küber-2/+6
Point at the intermediary unfullfilled trait bounds.
2020-02-11On mismatched argument count point at argumentsEsteban Küber-11/+28
2020-01-08Unify output of "variant not found" errorsEsteban Küber-1/+1
2019-09-08Give method not found a primary span labelEsteban Küber-1/+1
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-1/+1
2019-03-11Update testsVadim Petrochenkov-4/+4
2018-12-25Remove licensesMark Rousskov-4/+4
2018-08-14Merged migrated compile-fail tests and ui tests. Fixes #46841.David Wood-0/+47