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

infer break use-as alias after macro expansion #2443

Closed
edwin0cheng opened this issue Nov 28, 2019 · 0 comments · Fixed by #2466
Closed

infer break use-as alias after macro expansion #2443

edwin0cheng opened this issue Nov 28, 2019 · 0 comments · Fixed by #2466

Comments

@edwin0cheng
Copy link
Member

edwin0cheng commented Nov 28, 2019

#![allow(non_camel_case_types)]

mod m {
    macro_rules! _foo {
        ($x:ident) => { type $x = u64; }
    }
    pub(crate) use _foo as foo;
}

m::foo!(foo);
use foo as bar;

fn f() -> bar { 0 }
fn b() -> foo { 0 }

fn main() {  
    let _a  = f();      // _a : {unknown}
    let _b  = b();     // _b: u64
}

It is because use foo as bar is resolved before expansion of m::foo!(foo), and we didn't rewrite the aliased PerNs of bar. Note that legacy macro invocation (i.e. unquatified identifier like foo!) is not affected, because it is expanded before any item resolutions.

This was referenced Nov 28, 2019
@bors bors bot closed this as completed in b236f6a Dec 8, 2019
@bors bors bot closed this as completed in #2466 Dec 8, 2019
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

Successfully merging a pull request may close this issue.

1 participant