Skip to content

Commit fa0efa6

Browse files
Daniel J RollinsManishearth
Daniel J Rollins
authored andcommitted
Add test for issue 29124
1 parent 5e3b36c commit fa0efa6

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/librustc_typeck/check/method/suggest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
134134
if let Ok (expr_string) = cx.sess.codemap().span_to_snippet(expr.span) {
135135
err.fileline_note(
136136
expr.span,
137-
&format!("{} is a function, perhaps you wish to call it?",
137+
&format!("{} is a function, perhaps you wish to call it",
138138
expr_string));
139139
err.span_suggestion(expr.span,
140140
"try calling the base function:",

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct ret;
12+
struct obj;
13+
14+
impl obj {
15+
fn func() -> ret {
16+
ret
17+
}
18+
}
19+
20+
fn func() -> ret {
21+
ret
22+
}
23+
24+
fn main() {
25+
obj::func.x();
26+
//~^ ERROR no method named `x` found for type `fn() -> ret {obj::func}` in the current scope
27+
//~^^ NOTE obj::func is a function, perhaps you wish to call it
28+
func.x();
29+
//~^ ERROR no method named `x` found for type `fn() -> ret {func}` in the current scope
30+
//~^^ NOTE func is a function, perhaps you wish to call it
31+
}

0 commit comments

Comments
 (0)