Commit Graph

12 Commits

Author SHA1 Message Date
Michael Howell
3d056c3125 diagnostics: if AssocFn has self argument, describe as method
Discussed in
https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515

This commit also changes the tooltips on rustdoc intra-doc links
targeting methods.
2023-02-22 08:40:33 -07:00
Matthias Krüger
226ce31edd Rollup merge of #108200 - jhpratt:restricted-damerau-levenshtein-distance, r=tmiasko
Use restricted Damerau-Levenshtein distance for diagnostics

This replaces the existing Levenshtein algorithm with the Damerau-Levenshtein algorithm. This means that "ab" to "ba" is one change (a transposition) instead of two (a deletion and insertion). More specifically, this is a _restricted_ implementation, in that "ca" to "abc" cannot be performed as "ca" → "ac" → "abc", as there is an insertion in the middle of a transposition. I believe that errors like that are sufficiently rare that it's not worth taking into account.

This was first brought up [on IRLO](https://internals.rust-lang.org/t/18227) when it was noticed that the diagnostic for `prinltn!` (transposed L and T) was `print!` and not `println!`. Only a single existing UI test was effected, with the result being an objective improvement.

~~I have left the method name and various other references to the Levenshtein algorithm untouched, as the exact manner in which the edit distance is calculated should not be relevant to the caller.~~

r? ``@estebank``

``@rustbot`` label +A-diagnostics +C-enhancement
2023-02-20 14:32:55 +01:00
León Orell Valerian Liehr
f2253dad24 Add some FIXMEs for follow-up PRs 2023-02-19 22:54:47 +01:00
León Orell Valerian Liehr
77ea90ec71 Fix substitution bug 2023-02-19 18:35:35 +01:00
León Orell Valerian Liehr
b5e73bfe90 Groundwork for detecting ambiguous candidates
NB: Since we are using the same InferCtxt in each iteration,
we essentially *spoil* the inference variables and we only
ever get at most *one* applicable candidate (only the 1st candidate
has clean variables that can still unify correctly).
2023-02-19 18:35:35 +01:00
León Orell Valerian Liehr
cc65ebd0d2 Make use of ObligationCtxt 2023-02-19 18:35:34 +01:00
León Orell Valerian Liehr
488d0c9efd Type-directed probing for inherent associated types 2023-02-19 18:35:28 +01:00
Jacob Pratt
378c4ab9ab Make public API, docs algorithm-agnostic 2023-02-19 04:11:10 +00:00
Maybe Waffle
6a28fb42a8 Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
Albert Larsan
40ba0e84d5 Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
Oli Scherer
ecea616052 Simplify astconv item def id handling 2022-11-02 12:03:59 +00:00
lcnr
1fc86a63f4 rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00