about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-31 09:50:49 +0000
committerbors <bors@rust-lang.org>2019-12-31 09:50:49 +0000
commit71bb0ff33e3759ee71ea19c230492c11e5e32b87 (patch)
tree61f623415ecedc01861b1d9599ad8dad350c0efe /src/test
parentbf2d145c62888c853db0bcfd8f5b3a6919f15502 (diff)
parent261b606ddc12cfb027659562f3e22fbf77bfe448 (diff)
downloadrust-71bb0ff33e3759ee71ea19c230492c11e5e32b87.tar.gz
rust-71bb0ff33e3759ee71ea19c230492c11e5e32b87.zip
Auto merge of #67597 - estebank:placeholder-type, r=oli-obk
Suggest type param when encountering `_` in item signatures

Fix #27435.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/error-codes/E0121.stderr2
-rw-r--r--src/test/ui/self/self-infer.stderr10
-rw-r--r--src/test/ui/typeck/typeck_type_placeholder_item.rs40
-rw-r--r--src/test/ui/typeck/typeck_type_placeholder_item.stderr338
-rw-r--r--src/test/ui/typeck/typeck_type_placeholder_item_help.stderr2
5 files changed, 300 insertions, 92 deletions
diff --git a/src/test/ui/error-codes/E0121.stderr b/src/test/ui/error-codes/E0121.stderr
index beb8941320b..5a5c6b40c5a 100644
--- a/src/test/ui/error-codes/E0121.stderr
+++ b/src/test/ui/error-codes/E0121.stderr
@@ -5,7 +5,7 @@ LL | fn foo() -> _ { 5 }
    |             ^
    |             |
    |             not allowed in type signatures
-   |             help: replace `_` with the correct return type: `i32`
+   |             help: replace with the correct return type: `i32`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
   --> $DIR/E0121.rs:3:13
diff --git a/src/test/ui/self/self-infer.stderr b/src/test/ui/self/self-infer.stderr
index f91cfe5eb62..1475b212b56 100644
--- a/src/test/ui/self/self-infer.stderr
+++ b/src/test/ui/self/self-infer.stderr
@@ -3,12 +3,22 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
    |
 LL |     fn f(self: _) {}
    |                ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn f<T>(self: T) {}
+   |         ^^^       ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
   --> $DIR/self-infer.rs:5:17
    |
 LL |     fn g(self: &_) {}
    |                 ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn g<T>(self: &T) {}
+   |         ^^^        ^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.rs b/src/test/ui/typeck/typeck_type_placeholder_item.rs
index 46a5b8580dc..5b0ca2f347e 100644
--- a/src/test/ui/typeck/typeck_type_placeholder_item.rs
+++ b/src/test/ui/typeck/typeck_type_placeholder_item.rs
@@ -6,7 +6,6 @@ fn test() -> _ { 5 }
 
 fn test2() -> (_, _) { (5, 5) }
 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
-//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
 static TEST3: _ = "test";
 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
@@ -16,16 +15,22 @@ static TEST4: _ = 145;
 
 static TEST5: (_, _) = (1, 2);
 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
-//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
 fn test6(_: _) { }
 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
+fn test6_b<T>(_: _, _: T) { }
+//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+
+fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
+//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+
 fn test7(x: _) { let _x: usize = x; }
 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
 fn test8(_f: fn() -> _) { }
 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+//~| ERROR the type placeholder `_` is not allowed within types on item signatures
 
 struct Test9;
 
