Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point at method call on missing annotation error #63901

Merged
merged 1 commit into from
Aug 26, 2019

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Aug 25, 2019

Make it clearer where the type name that couldn't be inferred comes from.

Before:

error[E0282]: type annotations needed
 --> src/test/ui/span/type-annotations-needed-expr.rs:2:13
  |
2 |     let _ = (vec![1,2,3]).into_iter().sum() as f64; //~ ERROR E0282
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `S`
  |
  = note: type must be known at this point

after

error[E0282]: type annotations needed
 --> src/test/ui/span/type-annotations-needed-expr.rs:2:39
  |
2 |     let _ = (vec![1,2,3]).into_iter().sum() as f64; //~ ERROR E0282
  |                                       ^^^ cannot infer type for `S`
  |
  = note: type must be known at this point

CC #63852.

Make it clearer where the type name that couldn't be infered comes from.
@rust-highfive
Copy link
Collaborator

r? @zackmdavis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 25, 2019
// 3 | let _ = x.sum() as f64;
// | ^^^ cannot infer type for `S`
// |
// = note: type must be known at this point
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm skeptical that this comment really demands 16 lines of vertical space (and analogously on line 204), as opposed to a shorter comment like // point to method rather than entire expression (Issue #63852).

@zackmdavis
Copy link
Member

Whether to act on concern about large comment is your judgement call; r=me

@estebank
Copy link
Contributor Author

@zackmdavis I prefer to lean towards verbosity in these cases because it is quite a subtle thing, and you might miss it otherwise when doing a refactoring. I had an internal back and forth about this and ended up leaving it in.

@bors r=zackmdavis

@bors
Copy link
Contributor

bors commented Aug 26, 2019

📌 Commit 8458eba has been approved by zackmdavis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 26, 2019
@bors
Copy link
Contributor

bors commented Aug 26, 2019

⌛ Testing commit 8458eba with merge 9b91b9c...

bors added a commit that referenced this pull request Aug 26, 2019
Point at method call on missing annotation error

Make it clearer where the type name that couldn't be inferred comes from.

Before:

```
error[E0282]: type annotations needed
 --> src/test/ui/span/type-annotations-needed-expr.rs:2:13
  |
2 |     let _ = (vec![1,2,3]).into_iter().sum() as f64; //~ ERROR E0282
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `S`
  |
  = note: type must be known at this point
```
after
```
error[E0282]: type annotations needed
 --> src/test/ui/span/type-annotations-needed-expr.rs:2:39
  |
2 |     let _ = (vec![1,2,3]).into_iter().sum() as f64; //~ ERROR E0282
  |                                       ^^^ cannot infer type for `S`
  |
  = note: type must be known at this point
```

CC #63852.
@bors
Copy link
Contributor

bors commented Aug 26, 2019

☀️ Test successful - checks-azure
Approved by: zackmdavis
Pushing 9b91b9c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 26, 2019
@bors bors merged commit 8458eba into rust-lang:master Aug 26, 2019
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #63901!

Tested on commit 9b91b9c.
Direct link to PR: #63901

🎉 rustc-guide on linux: test-fail → test-pass (cc @mark-i-m @spastorino @amanjeev, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Aug 26, 2019
Tested on commit rust-lang/rust@9b91b9c.
Direct link to PR: <rust-lang/rust#63901>

🎉 rustc-guide on linux: test-fail → test-pass (cc @mark-i-m @spastorino @amanjeev, @rust-lang/infra).
@estebank estebank deleted the unknown-receiver-type branch November 9, 2023 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants