about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGavin Baker <gavinb@antonym.org>2015-09-28 22:33:29 +1000
committerGavin Baker <gavinb@antonym.org>2015-09-28 22:33:29 +1000
commitf5b6a32230d0fd5fd47b983929dd11e08d059f10 (patch)
treef9b3679449652da7d7b6f7b1fe491c7b9b68ac70
parent219eca11b044de3644b3e9101124513c1a842b09 (diff)
downloadrust-f5b6a32230d0fd5fd47b983929dd11e08d059f10.tar.gz
rust-f5b6a32230d0fd5fd47b983929dd11e08d059f10.zip
Test case for Issue 11047
Tests invoking a static method using a type alias
-rw-r--r--src/test/run-pass/issue-11047.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-11047.rs b/src/test/run-pass/issue-11047.rs
new file mode 100644
index 00000000000..1d97d579a61
--- /dev/null
+++ b/src/test/run-pass/issue-11047.rs
@@ -0,0 +1,35 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that static methods can be invoked on `type` aliases
+
+#![allow(unused_variables)]
+
+pub mod foo {
+    pub mod bar {
+        pub mod baz {
+            pub struct Qux;
+
+            impl Qux {
+                pub fn new() {}
+            }
+        }
+    }
+}
+
+fn main() {
+
+    type Ham = foo::bar::baz::Qux;
+    let foo = foo::bar::baz::Qux::new();  // invoke directly
+    let bar = Ham::new();                 // invoke via type alias
+
+    type StringVec = Vec<String>;
+    let sv = StringVec::new();
+}