-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Problem
Example code should explain the problem:
use std::marker::PhantomData;
use yew::prelude::*;
#[derive(PartialEq, Eq)]
struct Generic<T>(PhantomData<T>);
// This works fine.
#[derive(Properties, PartialEq, Eq)]
struct Properties1 {
gen: Generic<Properties1>,
}
// This doesn't work, even though it's equivalent.
#[derive(Properties, PartialEq, Eq)]
struct Properties2 {
gen: Generic<Self>,
}Steps To Reproduce
Steps to reproduce the behavior:
- Compile above code without
Properties2. - Observe that it compiles.
- Run above code with
Properties2. - Observe that it does not compile.
Expected behavior
The code with Properties2 should compile as it is equivalent to the first one. Probably the problem lies in the Self keyword being misunderstood as the fields are put into a different struct.
Environment:
- Yew version: v0.21
- Rust version: 1.74.1