-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Diagnostic when "constructing" something with ::new instead of ::new() should be better. #31341
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
Comments
steveklabnik
added
the
A-diagnostics
Area: Messages for errors, warnings, and lints
label
Feb 2, 2016
This is now somewhat fixed:
I found "try calling the base function" to be confusing. What's a "base" function? Another problem is that this suggests fn myfn(a: u8) { loop {} }
fn main() {
let mut q = myfn;
for i in 0..1000_000_000 {
q.insert(i, [0u8; 65536]);
}
}
|
birkenfeld
added a commit
to birkenfeld/rust
that referenced
this issue
May 1, 2016
* It is not clear what a "base function" is. * The suggestion just adds parens, so suggests calling without args. The second point could be fixed with e.g. `(...)` instead of `()`, but the preceding "note: X is a function, perhaps you wish to call it" should already be clear enough. Fixes: rust-lang#31341
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
May 2, 2016
typeck: remove confusing suggestion for calling a fn type * It is not clear what a "base function" is. * The suggestion just adds parens, so suggests calling without args. The second point could be fixed with e.g. `(...)` instead of `()`, but the preceding "note: X is a function, perhaps you wish to call it" should already be clear enough. Fixes: rust-lang#31341
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
May 3, 2016
typeck: remove confusing suggestion for calling a fn type * It is not clear what a "base function" is. * The suggestion just adds parens, so suggests calling without args. The second point could be fixed with e.g. `(...)` instead of `()`, but the preceding "note: X is a function, perhaps you wish to call it" should already be clear enough. Fixes: rust-lang#31341
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At first I tried
add
instead ofinsert
, then looked at docs, changed toinsert
again, then tried deliberately invalidinse3rt
to ensure that error message does not change. Then I noticedfn()
in error message and after little thinking found the issue.Maybe such simple mistake should have friendlier error message? For example, if
obj.method
does not exist, butobj().method
does, it can be mentioned somehow.The text was updated successfully, but these errors were encountered: