Uh oh!
There was an error while loading. Please reload this page.
Introduce TyErr independent from TyInfer - #40887
Conversation
rust-highfive
commented
Mar 29, 2017
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
ed0e5dd to
0835f7cComparepetrochenkov
commented
Mar 29, 2017
|
There was a problem hiding this comment.
Nit: error reporting is a "cold" code for a reader trying to understand the main logic (syntax of fn arguments in this case), it often makes sense to factor it into a separate function (already done) and move it somewhere else, so it's invisible unless intentionally looked for.
estebank
commented
Apr 2, 2017
@petrochenkov done. |
TyPlaceholder independent from TyInferTyErr independent from TyInferAdd a `TyErr` type to represent unknown types in places where
parse errors have happened, while still able to build the AST.
Initially only used to represent incorrectly written fn arguments and
avoid "expected X parameters, found Y" errors when called with the
appropriate amount of parameters. We cannot use `TyInfer` for this as
`_` is not allowed as a valid argument type.
Example output:
```rust
error: expected one of `:` or `@`, found `,`
--> file.rs:12:9
|
12 | fn bar(x, y: usize) {}
| ^
error[E0061]: this function takes 2 parameters but 3 parameters were supplied
--> file.rs:19:9
|
12 | fn bar(x, y) {}
| --------------- defined here
...
19 | bar(1, 2, 3);
| ^^^^^^^ expected 2 parameters
```arielb1
commented
Apr 6, 2017
petrochenkov
commented
Apr 6, 2017
@bors r+ |
bors
commented
Apr 6, 2017
📌 Commit b83352e has been approved by |
bors
commented
Apr 7, 2017
☔ The latest upstream changes (presumably #41121) made this pull request unmergeable. Please resolve the merge conflicts. |
60b37ee to
d01bc33Compareestebank
commented
Apr 8, 2017
@bors r=petrochenkov |
bors
commented
Apr 8, 2017
📌 Commit 8c31412 has been approved by |
bors
commented
Apr 8, 2017
⌛ Testing commit 8c31412 with merge 566afe4... |
bors
commented
Apr 8, 2017
💔 Test failed - status-appveyor |
TimNN
commented
Apr 8, 2017
bors
commented
Apr 8, 2017
Introduce `TyErr` independent from `TyInfer`
Add a `TyErr` type to represent unknown types in places where
parse errors have happened, while still able to build the AST.
Initially only used to represent incorrectly written fn arguments and
avoid "expected X parameters, found Y" errors when called with the
appropriate amount of parameters. We cannot use `TyInfer` for this as
`_` is not allowed as a valid argument type.
Example output:
```rust
error: expected one of `:` or `@`, found `,`
--> file.rs:12:9
|
12 | fn bar(x, y: usize) {}
| ^
error[E0061]: this function takes 2 parameters but 3 parameters were supplied
--> file.rs:19:9
|
12 | fn bar(x, y) {}
| --------------- defined here
...
19 | bar(1, 2, 3);
| ^^^^^^^ expected 2 parameters
```
Fix#34264.bors
commented
Apr 8, 2017
☀️ Test successful - status-appveyor, status-travis |
Add a
TyErrtype to represent unknown types in places whereparse errors have happened, while still able to build the AST.
Initially only used to represent incorrectly written fn arguments and
avoid "expected X parameters, found Y" errors when called with the
appropriate amount of parameters. We cannot use
TyInferfor this as_is not allowed as a valid argument type.Example output:
Fix#34264.