[RFC 2397] Initial implementation
This commit is contained in:
parent
c54c8cbac8
commit
c43faf110d
7 changed files with 69 additions and 0 deletions
|
@ -374,6 +374,8 @@ declare_features! (
|
||||||
(active, deprecated_safe, "1.61.0", Some(94978), None),
|
(active, deprecated_safe, "1.61.0", Some(94978), None),
|
||||||
/// Allows having using `suggestion` in the `#[deprecated]` attribute.
|
/// Allows having using `suggestion` in the `#[deprecated]` attribute.
|
||||||
(active, deprecated_suggestion, "1.61.0", Some(94785), None),
|
(active, deprecated_suggestion, "1.61.0", Some(94785), None),
|
||||||
|
/// Controls errors in trait implementations.
|
||||||
|
(active, do_not_recommend, "1.67.0", Some(51992), None),
|
||||||
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.
|
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.
|
||||||
(active, doc_auto_cfg, "1.58.0", Some(43781), None),
|
(active, doc_auto_cfg, "1.58.0", Some(43781), None),
|
||||||
/// Allows `#[doc(cfg(...))]`.
|
/// Allows `#[doc(cfg(...))]`.
|
||||||
|
|
|
@ -487,6 +487,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||||
experimental!(collapse_debuginfo)
|
experimental!(collapse_debuginfo)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// RFC 2397
|
||||||
|
gated!(do_not_recommend, Normal, template!(Word), WarnFollowing, experimental!(do_not_recommend)),
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Internal attributes: Stability, deprecation, and unsafe:
|
// Internal attributes: Stability, deprecation, and unsafe:
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
|
@ -613,6 +613,7 @@ symbols! {
|
||||||
dispatch_from_dyn,
|
dispatch_from_dyn,
|
||||||
div,
|
div,
|
||||||
div_assign,
|
div_assign,
|
||||||
|
do_not_recommend,
|
||||||
doc,
|
doc,
|
||||||
doc_alias,
|
doc_alias,
|
||||||
doc_auto_cfg,
|
doc_auto_cfg,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#![feature(do_not_recommend)]
|
||||||
|
|
||||||
|
pub trait Foo {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Foo for i32 {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Bar {
|
||||||
|
}
|
||||||
|
|
||||||
|
#[do_not_recommend]
|
||||||
|
impl<T: Foo> Bar for T {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn stuff<T: Bar>(_: T) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
stuff(1u8);
|
||||||
|
//~^ the trait bound `u8: Foo` is not satisfied
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
error[E0277]: the trait bound `u8: Foo` is not satisfied
|
||||||
|
--> $DIR/feature-gate-do_not_recommend.rs:19:11
|
||||||
|
|
|
||||||
|
LL | stuff(1u8);
|
||||||
|
| ----- ^^^ the trait `Foo` is not implemented for `u8`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= help: the trait `Foo` is implemented for `i32`
|
||||||
|
note: required for `u8` to implement `Bar`
|
||||||
|
--> $DIR/feature-gate-do_not_recommend.rs:13:14
|
||||||
|
|
|
||||||
|
LL | impl<T: Foo> Bar for T {
|
||||||
|
| ^^^ ^
|
||||||
|
note: required by a bound in `stuff`
|
||||||
|
--> $DIR/feature-gate-do_not_recommend.rs:16:13
|
||||||
|
|
|
||||||
|
LL | fn stuff<T: Bar>(_: T) {}
|
||||||
|
| ^^^ required by this bound in `stuff`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
|
@ -0,0 +1,7 @@
|
||||||
|
#[do_not_recommend]
|
||||||
|
//~^ ERROR the `#[do_not_recommend]` attribute is an experimental feature
|
||||||
|
trait Foo {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
error[E0658]: the `#[do_not_recommend]` attribute is an experimental feature
|
||||||
|
--> $DIR/unstable-feature.rs:1:1
|
||||||
|
|
|
||||||
|
LL | #[do_not_recommend]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #51992 <https://github.com/rust-lang/rust/issues/51992> for more information
|
||||||
|
= help: add `#![feature(do_not_recommend)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0658`.
|
Loading…
Add table
Add a link
Reference in a new issue