Skip to content

Commit 0ee84c7

Browse files
committed
Rollup merge of rust-lang#33325 - birkenfeld:issue-31341, r=jseyfried
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
2 parents 68c29e0 + ffba7b7 commit 0ee84c7

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
@@ -156,10 +156,6 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
156156
if let Some(expr) = rcvr_expr {
157157
if let Ok (expr_string) = cx.sess.codemap().span_to_snippet(expr.span) {
158158
report_function!(expr.span, expr_string);
159-
err.span_suggestion(expr.span,
160-
"try calling the base function:",
161-
format!("{}()",
162-
expr_string));
163159
}
164160
else if let Expr_::ExprPath(_, path) = expr.node.clone() {
165161
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)