diff options
| author | bors <bors@rust-lang.org> | 2022-01-28 09:46:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-01-28 09:46:22 +0000 |
| commit | e0e70c0c2c4fc8d150a56c181994e3a3b3e9999a (patch) | |
| tree | 0b7df5ec78235f4f7280b7bab5d7157bda5b208e /src/test/rustdoc-js-std/string-from_ut.js | |
| parent | 312a7995e73e390646bc61920ffead7a640addc6 (diff) | |
| parent | a8bac9879a36d01c1fc325ed85d6a992deab88fa (diff) | |
| download | rust-e0e70c0c2c4fc8d150a56c181994e3a3b3e9999a.tar.gz rust-e0e70c0c2c4fc8d150a56c181994e3a3b3e9999a.zip | |
Auto merge of #90677 - bobrippling:suggest-tuple-parens, r=camelid
Suggest tuple-parentheses for enum variants
This follows on from #86493 / #86481, making the parentheses suggestion. To summarise, given the following code:
```rust
fn f() -> Option<(i32, i8)> {
Some(1, 2)
}
```
The current output is:
```
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
--> b.rs:2:5
|
2 | Some(1, 2)
| ^^^^ - - supplied 2 arguments
| |
| expected 1 argument
error: aborting due to previous error
For more information about this error, try `rustc --explain E0061`.
```
With this change, `rustc` will now suggest parentheses when:
- The callee is expecting a single tuple argument
- The number of arguments passed matches the element count in the above tuple
- The arguments' types match the tuple's fields
```
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
--> b.rs:2:5
|
2 | Some(1, 2)
| ^^^^ - - supplied 2 arguments
|
help: use parentheses to construct a tuple
|
2 | Some((1, 2))
| + +
```
Diffstat (limited to 'src/test/rustdoc-js-std/string-from_ut.js')
0 files changed, 0 insertions, 0 deletions
