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

External types don't work if they're not used in an interface #1872

Open
bendk opened this issue Nov 28, 2023 · 1 comment
Open

External types don't work if they're not used in an interface #1872

bendk opened this issue Nov 28, 2023 · 1 comment

Comments

@bendk
Copy link
Contributor

bendk commented Nov 28, 2023

If you define an external type, but don't use it in an exporting function/method, then we don't actually import the type in the bindings.

Here's a branch that contains a test for this and tries to fix it, although I couldn't get it all working: https://github.com/bendk/uniffi-rs/tree/ext-type-imports

@bendk
Copy link
Contributor Author

bendk commented Nov 28, 2023

One use-case here is nested types. Suppose you wanted export a function that used the Line type from the geometry example crate. In that case, you also would want to export the Point type or else users would have no easy way of constructing a Line. Maybe UniFFI could recurse through the types to solve this one, but then how would it know if the ExternalKind to use for that type?

Another use case is simply re-exporting a type. Suppose the foo crate defined a Foo interface type that was really useful and you wanted to re-export that type and let users use it without needing to get it from foo.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Dec 2, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163
moz-gfx pushed a commit to moz-gfx/webrender that referenced this issue Dec 2, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/375a5bb63fa774ba65f3426c93cac31e774c29f4
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this issue Dec 3, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Dec 6, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163
moz-gfx pushed a commit to moz-gfx/webrender that referenced this issue Dec 6, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/cf885f915fdf19e6901851c4250c030b6b4c7d52
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Dec 7, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Dec 7, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: 375a5bb63fa774ba65f3426c93cac31e774c29f4
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Dec 7, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: cf885f915fdf19e6901851c4250c030b6b4c7d52
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Dec 7, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: 375a5bb63fa774ba65f3426c93cac31e774c29f4
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Dec 7, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: cf885f915fdf19e6901851c4250c030b6b4c7d52
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Dec 7, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: 375a5bb63fa774ba65f3426c93cac31e774c29f4
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Dec 7, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: cf885f915fdf19e6901851c4250c030b6b4c7d52
moz-gfx pushed a commit to moz-gfx/webrender that referenced this issue Dec 13, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/d4a294b46ab8b75d97f87e6b75c909f3e597a531
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Dec 13, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this issue Dec 13, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Dec 16, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: d4a294b46ab8b75d97f87e6b75c909f3e597a531
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Dec 16, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: d4a294b46ab8b75d97f87e6b75c909f3e597a531
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Dec 16, 2023
…markh,janerik,supply-chain-reviewers,mach-reviewers,ahal

Updated uniffi-bindgen-gecko-js to work with UniFFI 0.25.2:
- Use `config.toml` to list UniFFI sources.  This makes it easier to
  associate data with them, for example the `crate_name` field that's
  now required to generate the sources.
- Enable the `extern-rustbuffer` feature on `uniffi_core`
- Updated the external types fixture to work around
  mozilla/uniffi-rs#1872

Ran mach vendor and mach cargo vet to update the Rust crates.

Differential Revision: https://phabricator.services.mozilla.com/D195163

UltraBlame original commit: d4a294b46ab8b75d97f87e6b75c909f3e597a531
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

No branches or pull requests

1 participant