Skip to content

Commit 96c2316

Browse files
authored
Rollup merge of #84646 - JohnTitor:add-some-bad-placeholder-tests, r=Dylan-DPC
Add some regression tests related to #82494 Closes #75883, closes #80779 r? ````@estebank````
2 parents 4306806 + de92dfb commit 96c2316

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed

src/test/ui/typeck/issue-75883.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Regression test for #75883.
2+
3+
pub struct UI {}
4+
5+
impl UI {
6+
pub fn run() -> Result<_> {
7+
//~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied
8+
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
9+
let mut ui = UI {};
10+
ui.interact();
11+
12+
unimplemented!();
13+
}
14+
15+
pub fn interact(&mut self) -> Result<_> {
16+
//~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied
17+
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
18+
unimplemented!();
19+
}
20+
}
21+
22+
fn main() {}

src/test/ui/typeck/issue-75883.stderr

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
2+
--> $DIR/issue-75883.rs:6:21
3+
|
4+
LL | pub fn run() -> Result<_> {
5+
| ^^^^^^ - supplied 1 type argument
6+
| |
7+
| expected 2 type arguments
8+
|
9+
note: enum defined here, with 2 type parameters: `T`, `E`
10+
--> $SRC_DIR/core/src/result.rs:LL:COL
11+
|
12+
LL | pub enum Result<T, E> {
13+
| ^^^^^^ - -
14+
help: add missing type argument
15+
|
16+
LL | pub fn run() -> Result<_, E> {
17+
| ^^^
18+
19+
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
20+
--> $DIR/issue-75883.rs:15:35
21+
|
22+
LL | pub fn interact(&mut self) -> Result<_> {
23+
| ^^^^^^ - supplied 1 type argument
24+
| |
25+
| expected 2 type arguments
26+
|
27+
note: enum defined here, with 2 type parameters: `T`, `E`
28+
--> $SRC_DIR/core/src/result.rs:LL:COL
29+
|
30+
LL | pub enum Result<T, E> {
31+
| ^^^^^^ - -
32+
help: add missing type argument
33+
|
34+
LL | pub fn interact(&mut self) -> Result<_, E> {
35+
| ^^^
36+
37+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
38+
--> $DIR/issue-75883.rs:15:42
39+
|
40+
LL | pub fn interact(&mut self) -> Result<_> {
41+
| ^ not allowed in type signatures
42+
43+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
44+
--> $DIR/issue-75883.rs:6:28
45+
|
46+
LL | pub fn run() -> Result<_> {
47+
| ^ not allowed in type signatures
48+
49+
error: aborting due to 4 previous errors
50+
51+
Some errors have detailed explanations: E0107, E0121.
52+
For more information about an error, try `rustc --explain E0107`.

src/test/ui/typeck/issue-80779.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Regression test for #80779.
2+
3+
pub struct T<'a>(&'a str);
4+
5+
pub fn f<'a>(val: T<'a>) -> _ {
6+
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
7+
g(val)
8+
}
9+
10+
pub fn g(_: T<'static>) -> _ {}
11+
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
12+
13+
fn main() {}

src/test/ui/typeck/issue-80779.stderr

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
2+
--> $DIR/issue-80779.rs:10:28
3+
|
4+
LL | pub fn g(_: T<'static>) -> _ {}
5+
| ^
6+
| |
7+
| not allowed in type signatures
8+
| help: replace with the correct return type: `()`
9+
10+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
11+
--> $DIR/issue-80779.rs:5:29
12+
|
13+
LL | pub fn f<'a>(val: T<'a>) -> _ {
14+
| ^
15+
| |
16+
| not allowed in type signatures
17+
| help: replace with the correct return type: `()`
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0121`.

0 commit comments

Comments
 (0)