Skip to content

Commit ffba7b7

Browse files
committed
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
1 parent 2a815a2 commit ffba7b7

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

src/librustc_typeck/check/method/suggest.rs

-4
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
158158
if let Some(expr) = rcvr_expr {
159159
if let Ok (expr_string) = cx.sess.codemap().span_to_snippet(expr.span) {
160160
report_function!(expr.span, expr_string);
161-
err.span_suggestion(expr.span,
162-
"try calling the base function:",
163-
format!("{}()",
164-
expr_string));
165161
}
166162
else if let Expr_::ExprPath(_, path) = expr.node.clone() {
167163
if let Some(segment) = path.segments.last() {

src/test/compile-fail/issue-29124.rs

-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ fn main() {
2525
obj::func.x();
2626
//~^ ERROR no method named `x` found for type `fn() -> ret {obj::func}` in the current scope
2727
//~^^ NOTE obj::func is a function, perhaps you wish to call it
28-
//~^^^ HELP try calling the base function:
29-
//~| SUGGESTION obj::func().x();
3028
func.x();
3129
//~^ ERROR no method named `x` found for type `fn() -> ret {func}` in the current scope
3230
//~^^ NOTE func is a function, perhaps you wish to call it
33-
//~^^^ HELP try calling the base function:
34-
//~| SUGGESTION func().x();
3531
}

0 commit comments

Comments
 (0)