Skip to content

Commit

Permalink
Rollup merge of rust-lang#33325 - birkenfeld:issue-31341, r=jseyfried
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Manishearth committed May 3, 2016
2 parents 68c29e0 + ffba7b7 commit 0ee84c7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
if let Some(expr) = rcvr_expr {
if let Ok (expr_string) = cx.sess.codemap().span_to_snippet(expr.span) {
report_function!(expr.span, expr_string);
err.span_suggestion(expr.span,
"try calling the base function:",
format!("{}()",
expr_string));
}
else if let Expr_::ExprPath(_, path) = expr.node.clone() {
if let Some(segment) = path.segments.last() {
Expand Down
4 changes: 0 additions & 4 deletions src/test/compile-fail/issue-29124.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ fn main() {
obj::func.x();
//~^ ERROR no method named `x` found for type `fn() -> ret {obj::func}` in the current scope
//~^^ NOTE obj::func is a function, perhaps you wish to call it
//~^^^ HELP try calling the base function:
//~| SUGGESTION obj::func().x();
func.x();
//~^ ERROR no method named `x` found for type `fn() -> ret {func}` in the current scope
//~^^ NOTE func is a function, perhaps you wish to call it
//~^^^ HELP try calling the base function:
//~| SUGGESTION func().x();
}

0 comments on commit 0ee84c7

Please sign in to comment.