-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
target_feature doesn't trickle down to closures and internal fns #58279
Comments
I think this is expected for internal fns, as items in general don't get anything from their enclosures (most well known is that they don't get access to generic parameters). I think I agree for closures, though. |
One problem with closures is that functions with |
I think this has been implemented in the meantime for the target_feature 1.1 feature, as otherwise #108655 wouldn't have been filed. |
(See #73631) |
@LeSeulArtichaut maybe we can close this in favour of #73631? |
#73631 doesn't discuss inner functions at all, but if it seems uncontroversial to not allow them on inner functions then I guess this issue can be closed. |
Yeah, applying target_feature to inner functions is not good. There are ways to call inner functions from outside the function. It's different for closures. |
So, can this be closed then? Closures have been handled by #58279, and inner functions generally don't inherit things from the outer function so it'd be surprising if they inherited target_feature. EDIT: But the inheriting behavior only gets enabled with target_feature 1.1. |
The current implementation is still a bit of a blemish. I wonder if a subset of potential "target_feature" options are reasonable to pass down to inner functions. I would say no, since this could make things even more confusing. Maybe a new issue should be created? |
AFAIK basically no attributes are inherited by inner functions. Why should |
Leaves poorly optimized assembly in its wake.
https://rust.godbolt.org/z/cIr7qS
I found this bug by triggering this one with closures. I wasn't able to trigger it from godbolt. I'm using the latest stable, so if I copied the code in it would work (as in not work).
#50154
Making a separate issue since this one is a performance bug.
The text was updated successfully, but these errors were encountered: