sycamore-rs / sycamore

A library for creating reactive web apps in Rust and WebAssembly
https://sycamore-rs.netlify.app
MIT License
2.79k stars 148 forks source link

Can't use `build` as an argument name in `Props` nor `component(inline_props)` #576

Open Dav1dde opened 1 year ago

Dav1dde commented 1 year ago

Describe the bug

This does not compile:

struct Build;

#[component(inline_props)]
pub fn PobItemSet<'a, G: Html>(
    cx: Scope<'a>,
    build: &'a Build,
) -> View<G> {
    todo!()
}

Because build clashes with code generated by the macro. The same happens with non-inline props and a field named build.

Expected behavior

The macro generates boilerplate which does not collide with regular names, either buy using a trait (PropTrait::build) or by generating names that have a very slim/no chance of colliding with user code.

Environment