relm: compilation errors are reported on the "widget" annotation not at the correct location

I’m not sure whether that one is in fact fixable, but it is quite annoying when I hit it (which is relatively often). I get compilation errors like that:

error[E0282]: type annotations needed
   --> projectpad/src/widgets/server_item_list_item.rs:112:1
    |
112 | #[widget]
    | ^^^^^^^^^ this method call resolves to `&T`
    |
    = note: type must be known at this point

So the error is reported on the #[widget] annotation and not at the real location of the error. It can get very annoying, sometimes I had errors like “types don’t match” (without any extra info) reported at this location 😦

But due to macro use i’m not sure whether it’s fixable in relm. If you’re not aware of this issue and need a small reproduction, I’ll try to produce one.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (23 by maintainers)

Commits related to this issue

Most upvoted comments

I was able to reproduce this bug (with a reference to a closure) outside of relm. I reported it there.

I’ll check if the syntax error can also be reproduce.

Let’s close this issue, then, since we cannot fix anything in relm anyway.

The other problem is also reproducted outside of relm. I reported it there.

So, I’ll close this issue when this is fixed and the syn dependency is updated to the fixed version.

Yes, I am able to reproduce your errors in your branch.