@@ -121,38 +121,35 @@ Always ping @rust-lang/wg-const-eval if you are adding more
121
121
122
122
## staged_api
123
123
124
- Any crate that uses the ` stable ` , ` unstable ` , or ` rustc_deprecated ` attributes
125
- must include the ` #![feature(staged_api)] ` attribute on the crate.
124
+ Any crate that uses the ` stable ` or ` unstable ` attributes must include the
125
+ ` #![feature(staged_api)] ` attribute on the crate.
126
126
127
- ## rustc_deprecated
127
+ ## deprecated
128
128
129
- The deprecation system shares the same infrastructure as the stable/unstable
130
- attributes. The ` rustc_deprecated ` attribute is similar to the [ ` deprecated `
131
- attribute] . It was previously called ` deprecated ` , but was split off when
132
- ` deprecated ` was stabilized. The ` deprecated ` attribute cannot be used in a
133
- ` staged_api ` crate, ` rustc_deprecated ` must be used instead. The deprecated
134
- item must also have a ` stable ` or ` unstable ` attribute.
129
+ Deprecations in the standard library are nearly identical to deprecations in
130
+ user code. When ` #[deprecated] ` is used on an item, it must also have a ` stable `
131
+ or ` unstable ` attribute.
135
132
136
- ` rustc_deprecated ` has the following form:
133
+ ` deprecated ` has the following form:
137
134
138
135
``` rust,ignore
139
- #[rustc_deprecated (
136
+ #[deprecated (
140
137
since = "1.38.0",
141
- reason = "explanation for deprecation",
138
+ note = "explanation for deprecation",
142
139
suggestion = "other_function"
143
140
)]
144
141
```
145
142
146
143
The ` suggestion ` field is optional. If given, it should be a string that can be
147
144
used as a machine-applicable suggestion to correct the warning. This is
148
145
typically used when the identifier is renamed, but no other significant changes
149
- are necessary.
146
+ are necessary. When the ` suggestion ` field is used, you need to have
147
+ ` #![feature(deprecated_suggestion)] ` at the crate root.
150
148
151
- Another difference from the ` deprecated ` attribute is that the ` since ` field is
152
- actually checked against the current version of ` rustc ` . If ` since ` is in a
153
- future version, then the ` deprecated_in_future ` lint is triggered which is
154
- default ` allow ` , but most of the standard library raises it to a warning with
149
+ Another difference from user code is that the ` since ` field is actually checked
150
+ against the current version of ` rustc ` . If ` since ` is in a future version, then
151
+ the ` deprecated_in_future ` lint is triggered which is default ` allow ` , but most
152
+ of the standard library raises it to a warning with
155
153
` #![warn(deprecated_in_future)] ` .
156
154
157
- [ `deprecated` attribute ] : https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
158
155
[ blog ] : https://www.ralfj.de/blog/2018/07/19/const.html
0 commit comments