Relm now has better error messages!

Relm is an attempt to do an idiomatic GUI library in Rust, based on gtk+. See the introduction article for details about why this library was created and how to use it.

New release

I’ve just released relm version 0.12!

This new release does not provide a bunch of new features, but fix a very important issue: the bad error messages.

Before this release, the error message were not really helpful:

error[E0308]: mismatched types
  --> examples/buttons-attribute.rs:57:1
   |
57 | #[widget]
   | ^^^^^^^^^
   | |
   | expected &str, found struct `std::string::String`
   | help: consider borrowing here: `&#[widget]`
   |
   = note: expected type `&str`
              found type `std::string::String`

What a funny help message from the compiler!

Now, the error is shown exactly where it should be:

error[E0308]: mismatched types
  --> examples/buttons-attribute.rs:89:27
   |
89 |                     text: self.model.counter.to_string(),
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                           |
   |                           expected &str, found struct `std::string::String`
   |                           help: consider borrowing here: `&self.model.counter.to_string()`
   |
   = note: expected type `&str`
              found type `std::string::String`

Which is now helpful, to say the least.

This only works when using nightly and when using these features:

[features]
default = ["relm/unstable", "relm-attributes/unstable", "relm-derive/unstable"]

Other fix

This release also fixes another issue where it was impossible to set child properties in some cases.

Conclusion

I hope that the people who didn’t want to use relm because of the bad error messages will now give it a try. As always, your feedback is very much appreciated. Also, there are issues that could use some love and many of them are tagged as easy if you wish to start with something simple. Don’t wait to make a difference in the Rust ecosystem!

Please comment on Reddit.

Previous
Next