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

Make arrays exportable only when their inner type is exportable #875

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

lilizoey
Copy link
Member

I also added a separate private function under the Export trait for some doctests. I wasn't entirely sure it made sense to put them in the Export trait's docs since they only really exist to test that compilation fails in certain scenarios and it might be a bit weird to just have a bunch of wrong examples.

fixes #870

@lilizoey lilizoey added bug c: core Core components labels Aug 27, 2024
@GodotRust
Copy link

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-875

@lilizoey
Copy link
Member Author

i just realized, in some sense this is technically semver breaking as in code which used to compile now fails. but in another sense, any code that would be broken should hit #870 and thus panic on startup. idk what this counts as

Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

It looks like doctests are also run for private functions, so export_doctests should be good! Could you maybe check if the compile_fail doctest still succeeds if the code actually compiles?

Comment on lines 988 to 990
impl<T: ArrayElement> Export for Array<T>
where
T: Export,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
impl<T: ArrayElement> Export for Array<T>
where
T: Export,
impl<T> Export for Array<T>
where
T: ArrayElement + Export,

@lilizoey
Copy link
Member Author

lilizoey commented Sep 4, 2024

Thanks!

It looks like doctests are also run for private functions, so export_doctests should be good! Could you maybe check if the compile_fail doctest still succeeds if the code actually compiles?

if i comment out the relevant bounds to make both of the exports compile, then the compile_fail doctests do fail.

Add some compile_fail doctests for `Export`
Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Bromeon Bromeon added this pull request to the merge queue Sep 4, 2024
Merged via the queue into godot-rust:master with commit b950177 Sep 4, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug c: core Core components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exporting an Array of an unexportable type panics in class registration
3 participants