Skip to content

Commit eb753e8

Browse files
committed
Add a regression test for rust-lang#75883
1 parent 855c2d1 commit eb753e8

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-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`.

0 commit comments

Comments
 (0)