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

Type used on a private property is exported from generated Rust code #6880

Open
ultimaweapon opened this issue Nov 24, 2024 · 1 comment
Open
Labels
a:language-rust Rust API and codegen (mO,mS) bug Something isn't working

Comments

@ultimaweapon
Copy link

Bug Description

If I declare an enum and use it on a private property the enum also exported from the generated Rust code. This will lead to compilation error if I have the same enum name but on a different module.

I put the reproducible code in https://github.com/ultimaweapon/slint-bug. There are two Page enum in the ui/menu.slint and ui/wizard.slint, which cause following errors:

     |
6    |      # [allow (dead_code)] # [derive (Default , Copy , Clone , PartialEq , Debug)] pub enum r#Page {
     |                                                                                    --------------- variant or associated item `Intro` not found for this enum
...
1485 |                     ) . apply_pin (_self) . get ()) == (r#Page :: r#Intro)) as bool)) as _ }
     |                                                                   ^^^^^^^ variant or associated item not found in `Page`


Reproducible Code (if applicable)

No response

Environment Details

  • Slint Version: 1.8.0
  • Platform/OS: Arch Linux with GNOME on Wayland
  • Programming Language: Rust
  • Backend/Renderer: Default

Product Impact

I can workaround by using a different name but it is not convenience.

@ultimaweapon ultimaweapon added bug Something isn't working need triaging Issue that the owner of the area still need to triage labels Nov 24, 2024
@ogoffart ogoffart added a:language-rust Rust API and codegen (mO,mS) and removed need triaging Issue that the owner of the area still need to triage labels Nov 26, 2024
@ogoffart
Copy link
Member

Indeed, we should filter a bit to limit ourselves with exported enum/struct, and maybe the ones used in public properties for compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:language-rust Rust API and codegen (mO,mS) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants