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
This commit is contained in:
bors 2016-04-04 21:50:05 -07:00
commit 7fd331e166
4 changed files with 207 additions and 207 deletions

View file

@ -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