Skip to content
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

Handle future deprecation annotations #49179

Merged
merged 5 commits into from
Apr 5, 2018

Conversation

varkor
Copy link
Member

@varkor varkor commented Mar 19, 2018

This adds special handling to the since parameter of the deprecated attribute: in particular, if the since version exceeds the version of the compiler, the deprecation notice will not be printed; but a note is added to the documentation stating that the item will be deprecated in a later version.

(I've used since for this, rather than adding a new attribute, because it's more seamless and, I feel, intuitive. Plus it involves less code churn.)

image
image

This is a prerequisite for doing things renaming methods in the standard library (e.g. #30459). Resolves #30785.

@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 19, 2018
@michaelwoerister
Copy link
Member

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

That's an excellent idea! All good for me. Anything you see @QuietMisdreavus?

@QuietMisdreavus
Copy link
Member

I feel a bit wary about putting something that long in the "short stability notice" on the modules listing, but if you're fine with it i won't block it. Otherwise this looks great, thanks!

@GuillaumeGomez
Copy link
Member

I'm open to suggestions if you think the sentence is too long. :)

@bors
Copy link
Contributor

bors commented Mar 24, 2018

☔ The latest upstream changes (presumably #48552) made this pull request unmergeable. Please resolve the merge conflicts.

@varkor
Copy link
Member Author

varkor commented Mar 26, 2018

I struggled a bit coming up with other labels that were shorter, but still readable (and not confusable with items that are currently deprecated:

This will be deprecated in [...] // current
Deprecation planned for [...]
To be deprecated in [...]
Deprecating in [...]

Do you prefer any of these?

@QuietMisdreavus
Copy link
Member

Of those, I like "Deprecating in _" the most, partly because the others seem to be more verbose (or are the original, which is fine but long).

@varkor
Copy link
Member Author

varkor commented Mar 30, 2018

@GuillaumeGomez: what do you think about the phrases?

@GuillaumeGomez
Copy link
Member

Not native english speaker so I'll trust @QuietMisdreavus on this one. ;)

@varkor
Copy link
Member Author

varkor commented Mar 31, 2018

Okay, I've updated the description to "Deprecating in [version]"!

@TimNN
Copy link
Contributor

TimNN commented Mar 31, 2018

Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (612819/612819), completed with 4842 local objects.
---
[00:00:45] configure: rust.quiet-tests     := True
---
[00:38:16] .........................................................................i..........................
[00:38:22] ................i...................................................................................
---
[00:38:57] ............................................................................................i.......
[00:39:04] ................................................................i...................................
---
[00:39:57] .............................................i......................................................
---
[00:43:38] .............................i......................................................................
[00:43:52] ..............................................................i.....................................
[00:44:07] ...............................................i....................................................
[00:44:26] ....................................................................................................
[00:44:47] ....................................................................................................
[00:45:07] ....................................................................................................
[00:45:31] .i................................................................................................i.
[00:45:59] ........................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:46:06] ............
[00:46:34] ....................................................................................................
[00:47:08] ...............................................................ii...................................
[00:47:54] ..........................i....................................................i.ii.................
[00:48:32] .......................................................................................iiiiiii......
---
[00:50:27] ....................................i...............................................................
[00:50:34] ....................................................................................................
[00:50:41] ..................i............................................................ii.iii...............
[00:50:48] ....................................................................................................
[00:50:56] ........i..............................i............................................................
[00:51:03] ....................................................................................................
[00:51:10] .....................i..............................................................................
[00:51:18] ....................................................................................................
[00:51:27] ....................................................................................................
[00:51:37] ....................................................................................................
[00:51:48] ....................................................................................................
[00:52:01] ....................................................................................................
[00:52:09] ..............i.....................................................................................
[00:52:18] .................i..ii..............................................................................
[00:52:27] ....................................................................................................
[00:52:37] ....................................................................................................
[00:52:46] ....................................................................................i...............
[00:52:56] ..............................i.....................................................................
---
[00:53:32] ...........................i........................................................................
[00:53:33] ....................................................................i...............................
[00:53:34] ................i.......................................................
---
[00:53:49] ...........i........................
---
[00:54:20] i...i..ii....i.............ii........iii......i..i...i...ii..i..i..ii.....
---
[00:54:23] i.......i......................i......
---
[00:54:59] iiii.......i..i........i..i.i.............i..........iiii...........i...i..........ii.i.i.......ii..
[00:55:01] ....ii...
---
[01:01:51] ..............F.....................................................................................
[01:03:23] ....i...............................................................................................
Build completed unsuccessfully in 0:26:14
[01:03:39] make: *** [check] Error 1
[01:03:39] Makefile:58: recipe for target 'check' failed
---
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory

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 @TimNN.

Copy link
Member

@QuietMisdreavus QuietMisdreavus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last nit, then r=me

// version, then we should display no warning message.
let deprecated_in_future_version = if let Some(sym) = depr_entry.attr.since {
let since = sym.as_str();
!deprecation_in_effect(since.as_ref())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use as_ref to get the &str; that tends to be a footgun. Passing &since should cause deref coercion to pass the &str to deprecation_in_effect.

@GuillaumeGomez
Copy link
Member

@bors: r=QuietMisdreavus,GuillaumeGomez

@bors
Copy link
Contributor

bors commented Apr 3, 2018

📌 Commit b2ed9dd has been approved by QuietMisdreavus,GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 3, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Apr 3, 2018
…isdreavus,GuillaumeGomez

Handle future deprecation annotations

This adds special handling to the `since` parameter of the `deprecated` attribute: in particular, if the `since` version exceeds the version of the compiler, the deprecation notice will not be printed; but a note is added to the documentation stating that the item will be deprecated in a later version.

(I've used `since` for this, rather than adding a new attribute, because it's more seamless and, I feel, intuitive. Plus it involves less code churn.)

![image](https://user-images.githubusercontent.com/3943692/37611317-ef5cdf16-2b99-11e8-8251-e35e8f7b0137.png)
![image](https://user-images.githubusercontent.com/3943692/37611323-f748c2d0-2b99-11e8-966b-11408c73d416.png)

This is a prerequisite for doing things renaming methods in the standard library (e.g. rust-lang#30459). Resolves rust-lang#30785.
bors added a commit that referenced this pull request Apr 3, 2018
Rollup of 14 pull requests

Successful merges:

 - #49179 (Handle future deprecation annotations )
 - #49512 (Add support for variant and types fields for intra links)
 - #49516 (Add missing anchor for union type fields)
 - #49532 (Add test for rustdoc ignore test)
 - #49533 (Add #[must_use] to a few standard library methods)
 - #49570 (avoid IdxSets containing garbage above the universe length)
 - #49594 (Add some performance guidance to std::fs and std::io docs)
 - #49599 (Fix typo)
 - #49603 (Fix url for intra link provided method)
 - #49609 (run-pass/attr-stmt-expr: expand test cases)
 - #49612 (Fix "since" version for getpid feature.)
 - #49618 (Fix build error when compiling libcore for 16bit targets)
 - #49619 (tweak core::fmt docs)
 - #49623 (update mdbook)

Failed merges:
kennytm added a commit to kennytm/rust that referenced this pull request Apr 4, 2018
…isdreavus,GuillaumeGomez

Handle future deprecation annotations

This adds special handling to the `since` parameter of the `deprecated` attribute: in particular, if the `since` version exceeds the version of the compiler, the deprecation notice will not be printed; but a note is added to the documentation stating that the item will be deprecated in a later version.

(I've used `since` for this, rather than adding a new attribute, because it's more seamless and, I feel, intuitive. Plus it involves less code churn.)

![image](https://user-images.githubusercontent.com/3943692/37611317-ef5cdf16-2b99-11e8-8251-e35e8f7b0137.png)
![image](https://user-images.githubusercontent.com/3943692/37611323-f748c2d0-2b99-11e8-966b-11408c73d416.png)

This is a prerequisite for doing things renaming methods in the standard library (e.g. rust-lang#30459). Resolves rust-lang#30785.
bors added a commit that referenced this pull request Apr 4, 2018
Rollup of 25 pull requests

Successful merges:

 - #49179 (Handle future deprecation annotations )
 - #49512 (Add support for variant and types fields for intra links)
 - #49515 (fix targetted value background)
 - #49516 (Add missing anchor for union type fields)
 - #49532 (Add test for rustdoc ignore test)
 - #49533 (Add #[must_use] to a few standard library methods)
 - #49540 (Fix miri Discriminant() for non-ADT)
 - #49559 (Introduce Vec::resize_with method (see #41758))
 - #49570 (avoid IdxSets containing garbage above the universe length)
 - #49577 (Stabilize String::replace_range)
 - #49599 (Fix typo)
 - #49603 (Fix url for intra link provided method)
 - #49607 (Stabilize iterator methods in 1.27)
 - #49609 (run-pass/attr-stmt-expr: expand test cases)
 - #49612 (Fix "since" version for getpid feature.)
 - #49618 (Fix build error when compiling libcore for 16bit targets)
 - #49619 (tweak core::fmt docs)
 - #49637 (Stabilize parent_id())
 - #49639 (Update Cargo)
 - #49628 (Re-write the documentation index)
 - #49594 (Add some performance guidance to std::fs and std::io docs)
 - #49625 (miri: add public alloc_kind accessor)
 - #49634 (Add a test for the fix to issue #43058)
 - #49641 (Regression test for #46314)
 - #49547 (Unignore borrowck test)

Failed merges:
@alexcrichton alexcrichton merged commit b2ed9dd into rust-lang:master Apr 5, 2018
@varkor varkor deleted the future-deprecation branch April 5, 2018 07:51
bors added a commit that referenced this pull request Jun 22, 2018
…petrochenkov

Support future deprecation for rustc_deprecated

Follow-up to #49179 to allow `since` parameters to be set to future versions of Rust and correspondingly to not be treated as deprecated until that version. This is required for #30459 to be completed (though we'll need to wait until this hits beta).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants