diff options
| author | Alexander Regueiro <alexreg@me.com> | 2018-12-11 00:05:35 +0000 |
|---|---|---|
| committer | Pietro Albini <pietro@pietroalbini.org> | 2018-12-31 18:41:10 +0100 |
| commit | e3a4e97822db1666d9d8affedfa3b97c8ce446e8 (patch) | |
| tree | 7834437fb4b6af15d0605074934dce118e4d13ff /src/test/ui | |
| parent | 64abe6954adbefbf379fc2dc21cff7d448b8e8d8 (diff) | |
| download | rust-e3a4e97822db1666d9d8affedfa3b97c8ce446e8.tar.gz rust-e3a4e97822db1666d9d8affedfa3b97c8ce446e8.zip | |
Fixed issue #56199.
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/issues/issue-56199.rs | 23 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-56199.stderr | 30 |
2 files changed, 53 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-56199.rs b/src/test/ui/issues/issue-56199.rs new file mode 100644 index 00000000000..bbd51823cf1 --- /dev/null +++ b/src/test/ui/issues/issue-56199.rs @@ -0,0 +1,23 @@ + +enum Foo {} +struct Bar {} + +impl Foo { + fn foo() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple structs + } +} + +impl Bar { + fn bar() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple structs + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-56199.stderr b/src/test/ui/issues/issue-56199.stderr new file mode 100644 index 00000000000..feb88e926b2 --- /dev/null +++ b/src/test/ui/issues/issue-56199.stderr @@ -0,0 +1,30 @@ +error: the `Self` constructor can only be used with tuple structs + --> $DIR/issue-56199.rs:7:17 + | +LL | let _ = Self; + | ^^^^ + | + = note: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple structs + --> $DIR/issue-56199.rs:9:17 + | +LL | let _ = Self(); + | ^^^^ + | + = note: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple structs + --> $DIR/issue-56199.rs:16:17 + | +LL | let _ = Self; + | ^^^^ did you mean `Self { /* fields */ }`? + +error: the `Self` constructor can only be used with tuple structs + --> $DIR/issue-56199.rs:18:17 + | +LL | let _ = Self(); + | ^^^^ did you mean `Self { /* fields */ }`? + +error: aborting due to 4 previous errors + |
