-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why you added this over re-using UnitParam
?
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.
I want each field to be a distinct type, to make sure the derive macro doesn't mess up the order of the fields.
const LIMIT: usize = 16; | ||
while tuple_types.len() > LIMIT { | ||
let end = Vec::from_iter(tuple_types.drain(..LIMIT)); | ||
tuple_types.push(parse_quote!( (#(#end,)*) )); |
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.
const LIMIT: usize = 16; | ||
while tuple_types.len() > LIMIT { | ||
let end = Vec::from_iter(tuple_types.drain(..LIMIT)); | ||
tuple_types.push(parse_quote!( (#(#end,)*) )); |
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.
Resolve conflicts and this is good to go! |
They are resolved :) |
bors r+ |
# Objective * The `SystemParam` derive internally uses tuples, which means it is constrained by the 16-field limit on `all_tuples`. * The error message if you exceed this limit is abysmal. * Supercedes #5965 -- this does the same thing, but is simpler. ## Solution If any tuples have more than 16 fields, they are folded into tuples of tuples until they are under the 16-field limit.
SystemParam
deriveSystemParam
derive
* The `SystemParam` derive internally uses tuples, which means it is constrained by the 16-field limit on `all_tuples`. * The error message if you exceed this limit is abysmal. * Supercedes bevyengine#5965 -- this does the same thing, but is simpler. If any tuples have more than 16 fields, they are folded into tuples of tuples until they are under the 16-field limit.
# Objective * Currently, the `SystemParam` derive does not support types with const generic parameters. * If you try to use const generics, the error message is cryptic and unhelpful. * Continuation of the work started in #6867 and #6957. ## Solution Allow const generic parameters to be used with `#[derive(SystemParam)]`.
# Objective * The `SystemParam` derive internally uses tuples, which means it is constrained by the 16-field limit on `all_tuples`. * The error message if you exceed this limit is abysmal. * Supercedes bevyengine#5965 -- this does the same thing, but is simpler. ## Solution If any tuples have more than 16 fields, they are folded into tuples of tuples until they are under the 16-field limit.
# Objective * Currently, the `SystemParam` derive does not support types with const generic parameters. * If you try to use const generics, the error message is cryptic and unhelpful. * Continuation of the work started in bevyengine#6867 and bevyengine#6957. ## Solution Allow const generic parameters to be used with `#[derive(SystemParam)]`.
# Objective * The `SystemParam` derive internally uses tuples, which means it is constrained by the 16-field limit on `all_tuples`. * The error message if you exceed this limit is abysmal. * Supercedes bevyengine#5965 -- this does the same thing, but is simpler. ## Solution If any tuples have more than 16 fields, they are folded into tuples of tuples until they are under the 16-field limit.
# Objective * Currently, the `SystemParam` derive does not support types with const generic parameters. * If you try to use const generics, the error message is cryptic and unhelpful. * Continuation of the work started in bevyengine#6867 and bevyengine#6957. ## Solution Allow const generic parameters to be used with `#[derive(SystemParam)]`.
Objective
SystemParam
derive internally uses tuples, which means it is constrained by the 16-field limit onall_tuples
.Solution
If any tuples have more than 16 fields, they are folded into tuples of tuples until they are under the 16-field limit.