<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/test/ui/numeric, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2023-01-11T09:32:08+00:00</updated>
<entry>
<title>Move /src/test to /tests</title>
<updated>2023-01-11T09:32:08+00:00</updated>
<author>
<name>Albert Larsan</name>
<email>74931857+albertlarsan68@users.noreply.github.com</email>
</author>
<published>2023-01-05T08:13:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cf2dff2b1e3fa55fa5415d524200070d0d7aacfe'/>
<id>urn:sha1:cf2dff2b1e3fa55fa5415d524200070d0d7aacfe</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #105161 - cassaundra:numeric-literal-error, r=nnethercote</title>
<updated>2022-12-14T09:31:05+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>matthias.krueger@famsik.de</email>
</author>
<published>2022-12-14T09:31:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8ed0384ca4651e914793dd8a05c9cdec9b2089b4'/>
<id>urn:sha1:8ed0384ca4651e914793dd8a05c9cdec9b2089b4</id>
<content type='text'>
Refine when invalid prefix case error arises

Fix cases where the "invalid base prefix for number literal" error arises with suffixes that look erroneously capitalized but which are actually invalid.
</content>
</entry>
<entry>
<title>Refine when invalid prefix case error arises</title>
<updated>2022-12-13T03:32:12+00:00</updated>
<author>
<name>Cassaundra Smith</name>
<email>cass@cassaundra.org</email>
</author>
<published>2022-12-02T03:17:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=52a9280fb249f2dfbc879ae32b1823203822fbec'/>
<id>urn:sha1:52a9280fb249f2dfbc879ae32b1823203822fbec</id>
<content type='text'>
Fix cases where the "invalid base prefix for number literal" error arises with
suffixes that look erroneously capitalized but which are in fact invalid.
</content>
</entry>
<entry>
<title>Point at LHS on binop type err if relevant</title>
<updated>2022-12-08T23:30:57+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2022-12-02T23:56:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=132a140214522246bef5da015f5cfb78da7074be'/>
<id>urn:sha1:132a140214522246bef5da015f5cfb78da7074be</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Implementation for 65853</title>
<updated>2022-04-16T06:26:56+00:00</updated>
<author>
<name>Jack Huey</name>
<email>31162821+jackh726@users.noreply.github.com</email>
</author>
<published>2022-01-22T04:50:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b6c87c555f3b664f558d137d5f7696a07488157e'/>
<id>urn:sha1:b6c87c555f3b664f558d137d5f7696a07488157e</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Write UI tests, tweak message</title>
<updated>2022-01-31T17:34:10+00:00</updated>
<author>
<name>5225225</name>
<email>5225225@mailbox.org</email>
</author>
<published>2022-01-27T22:22:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ec3b711a4bcc8cb3af34b2cdf1ad110eef5981f9'/>
<id>urn:sha1:ec3b711a4bcc8cb3af34b2cdf1ad110eef5981f9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove incorrect newline from float cast suggestion</title>
<updated>2021-12-03T01:00:09+00:00</updated>
<author>
<name>Esteban Kuber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2021-12-03T01:00:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5b5df0fa17a36ab1a182313c2cb4db0799b9249f'/>
<id>urn:sha1:5b5df0fa17a36ab1a182313c2cb4db0799b9249f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Move some tests to more reasonable directories</title>
<updated>2021-11-14T17:38:42+00:00</updated>
<author>
<name>Caio</name>
<email>c410.f3r@gmail.com</email>
</author>
<published>2021-11-14T17:38:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ab5434f9b8d3937fe33f813b3f8e1a43a4657781'/>
<id>urn:sha1:ab5434f9b8d3937fe33f813b3f8e1a43a4657781</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #87960 - hkmatsumoto:suggest-inexisting-field-for-unmentioned-field, r=estebank</title>
<updated>2021-09-19T08:31:29+00:00</updated>
<author>
<name>Yuki Okushi</name>
<email>jtitor@2k36.org</email>
</author>
<published>2021-09-19T08:31:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ebd31f5f1a51099038935e679b0eb92afa3364a5'/>
<id>urn:sha1:ebd31f5f1a51099038935e679b0eb92afa3364a5</id>
<content type='text'>
Suggest replacing an inexisting field for an unmentioned field

Fix #87938

This PR adds a suggestion to replace an inexisting field for an
unmentioned field. Given the following code:
```rust
enum Foo {
    Bar { alpha: u8, bravo: u8, charlie: u8 },
}

fn foo(foo: Foo) {
    match foo {
        Foo::Bar {
            alpha,
            beta, // `bravo` miswritten as `beta` here.
            charlie,
        } =&gt; todo!(),
    }
}
```
the compiler now emits the error messages below.
```text
error[E0026]: variant `Foo::Bar` does not have a field named `beta`
 --&gt; src/lib.rs:9:13
  |
9 |             beta, // `bravo` miswritten as `beta` here.
  |             ^^^^
  |             |
  |             variant `Foo::Bar` does not have this field
  |             help: `Foo::Bar` has a field named `bravo`: `bravo`
```

Note that this suggestion is available iff the number of inexisting
fields and unmentioned fields are both 1.
</content>
</entry>
<entry>
<title>Auto merge of #87915 - estebank:fancy-spans, r=oli-obk</title>
<updated>2021-09-13T16:31:12+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2021-09-13T16:31:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9bb77da74dac4768489127d21e32db19b59ada5b'/>
<id>urn:sha1:9bb77da74dac4768489127d21e32db19b59ada5b</id>
<content type='text'>
Use smaller spans for some structured suggestions

Use more accurate suggestion spans for

* argument parse error
* fully qualified path
* missing code block type
* numeric casts
</content>
</entry>
</feed>
