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

Get def_site() to resolve paths #290

Closed
dtolnay opened this issue Jan 2, 2018 · 2 comments
Closed

Get def_site() to resolve paths #290

dtolnay opened this issue Jan 2, 2018 · 2 comments
Milestone

Comments

@dtolnay
Copy link
Owner

dtolnay commented Jan 2, 2018

I got stuck trying to get Span::def_site() to resolve things correctly with --features proc-macro2/unstable. @mystor could you take a look?

quote_spanned! {
    Span::def_site(),
    impl #impl_generics HeapSize for #name #ty_generics #where_clause {
        fn heap_size_of_children(&self) -> usize {
            0
        }
    }
}

Run cargo build in this directory to see the error.

error[E0405]: cannot find trait `HeapSize` in this scope
 --> src/main.rs:7:10
  |
7 | #[derive(HeapSize)]
  |          ^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
  |
5 | use heapsize::HeapSize;
  |

With Span::call_site() it correctly resolves the HeapSize imported by main.rs, but I want def_site() so that it resolves the one in scope within the heapsize_derive crate. Is this not implemented yet or am I doing something wrong?

@dtolnay
Copy link
Owner Author

dtolnay commented Jan 2, 2018

Fixed in 810e97b with further discussion in rust-lang/rust#38356 (comment).

@dtolnay dtolnay closed this as completed Jan 2, 2018
@mystor
Copy link
Collaborator

mystor commented Jan 2, 2018

With Span::call_site() it correctly resolves the HeapSize imported by main.rs, but I want def_site() so that it resolves the one in scope within the heapsize_derive crate. Is this not implemented yet or am I doing something wrong?

I think that it's not implemented yet.

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