about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authormatthewjasper <mjjasper1@gmail.com>2017-10-15 11:58:32 +0100
committermatthewjasper <mjjasper1@gmail.com>2017-10-15 11:58:32 +0100
commitb522ee15ce8b4cd419a4f26177694fe3200029be (patch)
tree2c78b5938b749584be1ea519e31ebdcb72b140e2 /src/test
parentcbf5d39cca2e837c7a9880e69e110e714d19c6aa (diff)
downloadrust-b522ee15ce8b4cd419a4f26177694fe3200029be.tar.gz
rust-b522ee15ce8b4cd419a4f26177694fe3200029be.zip
Check namespaces when resolving associated items in typeck
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/issue-35600.rs24
-rw-r--r--src/test/run-pass/issue-44247.rs27
2 files changed, 51 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-35600.rs b/src/test/run-pass/issue-35600.rs
new file mode 100644
index 00000000000..88358eff08d
--- /dev/null
+++ b/src/test/run-pass/issue-35600.rs
@@ -0,0 +1,24 @@
+// Copyright 2017 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.
+
+trait Foo {
+    type bar;
+    fn bar();
+}
+
+impl Foo for () {
+    type bar = ();
+    fn bar() {}
+}
+
+fn main() {
+    let x: <() as Foo>::bar = ();
+    <()>::bar();
+}
diff --git a/src/test/run-pass/issue-44247.rs b/src/test/run-pass/issue-44247.rs
new file mode 100644
index 00000000000..27b0aeaac55
--- /dev/null
+++ b/src/test/run-pass/issue-44247.rs
@@ -0,0 +1,27 @@
+// Copyright 2017 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.
+
+trait T {
+    type X;
+    const X: Self::X;
+}
+fn foo<X: T>() {
+    let _: X::X = X::X;
+}
+
+trait S {
+    const X: Self::X;
+    type X;
+}
+fn bar<X: S>() {
+    let _: X::X = X::X;
+}
+
+fn main() {}