Comments (13)
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.
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.
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.
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.
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.
If the PR needed to makes thing right by managing the current ticket is merged soon, don't bother, I can wait :)
from relm.
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.
@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.
@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.
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.
@zmitchell No, but I did :) .
from relm.
@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.
Fixed by PR #90.
from relm.
Related Issues (20)
- Add CI for Windows and OS X
- Bad error message when misusing nested views
- destroy event never called HOT 11
- Confusing error message on empty view! macro
- Why fragile crate is copy in src/vendor? HOT 2
- Comparison to vgtk HOT 1
- Can't run the examples HOT 2
- support for virtualized widget lists? HOT 4
- EventStream panics on emit from another thread HOT 1
- unexpected behavior of nested views in embedded separated component HOT 2
- relm's event don't work when in a busy loop in the gtk GUI thread even if calling process_events HOT 1
- How does one use relm with a TextView? HOT 2
- Create a new instance of a Relm widget HOT 2
- [RFC] Planning the transition to GTK4 (relm4) HOT 7
- 100% cpu use in Widget::run? HOT 1
- Broken description on crates.io HOT 1
- Dynamically create new widgets HOT 2
- Compilation error when using non-Copy types in messages HOT 7
- Nested view! macros use inner view as outer root HOT 1
- Make a clearer error message for View Macro
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relm.