-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Conversation
Make it clearer where the type name that couldn't be infered comes from.
r? @zackmdavis (rust_highfive has picked a reviewer for you, use r? to override) |
// 3 | let _ = x.sum() as f64; | ||
// | ^^^ cannot infer type for `S` | ||
// | | ||
// = note: type must be known at this point |
There was a problem hiding this comment.
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)
.
Whether to act on concern about large comment is your judgement call; r=me |
@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 |
📌 Commit 8458eba has been approved by |
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.
☀️ Test successful - checks-azure |
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).
Make it clearer where the type name that couldn't be inferred comes from.
Before:
after
CC #63852.