Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Do better with generated defs #156

Closed
nrc opened this issue Jan 25, 2017 · 3 comments
Closed

Do better with generated defs #156

nrc opened this issue Jan 25, 2017 · 3 comments

Comments

@nrc
Copy link
Member

nrc commented Jan 25, 2017

This is mostly a rustc/save-analysis issue. When a definition is generated by a macro, we have the span of the macro use which we could use, but either in save-analysis or the RLS we avoid doing this. We have to be a bit careful since in some circumstances this can lead to bad spans and other errors, but at least in some cases this should work. E.g.,

#[derive(new)]
struct Foo { ... }

fn main() {
    Foo::new(...);
}

Goto def on new should jump to the derive(new) span, but currently we get nothing.

@KalitaAlexey
Copy link
Contributor

macro_rules! define_enum {
    () => (
        enum E {
            A,
            B,
            C
        }
    )
}

define_enum!();

fn main() {
    let e = E::A; // Here

    match e {
        E::A => {} // Here
        _ => {}
    }
}

It doesn't find a span for neither E nor E::A.

Is that same problem?

@sophiajt
Copy link

sophiajt commented Feb 21, 2017

I believe this should be filed on the https://github.com/nrc/rls-analysis repo.

@nrc - are you consolidating all the issues here?

@nrc
Copy link
Member Author

nrc commented Oct 30, 2017

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

No branches or pull requests

3 participants