@@ -49,8 +54,6 @@ struct Test10 {
     a: _,
     //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
     b: (_, _),
-    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
-    //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
 }
 
 pub fn main() {
@@ -59,7 +62,6 @@ pub fn main() {
 
     fn fn_test2() -> (_, _) { (5, 5) }
     //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
-    //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
     static FN_TEST3: _ = "test";
     //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
@@ -69,7 +71,6 @@ pub fn main() {
 
     static FN_TEST5: (_, _) = (1, 2);
     //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
-    //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
     fn fn_test6(_: _) { }
     //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
@@ -79,6 +80,7 @@ pub fn main() {
 
     fn fn_test8(_f: fn() -> _) { }
     //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+    //~| ERROR the type placeholder `_` is not allowed within types on item signatures
 
     struct FnTest9;
 
@@ -102,8 +104,30 @@ pub fn main() {
         a: _,
         //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
         b: (_, _),
-        //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
-        //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
     }
 
+    fn fn_test11(_: _) -> (_, _) { panic!() }
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+    //~| ERROR type annotations needed
+
+    fn fn_test12(x: i32) -> (_, _) { (x, x) }
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+
+    fn fn_test13(x: _) -> (i32, _) { (x, x) }
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+}
+
+trait T {
+    fn method_test1(&self, x: _);
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+    fn method_test2(&self, x: _) -> _;
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+    fn method_test3(&self) -> _;
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+    fn assoc_fn_test1(x: _);
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+    fn assoc_fn_test2(x: _) -> _;
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+    fn assoc_fn_test3() -> _;
+    //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
 }
diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.stderr
index 2b4d9966c3d..9fe7af4c822 100644
--- a/src/test/ui/typeck/typeck_type_placeholder_item.stderr
+++ b/src/test/ui/typeck/typeck_type_placeholder_item.stderr
@@ -5,22 +5,20 @@ LL | fn test() -> _ { 5 }
    |              ^
    |              |
    |              not allowed in type signatures
-   |              help: replace `_` with the correct return type: `i32`
+   |              help: replace with the correct return type: `i32`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
   --> $DIR/typeck_type_placeholder_item.rs:7:16
    |
 LL | fn test2() -> (_, _) { (5, 5) }
-   |                ^ not allowed in type signatures
+   |               -^--^-
+   |               ||  |
+   |               ||  not allowed in type signatures
+   |               |not allowed in type signatures
+   |               help: replace with the correct return type: `(i32, i32)`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:7:19
-   |
-LL | fn test2() -> (_, _) { (5, 5) }
-   |                   ^ not allowed in type signatures
-
-error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:11:15
+  --> $DIR/typeck_type_placeholder_item.rs:10:15
    |
 LL | static TEST3: _ = "test";
    |               ^
@@ -29,7 +27,7 @@ LL | static TEST3: _ = "test";
    |               help: replace `_` with the correct type: `&'static str`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:14:15
+  --> $DIR/typeck_type_placeholder_item.rs:13:15
    |
 LL | static TEST4: _ = 145;
    |               ^
@@ -38,94 +36,112 @@ LL | static TEST4: _ = 145;
    |               help: replace `_` with the correct type: `i32`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:17:16
+  --> $DIR/typeck_type_placeholder_item.rs:16:15
    |
 LL | static TEST5: (_, _) = (1, 2);
-   |                ^ not allowed in type signatures
+   |               ^^^^^^ not allowed in type signatures
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:17:19
+  --> $DIR/typeck_type_placeholder_item.rs:19:13
    |
-LL | static TEST5: (_, _) = (1, 2);
-   |                   ^ not allowed in type signatures
+LL | fn test6(_: _) { }
+   |             ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL | fn test6<T>(_: T) { }
+   |         ^^^    ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:21:13
+  --> $DIR/typeck_type_placeholder_item.rs:22:18
    |
-LL | fn test6(_: _) { }
-   |             ^ not allowed in type signatures
+LL | fn test6_b<T>(_: _, _: T) { }
+   |                  ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL | fn test6_b<T, K>(_: K, _: T) { }
+   |             ^^^     ^
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:25:30
+   |
+LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
+   |                              ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL | fn test6_c<T, K, L, A, B, C>(_: C, _: (T, K, L, A, B)) { }
+   |                         ^^^     ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:24:13
+  --> $DIR/typeck_type_placeholder_item.rs:28:13
    |
 LL | fn test7(x: _) { let _x: usize = x; }
    |             ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL | fn test7<T>(x: T) { let _x: usize = x; }
+   |         ^^^    ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:27:22
+  --> $DIR/typeck_type_placeholder_item.rs:31:22
    |
 LL | fn test8(_f: fn() -> _) { }
    |                      ^ not allowed in type signatures
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:49:8
+  --> $DIR/typeck_type_placeholder_item.rs:31:22
    |
-LL |     a: _,
-   |        ^ not allowed in type signatures
-
-error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:51:9
+LL | fn test8(_f: fn() -> _) { }
+   |                      ^ not allowed in type signatures
    |
-LL |     b: (_, _),
-   |         ^ not allowed in type signatures
+help: use type parameters instead
+   |
+LL | fn test8<T>(_f: fn() -> T) { }
+   |         ^^^             ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:51:12
+  --> $DIR/typeck_type_placeholder_item.rs:54:8
    |
+LL |     a: _,
+   |        ^ not allowed in type signatures
+LL |
 LL |     b: (_, _),
-   |            ^ not allowed in type signatures
-
-error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:102:12
+   |         ^  ^ not allowed in type signatures
+   |         |
+   |         not allowed in type signatures
    |
-LL |         a: _,
-   |            ^ not allowed in type signatures
-
-error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:104:13
+help: use type parameters instead
    |
-LL |         b: (_, _),
-   |             ^ not allowed in type signatures
-
-error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:104:16
+LL | struct Test10<T> {
+LL |     a: T,
+LL |
+LL |     b: (T, T),
    |
-LL |         b: (_, _),
-   |                ^ not allowed in type signatures
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:57:21
+  --> $DIR/typeck_type_placeholder_item.rs:60:21
    |
 LL |     fn fn_test() -> _ { 5 }
    |                     ^
    |                     |
    |                     not allowed in type signatures
-   |                     help: replace `_` with the correct return type: `i32`
-
-error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:60:23
-   |
-LL |     fn fn_test2() -> (_, _) { (5, 5) }
-   |                       ^ not allowed in type signatures
+   |                     help: replace with the correct return type: `i32`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:60:26
+  --> $DIR/typeck_type_placeholder_item.rs:63:23
    |
 LL |     fn fn_test2() -> (_, _) { (5, 5) }
-   |                          ^ not allowed in type signatures
+   |                      -^--^-
+   |                      ||  |
+   |                      ||  not allowed in type signatures
+   |                      |not allowed in type signatures
+   |                      help: replace with the correct return type: `(i32, i32)`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:64:22
+  --> $DIR/typeck_type_placeholder_item.rs:66:22
    |
 LL |     static FN_TEST3: _ = "test";
    |                      ^
@@ -134,7 +150,7 @@ LL |     static FN_TEST3: _ = "test";
    |                      help: replace `_` with the correct type: `&'static str`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:67:22
+  --> $DIR/typeck_type_placeholder_item.rs:69:22
    |
 LL |     static FN_TEST4: _ = 145;
    |                      ^
@@ -143,95 +159,253 @@ LL |     static FN_TEST4: _ = 145;
    |                      help: replace `_` with the correct type: `i32`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:70:23
+  --> $DIR/typeck_type_placeholder_item.rs:72:22
    |
 LL |     static FN_TEST5: (_, _) = (1, 2);
-   |                       ^ not allowed in type signatures
+   |                      ^^^^^^ not allowed in type signatures
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:70:26
-   |
-LL |     static FN_TEST5: (_, _) = (1, 2);
-   |                          ^ not allowed in type signatures
-
-error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:74:20
+  --> $DIR/typeck_type_placeholder_item.rs:75:20
    |
 LL |     fn fn_test6(_: _) { }
    |                    ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn fn_test6<T>(_: T) { }
+   |                ^^^    ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:77:20
+  --> $DIR/typeck_type_placeholder_item.rs:78:20
    |
 LL |     fn fn_test7(x: _) { let _x: usize = x; }
    |                    ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn fn_test7<T>(x: T) { let _x: usize = x; }
+   |                ^^^    ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:80:29
+  --> $DIR/typeck_type_placeholder_item.rs:81:29
    |
 LL |     fn fn_test8(_f: fn() -> _) { }
    |                             ^ not allowed in type signatures
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:33:24
+  --> $DIR/typeck_type_placeholder_item.rs:81:29
+   |
+LL |     fn fn_test8(_f: fn() -> _) { }
+   |                             ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn fn_test8<T>(_f: fn() -> T) { }
+   |                ^^^             ^
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:104:12
+   |
+LL |         a: _,
+   |            ^ not allowed in type signatures
+LL |
+LL |         b: (_, _),
+   |             ^  ^ not allowed in type signatures
+   |             |
+   |             not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     struct FnTest10<T> {
+LL |         a: T,
+LL |
+LL |         b: (T, T),
+   |
+
+error[E0282]: type annotations needed
+  --> $DIR/typeck_type_placeholder_item.rs:109:27
+   |
+LL |     fn fn_test11(_: _) -> (_, _) { panic!() }
+   |                           ^^^^^^ cannot infer type
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:109:28
+   |
+LL |     fn fn_test11(_: _) -> (_, _) { panic!() }
+   |                            ^  ^ not allowed in type signatures
+   |                            |
+   |                            not allowed in type signatures
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:113:30
+   |
+LL |     fn fn_test12(x: i32) -> (_, _) { (x, x) }
+   |                             -^--^-
+   |                             ||  |
+   |                             ||  not allowed in type signatures
+   |                             |not allowed in type signatures
+   |                             help: replace with the correct return type: `(i32, i32)`
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:116:33
+   |
+LL |     fn fn_test13(x: _) -> (i32, _) { (x, x) }
+   |                           ------^-
+   |                           |     |
+   |                           |     not allowed in type signatures
+   |                           help: replace with the correct return type: `(i32, i32)`
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:121:31
+   |
+LL |     fn method_test1(&self, x: _);
+   |                               ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn method_test1<T>(&self, x: T);
+   |                    ^^^           ^
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:123:31
+   |
+LL |     fn method_test2(&self, x: _) -> _;
+   |                               ^     ^ not allowed in type signatures
+   |                               |
+   |                               not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn method_test2<T>(&self, x: T) -> T;
+   |                    ^^^           ^     ^
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:125:31
+   |
+LL |     fn method_test3(&self) -> _;
+   |                               ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn method_test3<T>(&self) -> T;
+   |                    ^^^           ^
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:127:26
+   |
+LL |     fn assoc_fn_test1(x: _);
+   |                          ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn assoc_fn_test1<T>(x: T);
+   |                      ^^^    ^
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:129:26
+   |
+LL |     fn assoc_fn_test2(x: _) -> _;
+   |                          ^     ^ not allowed in type signatures
+   |                          |
+   |                          not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn assoc_fn_test2<T>(x: T) -> T;
+   |                      ^^^    ^     ^
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:131:28
+   |
+LL |     fn assoc_fn_test3() -> _;
+   |                            ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn assoc_fn_test3<T>() -> T;
+   |                      ^^^      ^
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/typeck_type_placeholder_item.rs:38:24
    |
 LL |     fn test9(&self) -> _ { () }
    |                        ^
    |                        |
    |                        not allowed in type signatures
-   |                        help: replace `_` with the correct return type: `()`
+   |                        help: replace with the correct return type: `()`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:36:27
+  --> $DIR/typeck_type_placeholder_item.rs:41:27
    |
 LL |     fn test10(&self, _x : _) { }
    |                           ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn test10<T>(&self, _x : T) { }
+   |              ^^^             ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:41:24
+  --> $DIR/typeck_type_placeholder_item.rs:46:24
    |
 LL |     fn clone(&self) -> _ { Test9 }
    |                        ^
    |                        |
    |                        not allowed in type signatures
-   |                        help: replace `_` with the correct return type: `Test9`
+   |                        help: replace with the correct return type: `Test9`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:44:37
+  --> $DIR/typeck_type_placeholder_item.rs:49:37
    |
 LL |     fn clone_from(&mut self, other: _) { *self = Test9; }
    |                                     ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |     fn clone_from<T>(&mut self, other: T) { *self = Test9; }
+   |                  ^^^                   ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:86:31
+  --> $DIR/typeck_type_placeholder_item.rs:88:31
    |
 LL |         fn fn_test9(&self) -> _ { () }
    |                               ^
    |                               |
    |                               not allowed in type signatures
-   |                               help: replace `_` with the correct return type: `()`
+   |                               help: replace with the correct return type: `()`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:89:34
+  --> $DIR/typeck_type_placeholder_item.rs:91:34
    |
 LL |         fn fn_test10(&self, _x : _) { }
    |                                  ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |         fn fn_test10<T>(&self, _x : T) { }
+   |                     ^^^             ^
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:94:28
+  --> $DIR/typeck_type_placeholder_item.rs:96:28
    |
 LL |         fn clone(&self) -> _ { FnTest9 }
    |                            ^
    |                            |
    |                            not allowed in type signatures
-   |                            help: replace `_` with the correct return type: `main::FnTest9`
+   |                            help: replace with the correct return type: `main::FnTest9`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
-  --> $DIR/typeck_type_placeholder_item.rs:97:41
+  --> $DIR/typeck_type_placeholder_item.rs:99:41
    |
 LL |         fn clone_from(&mut self, other: _) { *self = FnTest9; }
    |                                         ^ not allowed in type signatures
+   |
+help: use type parameters instead
+   |
+LL |         fn clone_from<T>(&mut self, other: T) { *self = FnTest9; }
+   |                      ^^^                   ^
 
-error: aborting due to 34 previous errors
+error: aborting due to 40 previous errors
 
-For more information about this error, try `rustc --explain E0121`.
+Some errors have detailed explanations: E0121, E0282.
+For more information about an error, try `rustc --explain E0121`.
diff --git a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr
index c5b9566290c..e3bc059d1f1 100644
--- a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr
+++ b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr
@@ -5,7 +5,7 @@ LL | fn test1() -> _ { Some(42) }
    |               ^
    |               |
    |               not allowed in type signatures
-   |               help: replace `_` with the correct return type: `std::option::Option<i32>`
+   |               help: replace with the correct return type: `std::option::Option<i32>`
 
 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
   --> $DIR/typeck_type_placeholder_item_help.rs:7:14