Skip to content

Having custom core module in scope breakes builtin derive(Clone) macro #13600

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

Closed
Veetaha opened this issue Nov 10, 2022 · 3 comments
Closed

Having custom core module in scope breakes builtin derive(Clone) macro #13600

Veetaha opened this issue Nov 10, 2022 · 3 comments
Labels
A-hygiene C-bug Category: bug

Comments

@Veetaha
Copy link
Contributor

Veetaha commented Nov 10, 2022

Reproduction code

mod core {}

#[derive(Clone)]
struct Foo;

fn main() {
    let _ = Foo.clone();
    //          ^^^^^ this method call is not resolved according to rust-analyzer
}

Demo

Other reproductions

The real use case where this happened is in a reexport in our library that wraps the rusoto AWS SDK:

pub use rusoto_core as core;

So reexport of modules as core also suffer from the same problem.

Meta

rust-analyzer version: rust-analyzer version: 0.3.1277-standalone
rustc version: rustc 1.64.0 (a55dd71d5 2022-09-19)

@jonas-schievink
Copy link
Contributor

Perhaps this should produce ::core instead of a plain core?

@lnicola
Copy link
Member

lnicola commented Oct 5, 2023

Yup, this works, but then tt.token_trees[0] two lines below will point to the :: token instead. I couldn't figure out if quote! supports a Subtree or we need some other way of splicing the whole thing in the expansions.

@lnicola
Copy link
Member

lnicola commented Jan 8, 2024

Fixed by #16308.

@lnicola lnicola closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-hygiene C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants