diff options
| author | 0yoyoyo <60439919+0yoyoyo@users.noreply.github.com> | 2021-01-29 19:23:04 +0900 |
|---|---|---|
| committer | 0yoyoyo <60439919+0yoyoyo@users.noreply.github.com> | 2021-01-30 18:26:29 +0900 |
| commit | 81ed4cfd0138e68d370873281f53f4e63e5a223f (patch) | |
| tree | c3eb2a066e8af415e18808936b08998b2debde5d | |
| parent | 0e190206e2ff0c13d64701d9b4145bf89a2d0cab (diff) | |
| download | rust-81ed4cfd0138e68d370873281f53f4e63e5a223f.tar.gz rust-81ed4cfd0138e68d370873281f53f4e63e5a223f.zip | |
Add a regression test
| -rw-r--r-- | src/test/ui/typeck/typeck_type_placeholder_item_help.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/typeck/typeck_type_placeholder_item_help.stderr | 19 |
2 files changed, 22 insertions, 10 deletions
diff --git a/src/test/ui/typeck/typeck_type_placeholder_item_help.rs b/src/test/ui/typeck/typeck_type_placeholder_item_help.rs index 905fc35350e..0c890f88c60 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item_help.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_item_help.rs @@ -10,15 +10,18 @@ const TEST2: _ = 42u32; const TEST3: _ = Some(42); //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -trait Test4 { - const TEST4: _ = 42; +const TEST4: fn() -> _ = 42; +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures + +trait Test5 { + const TEST5: _ = 42; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures } -struct Test5; +struct Test6; -impl Test5 { - const TEST5: _ = 13; +impl Test6 { + const TEST6: _ = 13; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures } 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 88133814d29..0121e186316 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr @@ -26,23 +26,32 @@ LL | const TEST3: _ = Some(42); | help: replace `_` with the correct type: `Option<i32>` error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item_help.rs:14:18 + --> $DIR/typeck_type_placeholder_item_help.rs:13:22 | -LL | const TEST4: _ = 42; +LL | const TEST4: fn() -> _ = 42; + | ^ + | | + | not allowed in type signatures + | help: use type parameters instead: `T` + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item_help.rs:17:18 + | +LL | const TEST5: _ = 42; | ^ | | | not allowed in type signatures | 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_help.rs:21:18 + --> $DIR/typeck_type_placeholder_item_help.rs:24:18 | -LL | const TEST5: _ = 13; +LL | const TEST6: _ = 13; | ^ | | | not allowed in type signatures | help: replace `_` with the correct type: `i32` -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0121`. |
