Skip to content

Improve name resolution failure detection #32119

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jseyfried opened this issue Mar 8, 2016 · 1 comment · Fixed by #32328
Closed

Improve name resolution failure detection #32119

jseyfried opened this issue Mar 8, 2016 · 1 comment · Fixed by #32328
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically

Comments

@jseyfried
Copy link
Contributor

Right now, this compiles ...

pub type T = ();

mod foo {
    pub use super::T;
}

mod bar {
    pub use super::*; // ... but replacing `*` with `T` causes unresolved imports.
}

pub use foo::*;
pub use bar::*;

Neither case compiled before #31726, when even this would not compile:

pub type T = ();
mod foo {
    pub use super::T;
}

pub use foo::*;
@jseyfried
Copy link
Contributor Author

This a violation of the first coherence condition from this comment.

@steveklabnik steveklabnik reopened this Mar 11, 2016
jseyfried added a commit to jseyfried/rust that referenced this issue Mar 27, 2016
@steveklabnik steveklabnik added the A-resolve Area: Name/path resolution done by `rustc_resolve` specifically label Mar 28, 2016
bors added a commit that referenced this issue Apr 5, 2016
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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants