Skip to content

Treat some references differently for ergonomics#13

Merged
kirillsemyonkin merged 3 commits intoyewstack:mainfrom
kirillsemyonkin:fix-static-str
Mar 16, 2026
Merged

Treat some references differently for ergonomics#13
kirillsemyonkin merged 3 commits intoyewstack:mainfrom
kirillsemyonkin:fix-static-str

Conversation

@kirillsemyonkin
Copy link
Copy Markdown
Collaborator

Discovered by @Madoshakalaka

If a reference type is actually intended, #[autoprops] will currently ignore that and put a referenceless type into the props struct. For example:

#[autoprops]
#[component]
pub fn Test(string: &'static str) {
    html!{}
}

In this case 'static is ignored, and str is attempted to be put into props struct. As a workaround, currently works:

#[autoprops]
#[component]
pub fn Test(string: &&'static str) {
    html!{}
}

But it is unergonomic. It is well known that reference is wanted (by the lifetime specifier existing), so let's put such references into props struct as-is.

@kirillsemyonkin
Copy link
Copy Markdown
Collaborator Author

I'm not going to fix MSRV - I do not know what's the intent behind the chosen MSRV and such unspecific versions in Cargo.toml.
I had to update Cargo.lock because my latest stable did not work (something something web_sys outdated), but in doing so MSRV broke. If that's the issue, then versions should be pinned to last working ones instead of committing Cargo.lock, in which case Cargo will use both outdated lib dep for this library and updated in case someone is using another lib which uses the same dep.

@kirillsemyonkin
Copy link
Copy Markdown
Collaborator Author

how did the checks pass i didnt change function_component to component

Copy link
Copy Markdown
Member

@Madoshakalaka Madoshakalaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@kirillsemyonkin kirillsemyonkin merged commit 53eeb0b into yewstack:main Mar 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants