diff --git a/src/test/compile-fail/export-no-tag-variants.rs b/src/test/compile-fail/export-no-tag-variants.rs new file mode 100644 index 00000000000..697998029d3 --- /dev/null +++ b/src/test/compile-fail/export-no-tag-variants.rs @@ -0,0 +1,17 @@ +// xfail-boot +// error-pattern: unresolved name + +// Tag variants are not exported with their tags. This allows for a +// simple sort of ADT. + +mod foo { + export t; + + tag t { + t1; + } +} + +fn main() { + auto x = foo.t1; +} diff --git a/src/test/run-pass/export-abstract-tag.rs b/src/test/run-pass/export-abstract-tag.rs new file mode 100644 index 00000000000..b192b698ea8 --- /dev/null +++ b/src/test/run-pass/export-abstract-tag.rs @@ -0,0 +1,19 @@ +// We can export tags without exporting the variants to create a simple +// sort of ADT. + +mod foo { + export t; + export f; + + tag t { + t1; + } + + fn f() -> t { + ret t1; + } +} + +fn main() { + let foo.t v = foo.f(); +} diff --git a/src/test/run-pass/export-tag-variant.rs b/src/test/run-pass/export-tag-variant.rs new file mode 100644 index 00000000000..e99bc0410bb --- /dev/null +++ b/src/test/run-pass/export-tag-variant.rs @@ -0,0 +1,12 @@ +// Export the tag variants, without the tag + +mod foo { + export t1; + tag t { + t1; + } +} + +fn main() { + auto v = foo.t1; +}