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

WorldQuery derive doesn't respect visibility #4122

Closed
ItsDoot opened this issue Mar 6, 2022 · 1 comment
Closed

WorldQuery derive doesn't respect visibility #4122

ItsDoot opened this issue Mar 6, 2022 · 1 comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior

Comments

@ItsDoot
Copy link
Contributor

ItsDoot commented Mar 6, 2022

Bevy version

(main) 159fe52

Operating system & version

Windows 10

What you did

Created a WorldQuery derive with a pub struct:

#[derive(Component)]
pub struct Foo;

#[derive(WorldQuery)]
pub struct FooQuery<'w> {
    pub foo: &'w Foo,
}

What you expected to happen

Compile without error.

What actually happened

error[E0446]: private type `FooQueryFetch<'w>` in public interface
  --> server\entity\src\lib.rs:17:10
   |
17 | #[derive(WorldQuery)]
   |          ^^^^^^^^^^
   |          |
   |          can't leak private type
   |          `FooQueryFetch<'w>` declared as private
   |
   = note: this error originates in the derive macro `WorldQuery` (in Nightly builds, run with -Z macro-backtrace for more info)

and

error[E0446]: private type `FooQueryState<'w>` in public interface
  --> server\entity\src\lib.rs:17:10
   |
17 | #[derive(WorldQuery)]
   |          ^^^^^^^^^^
   |          |
   |          can't leak private type
   |          `FooQueryState<'w>` declared as private
   |
   = note: this error originates in the derive macro `WorldQuery` (in Nightly builds, run with -Z macro-backtrace for more info)

Additional Information

Removing the pub from Foo and FooQuery results in no compile errors.

@ItsDoot ItsDoot added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Mar 6, 2022
@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events and removed S-Needs-Triage This issue needs to be labelled labels Mar 6, 2022
bors bot pushed a commit that referenced this issue Apr 13, 2022
## Objective

Fixes #4122.

## Solution

Inherit the visibility of the struct being derived for the `xxItem`, `xxFetch`, `xxState` structs.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
aevyrie pushed a commit to aevyrie/bevy that referenced this issue Jun 7, 2022
## Objective

Fixes bevyengine#4122.

## Solution

Inherit the visibility of the struct being derived for the `xxItem`, `xxFetch`, `xxState` structs.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
@james7132
Copy link
Member

Closing as #4125 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants