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

[Merged by Bors] - Allow SystemParams with private fields #7056

Closed
wants to merge 16 commits into from

Conversation

JoJoJet
Copy link
Member

@JoJoJet JoJoJet commented Dec 29, 2022

Objective

Currently, #[derive(SystemParam)] publicly exposes each field type, which makes it impossible to encapsulate private fields.

Solution

Previously, the fields were leaked because they were used as an input generic type to the macro-generated SystemParam::State struct. That type has been changed to store its state in a field with a specific type, instead of a generic type.


Changelog

  • Fixed a bug that caused #[derive(SystemParam)] to leak the types of private fields.

@JoJoJet JoJoJet added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Dec 29, 2022
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

Wow, that's impressively simple. This will be incredibly useful for folks looking to make index-like data structures (#4513).

@JoJoJet JoJoJet added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Dec 30, 2022
@james7132 james7132 added this to the 0.10 milestone Jan 4, 2023
@cart
Copy link
Member

cart commented Jan 4, 2023

bors r+

bors bot pushed a commit that referenced this pull request Jan 4, 2023
# Objective

- Fix #4200

Currently, `#[derive(SystemParam)]` publicly exposes each field type, which makes it impossible to encapsulate private fields.

## Solution

Previously, the fields were leaked because they were used as an input generic type to the macro-generated `SystemParam::State` struct. That type has been changed to store its state in a field with a specific type, instead of a generic type.

---

## Changelog

- Fixed a bug that caused `#[derive(SystemParam)]` to leak the types of private fields.
@bors bors bot changed the title Allow SystemParams with private fields [Merged by Bors] - Allow SystemParams with private fields Jan 4, 2023
@bors bors bot closed this Jan 4, 2023
bors bot pushed a commit that referenced this pull request Jan 10, 2023
# Objective

- Fix #7103.
- The issue is caused because I forgot to add a where clause to a generated struct in #7056.

## Solution

- Add the where clause.
bors bot pushed a commit that referenced this pull request Jan 10, 2023
# Objective

- Fix #7103.
- The issue is caused because I forgot to add a where clause to a generated struct in #7056.

## Solution

- Add the where clause.
bors bot pushed a commit that referenced this pull request Jan 10, 2023
# Objective

- Fix #7103.
- The issue is caused because I forgot to add a where clause to a generated struct in #7056.

## Solution

- Add the where clause.
@JoJoJet JoJoJet deleted the param-private branch January 13, 2023 02:30
alradish pushed a commit to alradish/bevy that referenced this pull request Jan 22, 2023
# Objective

- Fix bevyengine#4200

Currently, `#[derive(SystemParam)]` publicly exposes each field type, which makes it impossible to encapsulate private fields.

## Solution

Previously, the fields were leaked because they were used as an input generic type to the macro-generated `SystemParam::State` struct. That type has been changed to store its state in a field with a specific type, instead of a generic type.

---

## Changelog

- Fixed a bug that caused `#[derive(SystemParam)]` to leak the types of private fields.
alradish pushed a commit to alradish/bevy that referenced this pull request Jan 22, 2023
# Objective

- Fix bevyengine#7103.
- The issue is caused because I forgot to add a where clause to a generated struct in bevyengine#7056.

## Solution

- Add the where clause.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- Fix bevyengine#4200

Currently, `#[derive(SystemParam)]` publicly exposes each field type, which makes it impossible to encapsulate private fields.

## Solution

Previously, the fields were leaked because they were used as an input generic type to the macro-generated `SystemParam::State` struct. That type has been changed to store its state in a field with a specific type, instead of a generic type.

---

## Changelog

- Fixed a bug that caused `#[derive(SystemParam)]` to leak the types of private fields.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- Fix bevyengine#7103.
- The issue is caused because I forgot to add a where clause to a generated struct in bevyengine#7056.

## Solution

- Add the where clause.
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 S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SystemParam derive leaks private fields
6 participants