-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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] - Lift the 16-field limit from the SystemParam
derive
#6867
Closed
Closed
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d5d0a2a
relax 16-field limitation on `SystemParam` derive
JoJoJet 768b8e1
add a test case
JoJoJet 19da0e0
use a tuple impl for `get_param`
JoJoJet 2c8518c
use field names for locals
JoJoJet c8d64f0
Merge remote-tracking branch 'upstream/main' into system-param-limit
JoJoJet 17568f8
remove `field_indices`
JoJoJet 5aabe45
Merge remote-tracking branch 'upstream/main' into system-param-limit
JoJoJet 513afbf
cargo fmt
JoJoJet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1663,4 +1663,33 @@ mod tests { | |
|
||
#[derive(SystemParam)] | ||
pub struct UnitParam {} | ||
|
||
#[derive(Resource)] | ||
pub struct R<const I: usize>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason why you added this over re-using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want each field to be a distinct type, to make sure the derive macro doesn't mess up the order of the fields. |
||
|
||
#[derive(SystemParam)] | ||
pub struct LongParam<'w> { | ||
_r0: Res<'w, R<0>>, | ||
_r1: Res<'w, R<1>>, | ||
_r2: Res<'w, R<2>>, | ||
_r3: Res<'w, R<3>>, | ||
_r4: Res<'w, R<4>>, | ||
_r5: Res<'w, R<5>>, | ||
_r6: Res<'w, R<6>>, | ||
_r7: Res<'w, R<7>>, | ||
_r8: Res<'w, R<8>>, | ||
_r9: Res<'w, R<9>>, | ||
_r10: Res<'w, R<10>>, | ||
_r11: Res<'w, R<11>>, | ||
_r12: Res<'w, R<12>>, | ||
_r13: Res<'w, R<13>>, | ||
_r14: Res<'w, R<14>>, | ||
_r15: Res<'w, R<15>>, | ||
_r16: Res<'w, R<16>>, | ||
} | ||
|
||
#[allow(dead_code)] | ||
fn long_system(_param: LongParam) { | ||
crate::system::assert_is_system(long_system); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit difficult to follow this but does this make a tuple of tuples? Wouldn't that just raise the limit to 256 instead of removing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait I think I see what this is doing. My god this is going to have a lot of codgen for anything more than 32 entries, but you probably already should be expecting that with a ParamSet that big.