wishawa / async_ui

Lifetime-Friendly, Component-Based, Retained-Mode UI Powered by Async Rust
Mozilla Public License 2.0
551 stars 11 forks source link

Invalid use of `must_use`, will cause problems with upcoming Rust stable versions #10

Closed estebank closed 6 months ago

estebank commented 6 months ago

https://github.com/rust-lang/rust/pull/121545 will cause rustc to start validating attributes on associated items in traits. It should have always done so. That change will cause async_ui_web_html to error:

[INFO] [stdout] error: malformed `must_use` attribute input
[INFO] [stdout]   --> src/common_events.rs:6:9
[INFO] [stdout]    |
[INFO] [stdout] 6  |         #[must_use("the returned object is a Future+Stream that does nothing unless polled")]
[INFO] [stdout]    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] ...
[INFO] [stdout] 77 |     make_event_impl!("change", until_change, web_sys::Event, "[MDN documentation for this event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)...
[INFO] [stdout]    |     ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- in this macro invocation
[INFO] [stdout]    |
[INFO] [stdout]    = note: this error originates in the macro `make_event_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] help: the following are the possible correct uses
[INFO] [stdout]    |
[INFO] [stdout] 6  |         #[must_use = "reason"]
[INFO] [stdout]    |
[INFO] [stdout] 6  |         #[must_use]
[INFO] [stdout]    |

https://github.com/wishawa/async_ui/blob/141a0f0d95f30ecb4f578ab5856a4c81cc276209/async_ui_web_html/src/common_events.rs#L6

Fixing this will be straightforward.

wishawa commented 6 months ago

Fixed by #9 . Thank you!