aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-05-02 19:42:00 -0400
committerBrian Anderson <[email protected]>2011-05-02 19:42:00 -0400
commit764de078e7c4baaf0a1f426e7ac4d834c2ea8797 (patch)
tree24d52c1d9b8be66f1af3806eb932f3172e156a35 /src/test
parentrustc: Allocate tydescs on the stack when it's safe to do so. 60% compile spe... (diff)
downloadrust-764de078e7c4baaf0a1f426e7ac4d834c2ea8797.tar.xz
rust-764de078e7c4baaf0a1f426e7ac4d834c2ea8797.zip
Add a regression test that exports can expose unexported items
While those unexported items can't be used by name outside the module in which they are defined, they can be used as a sort of ADT.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/export-unexported-dep.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/run-pass/export-unexported-dep.rs b/src/test/run-pass/export-unexported-dep.rs
new file mode 100644
index 00000000..94ef5241
--- /dev/null
+++ b/src/test/run-pass/export-unexported-dep.rs
@@ -0,0 +1,24 @@
+// This tests that exports can have visible dependencies on things
+// that are not exported, allowing for a sort of poor-man's ADT
+
+mod foo {
+ export f;
+ export g;
+
+ // not exported
+ tag t {
+ t1;
+ }
+
+ fn f() -> t {
+ ret t1;
+ }
+
+ fn g(t v) {
+ assert v == t1;
+ }
+}
+
+fn main() {
+ foo.g(foo.f());
+} \ No newline at end of file