Skip to content

Commit bf5c5e3

Browse files
author
Alexander Regueiro
committed
Added test for issue #56835.
1 parent 700651c commit bf5c5e3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/test/ui/issues/issue-56835.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
pub struct Foo {}
3+
4+
impl Foo {
5+
fn bar(Self(foo): Self) {}
6+
//~^ ERROR the `Self` constructor can only be used with tuple structs
7+
//~^^ ERROR expected tuple struct/variant, found self constructor `Self` [E0164]
8+
}
9+
10+
fn main() {}

src/test/ui/issues/issue-56835.stderr

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: the `Self` constructor can only be used with tuple structs
2+
--> $DIR/issue-56835.rs:5:12
3+
|
4+
LL | fn bar(Self(foo): Self) {}
5+
| ^^^^^^^^^ did you mean `Self { /* fields */ }`?
6+
7+
error[E0164]: expected tuple struct/variant, found self constructor `Self`
8+
--> $DIR/issue-56835.rs:5:12
9+
|
10+
LL | fn bar(Self(foo): Self) {}
11+
| ^^^^^^^^^ not a tuple variant or struct
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0164`.

0 commit comments

Comments
 (0)