Git Product home page Git Product logo

Comments (13)

antoyo avatar antoyo commented on June 29, 2024

To have that right now, I could implement something that will run when an environment variable is set. It will do the following:

  • Try to compile the source code.
  • If there's an error within a #[widget] attribute:
    • Generate the source code annotated by this attribute and compile it.
    • Match the errors of the generated code with the original one.
    • Show these errors instead of the one produced by the compiler.

That will be slow, but still faster that doing that by hand.

from relm.

Geobert avatar Geobert commented on June 29, 2024

This is really needed, especially for noobs like me in Rust and you get this kind of error:

error: borrowed value does not live long enough
  --> src\widgets\daywidget.rs:34:9
   |
34 | #[widget]
   | --------^
   | |       |
   | |       temporary value dropped here while still borrowed
   | temporary value created here
   |
   = note: values in a scope are dropped in the opposite order they are created

I think I'll give up on relm for the moment :(

from relm.

antoyo avatar antoyo commented on June 29, 2024

I think that I'll soon be able to fix this issue (at least on nightly) since syn was fixed.
However, I think I need this pull request to be merged, but hopefully it will happen soon.

Until then, you can enable the log when you use relm by doing:

export RUST_LOG=warn

and you'll see the generated code.
Then, you can try the generated code to have a better error but it is annoying to do that.

from relm.

Geobert avatar Geobert commented on June 29, 2024

Oh cool, I'm gonna give this a shot to see if I can understand which value causes this error :)

Thank you. And to be fair, I know the whole Rust sphere is very young and still craving its way to provide all the tools needed to make a language successful :) So kudo to you for relm, it makes gtk way less ugly to use in Rust!

from relm.

antoyo avatar antoyo commented on June 29, 2024

Oh, I've just noticed that this logging feature is only in the feature/futures-glib branch (which contains many breaking changes).
Do you want that I add it in the master branch?

from relm.

Geobert avatar Geobert commented on June 29, 2024

If the PR needed to makes thing right by managing the current ticket is merged soon, don't bother, I can wait :)

from relm.

superlou avatar superlou commented on June 29, 2024

Looks like the pull-request was merged. Is it something we need to update on our end, or does the library need to be updated?

from relm.

antoyo avatar antoyo commented on June 29, 2024

@superlou: Unfortunately, this PR was merged with a hack, so it does not work right now.
Also, that will need to update the code to switch to proc-macro2.

from relm.

antoyo avatar antoyo commented on June 29, 2024

@zmitchell I talked to you about the idea of using (sy)nom, but I'm not sure we can use it for the whole thing.
I think we will only be able to parse the content of the view! macro with it.

from relm.

zmitchell avatar zmitchell commented on June 29, 2024

I agree, I think it's the only part that it needs to be used for. I don't think I implied otherwise, did I?

from relm.

antoyo avatar antoyo commented on June 29, 2024

@zmitchell No, but I did :) .

from relm.

antoyo avatar antoyo commented on June 29, 2024

@zmitchell: I started to fix this and have some basic examples (like buttons-attribute) working.
You can see my work in branch fix/better-error (see this giant commit).
Hopefully, I'll finish the work in 2-3 weeks.

from relm.

antoyo avatar antoyo commented on June 29, 2024

Fixed by PR #90.

from relm.

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.