about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-04 21:50:05 -0700
committerbors <bors@rust-lang.org>2016-04-04 21:50:05 -0700
commit7fd331e16642363c333804fe3322ae6bc0be8fbc (patch)
treeab72c2b72f95ed18e4cc801ce7e22cec04007e13 /src/test
parent600dc3552ffcdff014cc770e98a67b674496d10a (diff)
parent6f09deaa32ba8a4f26a46c28ffecbb3efc3d165e (diff)
downloadrust-7fd331e16642363c333804fe3322ae6bc0be8fbc.tar.gz
rust-7fd331e16642363c333804fe3322ae6bc0be8fbc.zip
Auto merge of #32328 - jseyfried:coherence, r=nikomatsakis
resolve: Improve import failure detection and lay groundwork for RFC 1422

This PR improves import failure detection and lays some groundwork for RFC 1422.
More specifically, it
 - Avoids recomputing the resolution of an import directive's module path.
 - Refactors code in `resolve_imports` that does not scale to the arbitrarily many levels of visibility that will be required by RFC 1422.
  - Replaces `ModuleS`'s fields `public_glob_count`, `private_glob_count`, and `resolved_globs` with a list of glob import directives `globs`.
  - Replaces `NameResolution`'s fields `pub_outstanding_references` and `outstanding_references` with a field `single_imports` of a newly defined type `SingleImports`.
 - Improves import failure detection by detecting cycles that include single imports (currently, only cycles of globs are detected). This fixes #32119.

r? @nikomatsakis
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-32119.rs (renamed from src/test/compile-fail/issue-32089.rs)17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/test/compile-fail/issue-32089.rs b/src/test/compile-fail/issue-32119.rs
index 5da7b9fff6e..4743b779ef6 100644
--- a/src/test/compile-fail/issue-32089.rs
+++ b/src/test/compile-fail/issue-32119.rs
@@ -9,15 +9,20 @@
 // except according to those terms.
 
 #![feature(rustc_attrs)]
-#![allow(unused_imports)]
 
-pub type Type = i32;
+pub type T = ();
+mod foo { pub use super::T; }
+mod bar { pub use super::T; }
 
-mod one { use super::Type; }
-pub use self::one::*;
+pub use foo::*;
+pub use bar::*;
 
-mod two { use super::Type; }
-pub use self::two::*;
+mod baz {
+    pub type T = ();
+    mod foo { pub use super::T as S; }
+    mod bar { pub use super::foo::S as T; }
+    pub use self::bar::*;
+}
 
 #[rustc_error]
 fn main() {} //~ ERROR compilation successful