about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-07-18 11:51:20 +0000
committerbors <bors@rust-lang.org>2014-07-18 11:51:20 +0000
commit441866417764cb0ad32bce50ebda83deec525997 (patch)
treef1fd7e8d1e688841135ecf717947fdf2f6f52687 /src/test
parentd9f1d6b7f69f293ba5f060fd9e179de228d9497b (diff)
parent99bd9265d98b74283ee2fa7fa45782e83e5bb79c (diff)
downloadrust-441866417764cb0ad32bce50ebda83deec525997.tar.gz
rust-441866417764cb0ad32bce50ebda83deec525997.zip
auto merge of #15733 : sanxiyn/rust/use-from-type, r=alexcrichton
Importing from types was disallowed in #6462. Flag was set for paths whether it is a module or a type. Type flag was set when impl was seen. The problem is, for cross-crate situations, when reexport is involved, it is possible that impl is seen too late because metadata is loaded lazily.

Fix #15664.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/use_from_trait_xc.rs10
-rw-r--r--src/test/compile-fail/use-from-trait-xc.rs3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/test/auxiliary/use_from_trait_xc.rs b/src/test/auxiliary/use_from_trait_xc.rs
index 19e53fcc61a..8c547c28002 100644
--- a/src/test/auxiliary/use_from_trait_xc.rs
+++ b/src/test/auxiliary/use_from_trait_xc.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+pub use self::sub::Bar;
+
 pub trait Trait {
     fn foo();
 }
@@ -17,3 +19,11 @@ struct Foo;
 impl Foo {
     pub fn new() {}
 }
+
+mod sub {
+    pub struct Bar;
+
+    impl Bar {
+        pub fn new() {}
+    }
+}
diff --git a/src/test/compile-fail/use-from-trait-xc.rs b/src/test/compile-fail/use-from-trait-xc.rs
index 8e197b901e6..cea85955d37 100644
--- a/src/test/compile-fail/use-from-trait-xc.rs
+++ b/src/test/compile-fail/use-from-trait-xc.rs
@@ -18,4 +18,7 @@ use use_from_trait_xc::Trait::foo;
 use use_from_trait_xc::Foo::new;
 //~^ ERROR unresolved import `use_from_trait_xc::Foo::new`. Cannot import from a trait or type imple
 
+use use_from_trait_xc::Bar::new;
+//~^ ERROR unresolved import `use_from_trait_xc::Bar::new`. Cannot import from a trait or type
+
 fn main() {}