-
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
Rework stability annotation pass #29083
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Should be good for a rebase now! |
7ea140c
to
9fc5634
Compare
Rebased. |
|
Disregard the previous message. Everything will have to be annotated anyway when libcore root is stabilized. Better not to wait until that moment. |
I'm a little wary about using exported items because as you've found it's pretty lossy and requires annotating a little too much, but can you elaborate on how it deals with trait items differently? I'm always a little hazy on the difference between public and exported items, but it may just be a bug that trait items aren't listed as public. |
#[doc(hidden)] | ||
#[unstable(feature = "libstd_sys_internals", | ||
reason = "this struct is considered exported for some reason", | ||
issue = "0")] |
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 is actually intended to be stable (good that this PR caught the bug!), so could you tag it as stable since 1.0.0?
Also starting a crater run to see what the impact is (hopefully small!) |
Crater reports six regressions, 4 of which are legitimate and 2 of which seem unrelated but also legit? |
Sorry for the delay.
4 legitimately regressed crates are on unstable. Unstable 2 unrelated regressions look... completely unrelated. |
Trait items, impls and impl items are not public, but exported, so they can be left without annotations and therefore lead to "use of unmarked library feature" errors. We don't see these errors now, because the checking pass doesn't look at impls and impl items currently and all trait items have explicit or inherited stability by luck. The annotation overhead from using exported set is not so serious. It just looks large here, because everything is gathered in one commit. We have approximately 4000 annotated items and only 12 of them are "spurious". Statistically, almost nothing. On the other hand, it's certainly possible to extend the public set with exported trait items, impls and impl items. In fact, this was the first thing I did! But then I realized three things - 1) after this adjustment public set becomes suspiciously similar to the exported set, 2) I don't actually understand what the public set is supposed to be. 3) I'm still not sure if non-public exported traits (or their items, more importantly) need stability or not. So, I decided not to disrupt the public set with my extra additions, but to use the exported set instead. (It's interesting, that stability annotation pass was actually the only user of the public set besides rustdoc, everything else uses the exported set). |
In principle, annotation pass can build its own node set, or use exported set for everything except for traits and public set for traits, but it would be additional cruft for little gain, IMO. |
9fc5634
to
0e3941f
Compare
I'm currently annotating trait impls and various pieces of internal code keep requiring annotations :( |
Updated with annotations on trait impls. |
Blocked on #29291 |
☔ The latest upstream changes (presumably #29254) made this pull request unmergeable. Please resolve the merge conflicts. |
The public set is expanded with trait items, impls and their items, foreign items, exported macros, variant fields, i.e. all the missing parts. Now it's a subset of the exported set. This is needed for #29083 because stability annotation pass uses the public set and all things listed above need to be annotated. Rustdoc can now be migrated to the public set as well, I guess. Exported set is now slightly more correct with regard to exported items in blocks - 1) blocks in foreign items are considered and 2) publicity is not inherited from the block's parent - if a function is public it doesn't mean structures defined in its body are public. r? @alexcrichton or maybe someone else
@petrochenkov do you want to rebase this now that #29291 has landed? |
fcd0029
to
8357584
Compare
Updated. |
@bors: r+ 8357584 |
⌛ Testing commit 8357584 with merge aa7132f... |
💔 Test failed - auto-win-gnu-32-opt |
8357584
to
e938e8e
Compare
Updated. |
@bors: r+ e938e8ea2eaf9093bb92abe25f550a48a4288441 |
⌛ Testing commit e938e8e with merge 9514f21... |
💔 Test failed - auto-linux-64-x-android-t |
e938e8e
to
64b90f8
Compare
Updated. |
@bors: r+ On Wed, Nov 18, 2015 at 10:17 AM, Vadim Petrochenkov <
|
📌 Commit 64b90f8 has been approved by |
What this patch does: - Stability annotations are now based on "exported items" supplied by rustc_privacy and not "public items". Exported items are as accessible for external crates as directly public items and should be annotated with stability attributes. - Trait impls require annotations now. - Reexports require annotations now. - Crates themselves didn't require annotations, now they do. - Exported macros are annotated now, but these annotations are not used yet. - Some useless annotations are detected and result in errors - Finally, some small bugs are fixed - deprecation propagates from stable deprecated parents, items in blocks are traversed correctly (fixes #29034) + some code cleanup.
This wasn't done in #29083 because attributes weren't parsed on fields of tuple variant back then. r? @alexcrichton
What this patch does: