Giter Club home page Giter Club logo

Comments (3)

LukasKalbertodt avatar LukasKalbertodt commented on July 20, 2024 1

@taiki-e Thanks for checking out this issue and taking the time to have a look at this code! It's really appreciated.

The code you linked... could probably work fine without the Visit feature of syn, but would be more verbose. I guess we won't use syn-mid in auto-impl anytime soon then. We can revisit this issue if anything significant changes :)

Thanks again!

from auto_impl.

LukasKalbertodt avatar LukasKalbertodt commented on July 20, 2024

syn-mid doesn't seem to offer ItemTrait and related types. So it seems like we can't use it here.

@taiki-e: Hello there! Is there a reason why syn-mid does not offer ItemTrait? Or am I missing something? Do you think this project (auto_impl) could use syn-mid? We need to parse trait definitions, but we do not care about function bodies.

from auto_impl.

taiki-e avatar taiki-e commented on July 20, 2024

Hi @LukasKalbertodt. The types provided by syn-mid are not compatible with visit feature, so even if syn-mid provides ItemTrait, I think it is difficult to use syn-mid in auto_impl .

For example, the following visitor seems to be visiting the signature of a function, but as syn::Signature needs full feature, the same cannot be done with syn-mid.

auto_impl/src/analyze.rs

Lines 46 to 62 in f5d3f9b

impl<'ast> Visit<'ast> for IdentCollector<'ast> {
fn visit_ident(&mut self, i: &'ast Ident) {
self.ty_names.insert(i);
}
// We overwrite this to make sure to put lifetime names into
// `lt_names`. We also don't recurse, so `visit_ident` won't be called
// for lifetime names.
fn visit_lifetime(&mut self, lt: &'ast Lifetime) {
self.lt_names.insert(&lt.ident);
}
// Visiting a block just does nothing. It is the default body of a method
// in the trait. But since that block won't be in the impl block, we can
// just ignore it.
fn visit_block(&mut self, _: &'ast Block) {}
}

from auto_impl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.