Giter VIP home page Giter VIP logo

Comments (3)

manuthambi avatar manuthambi commented on June 5, 2024

I have a minimal example. How should I upload it?

from rust.

saethlin avatar saethlin commented on June 5, 2024

I prefer code blocks in issue comments like you did above. Even if it's multiple files, then at least it doesn't rely on a commit staying around in someone's repo.

from rust.

manuthambi avatar manuthambi commented on June 5, 2024

While trying to simplify the proc-macro, I think I figured out what is going on. The issue is the following line in the proc-macro above:

quote_spanned! {f.span()=> crate::BitwiseEq::bitwise_eq(&self.#index, &other.#index) }

When I changed quote_spanned! to quote!, it works. The f.span() refers to the i32 token in impl_bitwise5!(Wrap5, i32);. When he compiler sees the self in the expanded code, and the span for which is outside the macro_rules, it seems to be looking for self outside the macro_rules! call-site and errors out.

I don't fully understand how spans interact with macro hygiene, but it makes sense for the compiler to show some kind of error. But the error was very confusing.

Anyways, I know how to fix my code. I'll close this issue.

Thanks for looking into it!

from rust.

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.