summaryrefslogtreecommitdiffstats
path: root/tests/ui/offset-of/offset-of-enum.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/offset-of/offset-of-enum.rs')
-rw-r--r--tests/ui/offset-of/offset-of-enum.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/ui/offset-of/offset-of-enum.rs b/tests/ui/offset-of/offset-of-enum.rs
index d73505821..a2d6aace4 100644
--- a/tests/ui/offset-of/offset-of-enum.rs
+++ b/tests/ui/offset-of/offset-of-enum.rs
@@ -1,4 +1,4 @@
-#![feature(offset_of)]
+#![feature(offset_of, offset_of_enum)]
use std::mem::offset_of;
@@ -9,5 +9,10 @@ enum Alpha {
fn main() {
offset_of!(Alpha::One, 0); //~ ERROR expected type, found variant `Alpha::One`
- offset_of!(Alpha, Two.0); //~ ERROR no field `Two` on type `Alpha`
+ offset_of!(Alpha, One); //~ ERROR `One` is an enum variant; expected field at end of `offset_of`
+ offset_of!(Alpha, Two.0);
+ offset_of!(Alpha, Two.1); //~ ERROR no field named `1` on enum variant `Alpha::Two`
+ offset_of!(Alpha, Two.foo); //~ ERROR no field named `foo` on enum variant `Alpha::Two`
+ offset_of!(Alpha, NonExistent); //~ ERROR no variant named `NonExistent` found for enum `Alpha`
+ offset_of!(Beta, One); //~ ERROR cannot find type `Beta` in this scope
}