Update reference for target_feature_11. by veluca93 · Pull Request #1720 · rust-lang/reference (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation9 Commits5 Checks5 Files changed
Conversation
This file contains hidden or 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
[ Show hidden characters]({{ revealButtonHref }})
Note there was a previous PR at #1181 that includes some comments of things that were missing or confusing. For example #1181 (comment), contained some changes that happened over time that hadn't yet been captured.
Note there was a previous PR at #1181 that includes some comments of things that were missing or confusing. For example #1181 (comment), contained some changes that happened over time that hadn't yet been captured.
I was not aware of the existing PR!
I believe I have integrated the main comments from that PR, PTAL :-)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content looks to be correct (verified by short code tests) and I don't have any editorial concerns.
Comment on lines 92 to 94
- `#[target_feature]` functions (and closures that inherit the attribute) |
---|
can only be safely called within caller that enable all the `target_feature`s |
that the callee enables. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still exclude implicitly enabled features? If so, can this be clarified to state that it is only the explicitly listed features from the attribute on both sides, and does not consider implicit ones?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does include implicitly enabled features on either side.
Although of course implicitly enabled features on the callee are enabled on the caller too if all the explicitly enabled features in the callee are enabled...
Do you think that is something that should be clarified?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. It looks like this changed in rust-lang/rust#128221 since the last time I looked at this.
I'd like to do a quick editorial pass, and I'll try to clarify this point. I'll try to get to that today.
Am I correct in understanding that this is a new "unsafe superpower"? That is, do we need to add a new item to unsafety.md
that defines something along the lines of calling a safe function with an unmatched target_feature
?
Am I correct in understanding that this is a new "unsafe superpower"? That is, do we need to add a new item to
unsafety.md
that defines something along the lines of calling a safe function with an unmatchedtarget_feature
?
I think this is technically true, yes (in some sense it is not new, because tf functions were unsafe before, but it's probably worth mentioning explicitly)
The unsafe
block enables several abilities beyond just calling unsafe
functions and dereferencing pointers. Link to the actual list of things
you can do.
This does some rewording to try to make things a little more explicit and clearer:
- Moves the
Fn
traits to a separate rule, it wasn't directly related to what is safe and not safe. - Moves the allowed positions into a separate rule, and adds some links to those. I dropped the "other special functions" because it is not defined anywhere.
- Add an example.
- Add a remark about implicit features.
- Don't say "on many platforms", and be more explicit about how this is overridden.
- Various rewording for clarity.
- Remove word wrapping.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was referenced
Feb 13, 2025
compiler-errors added a commit to compiler-errors/rust that referenced this pull request
Update books
rust-lang/book
2 commits in d4d2c18cbd20876b2130a546e790446a8444cb32..4a01a9182496f807aaa5f72d93a25ce18bcbe105 2025-02-24 14:48:34 UTC to 2025-02-13 19:29:47 UTC
- Fix typos in chapter 17 (rust-lang/book#4238)
- NoStarch backports (rust-lang/book#4224)
rust-lang/edition-guide
2 commits in 8dbdda7cae4fa030f09f8f5b63994d4d1dde74b9..daa4b763cd848f986813b5cf8069e1649f7147af 2025-02-22 14:58:51 UTC to 2025-02-21 02:30:17 UTC
- Remove precise capturing features (rust-lang/edition-guide#362)
- use same name as previous example (rust-lang/edition-guide#360)
rust-lang/nomicon
1 commits in 336f75835a6c0514852cc65aba9a698b699b13c8..8f5c7322b65d079aa5b242eb10d89a98e12471e1 2025-02-19 13:16:47 UTC to 2025-02-19 13:16:47 UTC
- other-reprs: do not make it sound like we are making ABI promises for repr(int) enums (rust-lang/nomicon#461)
rust-lang/reference
4 commits in 6195dbd70fc6f0980c314b4d23875ac570d8253a..615b4cec60c269cfc105d511c93287620032d5b0 2025-02-18 23:01:53 UTC to 2025-02-13 15:12:49 UTC
- Add rule identifiers to names chapters (rust-lang/reference#1737)
- Switch from AVX to SSE in the example (rust-lang/reference#1735)
- Remove attributes from struct field rest patterns (rust-lang/reference#1736)
- Update reference for target_feature_11. (rust-lang/reference#1720)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Rollup merge of rust-lang#137552 - rustbot:docs-update, r=ehuss
Update books
rust-lang/book
2 commits in d4d2c18cbd20876b2130a546e790446a8444cb32..4a01a9182496f807aaa5f72d93a25ce18bcbe105 2025-02-24 14:48:34 UTC to 2025-02-13 19:29:47 UTC
- Fix typos in chapter 17 (rust-lang/book#4238)
- NoStarch backports (rust-lang/book#4224)
rust-lang/edition-guide
2 commits in 8dbdda7cae4fa030f09f8f5b63994d4d1dde74b9..daa4b763cd848f986813b5cf8069e1649f7147af 2025-02-22 14:58:51 UTC to 2025-02-21 02:30:17 UTC
- Remove precise capturing features (rust-lang/edition-guide#362)
- use same name as previous example (rust-lang/edition-guide#360)
rust-lang/nomicon
1 commits in 336f75835a6c0514852cc65aba9a698b699b13c8..8f5c7322b65d079aa5b242eb10d89a98e12471e1 2025-02-19 13:16:47 UTC to 2025-02-19 13:16:47 UTC
- other-reprs: do not make it sound like we are making ABI promises for repr(int) enums (rust-lang/nomicon#461)
rust-lang/reference
4 commits in 6195dbd70fc6f0980c314b4d23875ac570d8253a..615b4cec60c269cfc105d511c93287620032d5b0 2025-02-18 23:01:53 UTC to 2025-02-13 15:12:49 UTC
- Add rule identifiers to names chapters (rust-lang/reference#1737)
- Switch from AVX to SSE in the example (rust-lang/reference#1735)
- Remove attributes from struct field rest patterns (rust-lang/reference#1736)
- Update reference for target_feature_11. (rust-lang/reference#1720)
ehuss mentioned this pull request