diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index c496053a154..3ac5994cd1a 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -176,7 +176,18 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if mode == Mode::MethodCall { "method" } else { - "associated item" + match item_name.as_str().chars().next() { + Some(name) => { + if name.is_lowercase() { + "function or associated item" + } else { + "associated item" + } + }, + None => { + "" + }, + } }, item_name, self.ty_to_string(actual)) diff --git a/src/test/compile-fail/bogus-tag.rs b/src/test/compile-fail/bogus-tag.rs index a1021500be3..c388d47da6e 100644 --- a/src/test/compile-fail/bogus-tag.rs +++ b/src/test/compile-fail/bogus-tag.rs @@ -15,6 +15,6 @@ fn main() { let red: color = color::rgb(255, 0, 0); match red { color::rgb(r, g, b) => { println!("rgb"); } - color::hsl(h, s, l) => { println!("hsl"); } //~ ERROR no associated + color::hsl(h, s, l) => { println!("hsl"); } //~ ERROR no function } } diff --git a/src/test/compile-fail/issue-28344.rs b/src/test/compile-fail/issue-28344.rs index 751a42826d2..d28c3146404 100644 --- a/src/test/compile-fail/issue-28344.rs +++ b/src/test/compile-fail/issue-28344.rs @@ -13,9 +13,9 @@ use std::ops::BitXor; fn main() { let x: u8 = BitXor::bitor(0 as u8, 0 as u8); //~^ ERROR must be specified - //~| no associated item named + //~| no function or associated item named let g = BitXor::bitor; //~^ ERROR must be specified - //~| no associated item named -} \ No newline at end of file + //~| no function or associated item named +} diff --git a/src/test/compile-fail/issue-30123.rs b/src/test/compile-fail/issue-30123.rs index ae1320c821f..653097ad69f 100644 --- a/src/test/compile-fail/issue-30123.rs +++ b/src/test/compile-fail/issue-30123.rs @@ -15,5 +15,5 @@ use issue_30123_aux::*; fn main() { let ug = Graph::::new_undirected(); - //~^ ERROR no associated item named `new_undirected` found for type + //~^ ERROR no function or associated item named `new_undirected` found for type } diff --git a/src/test/compile-fail/issue-39559.rs b/src/test/compile-fail/issue-39559.rs index 871ecf269ce..8bc1cc7bd1a 100644 --- a/src/test/compile-fail/issue-39559.rs +++ b/src/test/compile-fail/issue-39559.rs @@ -22,7 +22,7 @@ impl Dim for Dim3 { pub struct Vector { entries: [T; D::dim()] - //~^ ERROR no associated item named `dim` found for type `D` in the current scope + //~^ ERROR no function or associated item named `dim` found for type `D` in the current scope } fn main() {} diff --git a/src/test/compile-fail/issue-3973.rs b/src/test/compile-fail/issue-3973.rs index 92456760b05..67a934fccce 100644 --- a/src/test/compile-fail/issue-3973.rs +++ b/src/test/compile-fail/issue-3973.rs @@ -30,6 +30,6 @@ impl ToString_ for Point { fn main() { let p = Point::new(0.0, 0.0); - //~^ ERROR no associated item named `new` found for type `Point` in the current scope + //~^ ERROR no function or associated item named `new` found for type `Point` println!("{}", p.to_string()); } diff --git a/src/test/compile-fail/issue-7950.rs b/src/test/compile-fail/issue-7950.rs index 003329a2d7d..dd3a48cb155 100644 --- a/src/test/compile-fail/issue-7950.rs +++ b/src/test/compile-fail/issue-7950.rs @@ -13,5 +13,6 @@ struct Foo; fn main() { - Foo::bar(); //~ ERROR no associated item named `bar` found for type `Foo` in the current scope + Foo::bar(); + //~^ ERROR no function or associated item named `bar` found for type `Foo` } diff --git a/src/test/compile-fail/lexical-scopes.rs b/src/test/compile-fail/lexical-scopes.rs index 1ab59e790d7..39da0d47a95 100644 --- a/src/test/compile-fail/lexical-scopes.rs +++ b/src/test/compile-fail/lexical-scopes.rs @@ -17,7 +17,7 @@ mod Foo { pub fn f() {} } fn g() { - Foo::f(); //~ ERROR no associated item named `f` + Foo::f(); //~ ERROR no function or associated item named `f` } fn main() {} diff --git a/src/test/compile-fail/trait-item-privacy.rs b/src/test/compile-fail/trait-item-privacy.rs index 721d7583230..e915ca05f67 100644 --- a/src/test/compile-fail/trait-item-privacy.rs +++ b/src/test/compile-fail/trait-item-privacy.rs @@ -86,8 +86,10 @@ fn check_method() { // Methods, UFCS // a, b, c are resolved as trait items, their traits need to be in scope - S::a(&S); //~ ERROR no associated item named `a` found for type `S` in the current scope - S::b(&S); //~ ERROR no associated item named `b` found for type `S` in the current scope + S::a(&S); + //~^ ERROR no function or associated item named `a` found for type `S` + S::b(&S); + //~^ ERROR no function or associated item named `b` found for type `S` S::c(&S); // OK // a, b, c are resolved as inherent items, their traits don't need to be in scope C::a(&S); //~ ERROR method `a` is private diff --git a/src/test/compile-fail/unspecified-self-in-trait-ref.rs b/src/test/compile-fail/unspecified-self-in-trait-ref.rs index 84bcca3fc7b..cf8f3e91602 100644 --- a/src/test/compile-fail/unspecified-self-in-trait-ref.rs +++ b/src/test/compile-fail/unspecified-self-in-trait-ref.rs @@ -18,13 +18,13 @@ pub trait Bar { fn main() { let a = Foo::lol(); - //~^ ERROR no associated item named + //~^ ERROR no function or associated item named let b = Foo::<_>::lol(); - //~^ ERROR no associated item named + //~^ ERROR no function or associated item named let c = Bar::lol(); - //~^ ERROR no associated item named + //~^ ERROR no function or associated item named let d = Bar::::lol(); - //~^ ERROR no associated item named + //~^ ERROR no function or associated item named let e = Bar::::lol(); //~^ ERROR must be explicitly specified }