Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Beta no longer compiles code which imports a re-export from the same sub-module from the root #53303

Closed
daboross opened this issue Aug 13, 2018 · 2 comments

Comments

@daboross
Copy link
Contributor

daboross commented Aug 13, 2018

Hi,

I'm not sure if this is a duplicate of another issue, but this is something I ran into in one of my projects. Here's a minimal reproduction:

pub mod objects {
    #[macro_use]
    mod macros {
        macro_rules! reference_wrappers {
            ($name:ident) => {
                pub struct $name(Reference);
            };
            ($($name:ident),* $(,)*) => {
                $(
                    reference_wrappers!($name);
                )*
            };
        }
    }
    mod impls {
        use ConstructionSite;
    }

    reference_wrappers!(ConstructionSite,);

    struct Reference;
}

pub use objects::*;

fn main() {}

This will compile fine on stable 1.28.0, but when run on 1.29.0-beta.4, it errors with the following message:

error[E0432]: unresolved import
  --> src/main.rs:16:13
   |
16 |         use ConstructionSite;
   |             ^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.

I can't find anything obviously wrong with the code that would cause this. This seems to me to be 100% correct Rust which the compiler is rejecting?

Stable playground which works: https://play.rust-lang.org/?gist=4931737787539855373990990044faa7&version=stable&mode=debug&edition=2015

Beta playground which does not: https://play.rust-lang.org/?gist=4931737787539855373990990044faa7&version=beta&mode=debug&edition=2015

@daboross daboross changed the title Stable->beta regression with imports and macros Beta no longer compiles code which imports a re-export from the same sub-module from the root Aug 13, 2018
@petrochenkov
Copy link
Contributor

Looks similar to #53140

@daboross
Copy link
Contributor Author

Ah, thanks for finding that! I was a bit to fixated on the macro and missed that this also fails:

pub mod objects {
    mod impls {
        use ConstructionSite;
    }

    pub struct ConstructionSite(Reference);

    struct Reference;
}

pub use objects::*;

fn main() {}

Closing in favor of #53140.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants