about summary refs log tree commit diff
path: root/src/test/ui/resolve
AgeCommit message (Collapse)AuthorLines
2022-08-28More descriptive argument placeholdersMichael Goulet-6/+6
2022-08-23Improve local generic parameter suggestions.Camille GILLOT-19/+21
2022-08-18Rollup merge of #100643 - ↵Matthias Krüger-0/+33
TaKO8Ki:point-at-type-parameter-shadowing-another-type, r=estebank Point at a type parameter shadowing another type This patch fixes a part of #97459.
2022-08-17point at a type parameter shadowing another typeTakayuki Maeda-0/+33
2022-08-11Suggest path separator when a dot is used on a traitLeón Orell Valerian Liehr-34/+356
2022-08-05Rollup merge of #99835 - ↵Dylan DPC-2/+16
TaKO8Ki:suggest-adding-or-removing-ref-for-binding-pattern, r=estebank Suggest adding/removing `ref` for binding patterns This fixes what a fixme comment says. r? `@estebank`
2022-07-28Remove guess_head_span.Camille GILLOT-2/+8
2022-07-28suggest adding/removing `ref` for binding patternsTakayuki Maeda-2/+16
2022-07-25Report elision failures on the AST.Camille GILLOT-1/+1
2022-07-20take opaq typesouz-a-8/+17
2022-07-16Be more precise when suggesting removal of parens on unit adt ctorMichael Goulet-6/+6
2022-07-11Mention similarly named associated type even if it's not clearly in supertraitMichael Goulet-0/+21
2022-07-06use `named_span` in case of tuple variantTakayuki Maeda-3/+3
2022-07-01Shorten def_span for more items.Camille GILLOT-14/+14
2022-06-19Mention what item is using an invalid `Self` typeMichael Goulet-4/+77
2022-06-16 fix one more case of trailing spaceklensy-6/+6
2022-06-16diagnostics: fix trailing spaceklensy-10/+10
2022-06-15Rollup merge of #97822 - compiler-errors:hesitate-to-suggest-intrinsics, ↵Yuki Okushi-0/+35
r=oli-obk Filter out intrinsics if we have other import candidates to suggest Fixes #97618 Also open to just sorting these candidates to be last. Pretty easy to modify the code to do that, too.
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-2/+10
2022-06-07Filter out intrinsics if we have other import candidates to suggestMichael Goulet-0/+35
2022-06-02add new `emit_inference_failure_err`lcnr-1/+6
2022-06-01Rollup merge of #97264 - ↵Matthias Krüger-0/+14
TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank Suggest `extern crate foo` when failing to resolve `use foo` closes #97095 r? ``@estebank``
2022-05-25suggest `extern crate foo` when failing to resolve `use foo`Takayuki Maeda-0/+14
fix ci error
2022-05-24Rollup merge of #97240 - TaKO8Ki:improve-errors-about-typos-on-variables, ↵Yuki Okushi-0/+155
r=compiler-errors Typo suggestion for a variable with a name similar to struct fields closes #97133
2022-05-23add typo suggestions for all `AssocSuggestion` variantsTakayuki Maeda-4/+104
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-4/+2
2022-05-21typo suggestion for a variable with a name similar to struct fieldsTakayuki Maeda-0/+55
2022-05-06Resolve vars in note_type_errJack Huey-2/+2
2022-05-05Rollup merge of #96507 - TaKO8Ki:suggest-calling-associated-function, r=lcnrMatthias Krüger-0/+10
Suggest calling `Self::associated_function()` closes #96453
2022-05-05suggest calling `Self::associated_function()`Takayuki Maeda-0/+10
do not suggest when trait_ref is some Update compiler/rustc_resolve/src/late/diagnostics.rs Co-authored-by: lcnr <rust@lcnr.de> use helper struct add a test for functions with some params refactor debug log
2022-05-03Tweak wordingEsteban Kuber-14/+14
2022-05-03When suggesting to import an item, also suggest changing the path if appropriateEsteban Küber-7/+42
When we don't find an item we search all of them for an appropriate import and suggest `use`ing it. This is sometimes done for expressions that have paths with more than one segment. We now also suggest changing that path to work with the `use`. Fix #95413
2022-05-01Move some tests to more reasonable placesCaio-0/+200
2022-04-30When encountering a binding that could be a const or unit variant, suggest ↵Esteban Kuber-17/+14
the right path
2022-04-26Move some tests to more reasonable placesCaio-0/+26
2022-04-16Implementation for 65853Jack Huey-3/+5
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-28Remove opaque type obligation and just register opaque types as they are ↵Oli Scherer-2/+13
encountered. This also registers obligations for the hidden type immediately.
2022-03-28Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk"Oli Scherer-22/+2
This reverts commit 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d, reversing changes made to 78450d2d602b06d9b94349aaf8cece1a4acaf3a8.
2022-03-04Update use_suggestion_placement.rs test, removing the FIXME that this PR fixes.Felix S. Klock II-13/+5
(There is another issue, in that the fixed output is not ideally indented, but that is a pre-existing issue and should not block this PR.)
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-2/+22
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-22/+2
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-01-19Only suggest adding `!` to expressions that can be macro invocationEsteban Kuber-3/+60
2021-12-11Tweak assoc type obligation spansEsteban Kuber-3/+5
* 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-11-20Rollup merge of #91021 - compiler-errors:print_future_output, r=estebankMatthias Krüger-1/+1
Elaborate `Future::Output` when printing opaque `impl Future` type I would love to see the `Output =` type when printing type errors involving opaque `impl Future`. [Test code](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a800b481edd31575fbcaf5771a9c3678) Before (cut relevant part of output): ``` note: while checking the return type of the `async fn` --> /home/michael/test.rs:5:19 | 5 | async fn bar() -> usize { | ^^^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `usize` found opaque type `impl Future` ``` After: ``` note: while checking the return type of the `async fn` --> /home/michael/test.rs:5:19 | 5 | async fn bar() -> usize { | ^^^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `usize` found opaque type `impl Future<Output = usize>` ``` Note the "found opaque type `impl Future<Output = usize>`" in the new output. ---- Questions: 1. We skip printing the output type when it's a projection, since I have been seeing some types like `impl Future<Output = <[static generator@/home/michael/test.rs:2:11: 2:21] as Generator<ResumeTy>>::Return>` which are not particularly helpful and leak implementation detail. * Am I able to normalize this type within `rustc_middle::ty::print::pretty`? Alternatively, can we normalize it when creating the diagnostic? Otherwise, I'm fine with skipping it and falling back to the old output. * Should I suppress any other types? I didn't encounter anything other than this generator projection type. 2. Not sure what the formatting of this should be. Do I include spaces in `Output = `?
2021-11-19Rollup merge of #90961 - estebank:suggest-removal-of-call, r=nagisaYuki Okushi-6/+9
Suggest removal of arguments for unit variant, not replacement
2021-11-18Print output ty for opaque future tyMichael Goulet-1/+1
2021-11-18Move some tests to more reasonable directoriesCaio-0/+118
2021-11-16Suggest removal of arguments for unit variant, not replacementEsteban Kuber-6/+9
2021-11-14Move some tests to more reasonable directoriesCaio-0/+336
2021-11-06Move some tests to more reasonable directoriesCaio-0/+253