Uh oh!
There was an error while loading. Please reload this page.
Suggest syntax when finding method on array - #44970
Conversation
rust-highfive
commented
Oct 2, 2017
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
Suggest syntax when finding method on array
On a file like the following:
```rust
fn main() {
let a = [1, 2, 3];
let _ = [i32; 3]::clone(&a);
}
```
it is a fair assumption that what was meant was to use an associated
type on an array, so we suggest the correct syntax:
```
error: expected one of `.`, `;`, `?`, or an operator, found `::`
--> file.rs:3:21
|
3 | let _ = [i32; 3]::clone(&a);
| --------^^
| | |
| | expected one of `.`, `;`, `?`, or an operator here
| help: did you mean to use an associated type?: `<[i32; 3]>::`
```
Fix#42187.On a file like the following:
```rust
fn main() {
let a = [1, 2, 3];
let _ = [i32; 3]::clone(&a);
}
```
it is a fair assumption that what was meant was to use an associated
type on an array, so we suggest the correct syntax:
```
error: expected one of `.`, `;`, `?`, or an operator, found `::`
--> file.rs:3:21
|
3 | let _ = [i32; 3]::clone(&a);
| --------^^
| | |
| | expected one of `.`, `;`, `?`, or an operator here
| help: did you mean to use an associated type?: `<[i32; 3]>::`
```estebank
commented
Oct 2, 2017
Current error is unrelated to this PR: |
petrochenkov
commented
Oct 3, 2017
There's much more potential for diagnostics/recovery here than just I'd actually test for You can omit recovery for a start and just report extra help in those cases. |
| | --------^^ | ||
| | | | | ||
| | | expected one of `.`, `;`, `?`, or an operator here | ||
| | help: did you mean to use an associated type?: `<[i32; 3]>::` |
There was a problem hiding this comment.
clone is not an associated type.
"associated item" maybe?
bors
commented
Oct 8, 2017
☔ The latest upstream changes (presumably #45100) made this pull request unmergeable. Please resolve the merge conflicts. |
aidanhs
commented
Oct 12, 2017
Hi @estebank, I can see there are some merge conflicts that need to be resolved! |
alexcrichton
commented
Oct 19, 2017
Triage again! I'm going to close this for now to help clear out the queue, but of course feel free to resubmit with a rebase! |
On a file like the following:
it is a fair assumption that what was meant was to use an associated
type on an array, so we suggest the correct syntax:
Fix#42187.