concise diagnostics for missing props#3873
Conversation
|
Visit the preview URL for this PR (updated for commit f5f68d3): https://yew-rs--pr3873-missing-props-diagno-8yfivone.web.app (expires Tue, 15 Jul 2025 10:19:10 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
| @@ -1,4 +1,3 @@ | |||
| #![no_implicit_prelude] | |||
There was a problem hiding this comment.
I removed these from the tests that have #[derive(Properties)] because it prevents #[diagnostics] from being used. I have no clue how to qualify diagnostics with no_implicit_prelude. If anybody can help it's very appreciated.
There was a problem hiding this comment.
Hmm.. I think it's impossible to use no_implicit_prelude together with diagnostic
https://doc.rust-lang.org/reference/attributes.html#r-attributes.tool.prelude
Tool attributes are not available if the no_implicit_prelude attribute is used.
There was a problem hiding this comment.
I think no_implicit_prelude was introduced to improve hygiene, it ensures our macros don't accidentally collide with rust's built-in ones, which could cause false passes in macro tests.
Sadly there seems to be no way around it for now and diagnostic improvements seem worth it.
Benchmark - coreYew MasterPull Request |
Benchmark - SSRYew MasterDetails
Pull RequestDetails
|
Size ComparisonDetails
✅ None of the examples has changed their size significantly. |
9206406 to
ac43025
Compare
c550f85 to
7e12097
Compare
7e12097 to
f5f68d3
Compare
Description
Leveraging the newly stablized
#[diagnostics]attributes, we can massively clean up diagnostics for missing props.#[diagnostics::on_unimplemented]is stablized in rust 1.78, May, 2024#[diagnostics::do_not_recommend]is stablized in rust 1.85.0, February 20, 2025This PR raises the MSRV from 1.76 to 1.78.
the use of
#[diagnostics::do_not_recommend]seems simply ignored in versions before 1.85.consider the following example:
old diagnostics:

new diagnostics (1.78):
new diagnostics (1.85)
Checklist