about summary refs log tree commit diff
path: root/src/test/ui/terminal-width
AgeCommit message (Collapse)AuthorLines
2022-07-06session: `terminal-width` -> `output-width`David Wood-206/+0
Rename the `--terminal-width` flag to `--output-width` as the behaviour doesn't just apply to terminals (and so is slightly less accurate). Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06sess: stabilize `--terminal-width`David Wood-3/+3
Formerly `-Zterminal-width`, `--terminal-width` allows the user or build tool to inform rustc of the width of the terminal so that diagnostics can be truncated. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-16Implementation for 65853Jack Huey-1/+1
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-01-18Make suggestions verboseNoah Lev-6/+9
2022-01-18Shorten and improve messagesNoah Lev-12/+7
2022-01-12Add line breaks to make message easier to readNoah Lev-1/+3
2022-01-12Split up very long messageNoah Lev-1/+2
This should make it easier to read.
2022-01-12Improve suggestions for type errors with string concatenationNoah Lev-1/+1
Now, multipart suggestions are used instead of `span_to_snippet`, which improves code quality, makes the suggestion work even without access to source code, and, most importantly, improves the rendering of the suggestion.
2021-08-11Modify structured suggestion outputEsteban Küber-1/+1
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2020-12-06Add test for trimming with tabs (#78438)J. Ryan Stinnett-0/+25
2020-10-25Update description for error E0308Olivier FAURE-12/+20
As per #76462
2020-06-26errors: use `-Z terminal-width` in JSON emitterDavid Wood-0/+61
This commit makes the JSON emitter use `-Z terminal-width` in the "rendered" field of the JSON output. Signed-off-by: David Wood <david@davidtw.co>
2019-12-12Update testsLeSeulArtichaut-1/+1
2019-12-12Update UI test expectationsLeSeulArtichaut-1/+1
2019-11-27Draw vertical lines in compiler error messages with multiline annotations ↵Christoph Schmidler-1/+25
correctly when non-1space unicode characters are to the left For this we use the correct calculation of the 'left' identation
2019-11-21Point at type in `let` assignment on type errorsEsteban Küber-7/+15
2019-11-18Surround types with backticks in type errorsEsteban Küber-8/+8
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-15/+0
2019-11-18review comments: tweak prefix stringsEsteban Küber-10/+10
2019-08-21Further unicode checksEsteban Küber-0/+18
2019-08-21Center trim on the span labels and handle unicodeEsteban Küber-6/+6
2019-08-21Fix tidyEsteban Küber-4/+4
2019-08-21Introduce `term-size` dependency and consider term width when trimmingEsteban Küber-0/+76