Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not report missing Root or init_root in component macro #314

Open
euclio opened this issue Oct 11, 2022 · 0 comments
Open

Do not report missing Root or init_root in component macro #314

euclio opened this issue Oct 11, 2022 · 0 comments
Labels
good first issue Good for newcomers

Comments

@euclio
Copy link
Member

euclio commented Oct 11, 2022

In the component_empty example (and others), we report that the Root type and the init_root function are missing:

= help: implement the missing item: `type Root = Type;`
= help: implement the missing item: `type Widgets = Type;`
= help: implement the missing item: `fn init_root() -> <Self as SimpleComponent>::Root { todo!() }`

However, these are provided by the macro if they're not present, so we should not ask the user to provide them. Instead, the expansion should always provide values for them, even if there isn't enough information provided to actually determine the real values. init_root can just expand to fn init_root() -> Self::Root { unimplemented!() }. The Root type is a bit harder: we can't use ! or std::convert::Infallible, because the necessary traits aren't implemented. Instead we could default it to EmptyRoot or an arbitrary gtk widget. We must only do this if we are sure that the expansion will fail for another reason, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants