Skip to content

deprecate attribute: renamed reason to note #1425

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 26 commits into from
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8bf55ca
new RFC: deprecation
llogiq Jun 3, 2015
cfc7d64
word wrapped, thanks to steveklabnik
llogiq Jun 3, 2015
20666af
clarified how cargo gets rust version
llogiq Jun 3, 2015
fb16b8a
Merge branch 'master' of https://github.com/rust-lang/rfcs
llogiq Jun 4, 2015
873f241
Added paragraph on how rustc should handle future target versions
llogiq Jun 4, 2015
0754c8c
Fleshed out the Motivation section a bit
llogiq Jun 10, 2015
984cc70
added future/legacy flags to alternatives
llogiq Jun 11, 2015
f5c7c56
More explanation about security issues
llogiq Jun 11, 2015
5ffff4a
Clarified the paragraph about cargo/crates.io, also added Policy section
llogiq Jun 15, 2015
1b0fe8c
clarification on insecurity and future-proofing
llogiq Jun 15, 2015
704c985
added Cargo.toml-based target to Alternatives section
llogiq Jun 17, 2015
afb54c9
Almost complete rewrite.
llogiq Jun 19, 2015
045c03e
Renamed --target to --target-version, reworded Cargo entry default
llogiq Jun 25, 2015
2e44ed0
added open question about cargo and detailed design about feature fla…
llogiq Jun 25, 2015
97b32e8
made 'rust' a package attribute instead of a pseudo-dependency
llogiq Jun 26, 2015
62bda96
formatting improvements
llogiq Jun 28, 2015
b8f1490
Added previous proposal to alternatives, added bikeshedding to unreso…
llogiq Jul 4, 2015
d1e2725
Merge branch 'master' of https://github.com/rust-lang/rfcs
llogiq Jul 4, 2015
955430b
#[insecure]-flagging removed from RFC, added some open questions (as …
llogiq Jul 9, 2015
22108ae
Merge branch 'master' of https://github.com/rust-lang/rfcs
llogiq Jul 9, 2015
db74125
Merge branch 'master' of https://github.com/rust-lang/rfcs
llogiq Jul 29, 2015
ea5f47a
Merge branch 'deprecate' of https://github.com/llogiq/rfcs
llogiq Oct 29, 2015
0731a9f
Merge branch 'master' of https://github.com/rust-lang/rfcs
llogiq Oct 29, 2015
be59380
improvements thanks to brson's comments
llogiq Oct 29, 2015
f51edea
Merge branch 'master' of https://github.com/rust-lang/rfcs
llogiq Dec 23, 2015
9aadc59
renamed reason to note (as discussed before)
llogiq Dec 23, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions text/1270-deprecation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Summary

This RFC proposes to allow library authors to use a `#[deprecated]` attribute,
with optional `since = "`*version*`"` and `reason = "`*free text*`"`fields. The
with optional `since = "`*version*`"` and `note = "`*free text*`"`fields. The
compiler can then warn on deprecated items, while `rustdoc` can document their
deprecation accordingly.

Expand All @@ -32,12 +32,12 @@ possible fields are optional:
deprecating the item, following the semver scheme. Rustc does not know about
versions, thus the content of this field is not checked (but will be by external
lints, e.g. [rust-clippy](https://github.com/Manishearth/rust-clippy).
* `reason` should contain a human-readable string outlining the reason for
deprecating the item. While this field is not required, library authors are
strongly advised to make use of it to convey the reason for the deprecation to
users of their library. The string is interpreted as plain unformatted text
(for now) so that rustdoc can include it in the item's documentation without
messing up the formatting.
* `note` should contain a human-readable string outlining the reason for
deprecating the item and/or an alternative to use. While this field is not
required, library authors are strongly advised to make use of it to convey the
reason for the deprecation to users of their library. The string is interpreted
as plain unformatted text (for now) so that rustdoc can include it in the
item's documentation without messing up the formatting.

On use of a *deprecated* item, `rustc` will `warn` of the deprecation. Note
that during Cargo builds, warnings on dependencies get silenced. While this has
Expand All @@ -51,7 +51,7 @@ to warn on use of deprecated items in library crates, however this is outside
the scope of this RFC.

`rustdoc` will show deprecation on items, with a `[deprecated]` box that may
optionally show the version and reason where available.
optionally show the version and note where available.

The language reference will be extended to describe this feature as outlined
in this RFC. Authors shall be advised to leave their users enough time to react
Expand All @@ -75,7 +75,7 @@ prefix to the `Foo` type:
extern crate rust_foo;

#[deprecated(since = "0.2.1", use="rust_foo::Foo",
reason="The rust_foo version is more advanced, and this crates' will likely be discontinued")]
note="The rust_foo version is more advanced, and this crates' will likely be discontinued")]
struct Foo { .. }
```

Expand Down Expand Up @@ -106,11 +106,10 @@ deprecation checks.

* Do nothing
* make the `since` field required and check that it's a single version
* require either `reason` or `use` be present
* `reason` could include markdown formatting
* rename the `reason` field to `note` to clarify it's broader usage.
* add a `note` field and make `reason` a field with specific meaning, perhaps
even predefine a number of valid reason strings, as JEP277 currently does
* require either `note` or `use` be present
* `note` could include markdown formatting
* add a `reason` field with specific meaning, perhaps even predefine a number
of valid reason strings, as JEP277 currently does
* Add a `use` field containing a plain text of what to use instead
* Add a `use` field containing a path to some function, type, etc. to replace
the current feature. Currently with the rustc-private feature, people are
Expand Down