-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
stabilize #[used] #51363
stabilize #[used] #51363
Conversation
src/libsyntax/feature_gate.rs
Outdated
@@ -609,6 +606,8 @@ declare_features! ( | |||
(accepted, fn_must_use, "1.27.0", Some(43302), None), | |||
// Allows use of the :lifetime macro fragment specifier | |||
(accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None), | |||
// Used to preserve symbols (see llvm.used) | |||
(accepted, used, "1.28.0", Some(40289), None), | |||
); | |||
|
|||
// If you change this, please modify src/doc/unstable-book as well. You must |
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.
Do we even have an entry in the unstable-book
? If yes, apply this comment, if no, we should probably document it together with stabilization.
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.
Do we even have an entry in the unstable-book?
Yes.
If yes, apply this comment
I asked in the PR description where the documentation should be moved to as there are a few options (reference, book, RBE, etc.)
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 would have assumed to add it to the book
, because that would have been where I'd have searched for 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.
@steveklabnik thinks otherwise (cf. #51366 (comment) and #51366 (comment)). I'll prep a PR to add documentation to the reference and the nomicon.
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
r? @oli-obk |
☔ The latest upstream changes (presumably #51448) made this pull request unmergeable. Please resolve the merge conflicts. |
Can someone explain to me why this can only be applied to static items? It would be useful for exporting "unused" |
A few reasons:
extern "C" fn keep_this() {}
#[used]
static KEEP: extern "C" fn() = keep_this; |
Documentation PRs: rust-lang/reference#361 and rust-lang/nomicon#74 |
We had been using `#[no_mangle]` which is a workaround to ensure that the compiler doesn't drop important symbols. `#[used]` is designed explicitly for this purpose. rust-lang/rust#51363
Now that the docs PRs are sent should we start the FCP process? cc @rust-lang/lang |
Wasn't the name quite controversial? Are we going with |
@eddyb we accepted an RFC to stabilize with that name after a lot of bikeshed, so I'd say yes :) |
Ah, I see, rust-lang/rfcs#2386 (comment). That's sad but I won't block the stabilization (#40289). |
src/libsyntax/feature_gate.rs
Outdated
@@ -609,6 +606,8 @@ declare_features! ( | |||
(accepted, fn_must_use, "1.27.0", Some(43302), None), | |||
// Allows use of the :lifetime macro fragment specifier | |||
(accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None), | |||
// Used to preserve symbols (see llvm.used) | |||
(accepted, used, "1.28.0", Some(40289), None), |
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.
This should be changed to 1.29.0 before merging.
@eddyb Hah :P You even ticked your own box on the RFC ;) |
@Centril I ticked my box during the discussion about the name, which I was hoping would result in a better alternative being chosen. Acceptance of the RFC, with |
We had been using `#[no_mangle]` which is a workaround to ensure that the compiler doesn't drop important symbols. `#[used]` is designed explicitly for this purpose. rust-lang/rust#51363
Ping from triage, @oli-obk / @rust-lang/lang: IIUC, this PR is waiting for one of you to trigger an FCP. |
@TimNN |
To clear the PR queue, I'm going to close this until the FCP period is over. |
FCP period is now over. @japaric can you resolve the conflicts / rebase? =P |
it'll be documented in the reference
@Centril I have rebased the PR. I have also pushed a commit that removes the chapter from the unstable book since there is a PR to document this in the reference (which I still need to update). |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
src/libsyntax/feature_gate.rs
Outdated
@@ -674,6 +671,9 @@ declare_features! ( | |||
// Allows all literals in attribute lists and values of key-value pairs. | |||
(accepted, attr_literals, "1.30.0", Some(34981), None), | |||
(accepted, panic_handler, "1.30.0", Some(44489), None), | |||
// Used to preserve symbols (see llvm.used) | |||
(accepted, used, "1.29.0", Some(40289), None), |
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.
Time flies, this should be 1.30.0 now (or 1.31.0 if it can't be merged this week).
@bors r+ |
📌 Commit d37658a has been approved by |
stabilize #[used] closes #40289 RFC for stabilization: rust-lang/rfcs#2386 r? @Centril Where should this be documented? Currently the documentation is in the unstable book
☀️ Test successful - status-appveyor, status-travis |
closes #40289
RFC for stabilization: rust-lang/rfcs#2386
r? @Centril
Where should this be documented? Currently the documentation is in the unstable book