Skip to content

Commit 082a076

Browse files
authored
Rollup merge of #65794 - Centril:unimpl-internal, r=varkor
gate rustc_on_unimplemented under rustc_attrs Move `rustc_on_implemented` from the `on_implemented` gate to `rustc_attrs` as it is internal. Closes #29628 r? @varkor
2 parents 3804876 + 1c7595f commit 082a076

17 files changed

+34
-190
lines changed

src/doc/unstable-book/src/language-features/on-unimplemented.md

-154
This file was deleted.

src/liballoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
#![feature(unsize)]
117117
#![feature(unsized_locals)]
118118
#![feature(allocator_internals)]
119-
#![feature(on_unimplemented)]
119+
#![cfg_attr(bootstrap, feature(on_unimplemented))]
120120
#![feature(rustc_const_unstable)]
121121
#![feature(slice_partition_dedup)]
122122
#![feature(maybe_uninit_extra, maybe_uninit_slice)]

src/libcore/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
#![feature(nll)]
9090
#![feature(exhaustive_patterns)]
9191
#![feature(no_core)]
92-
#![feature(on_unimplemented)]
92+
#![cfg_attr(bootstrap, feature(on_unimplemented))]
9393
#![feature(optin_builtin_traits)]
9494
#![feature(prelude_import)]
9595
#![feature(repr_simd, platform_intrinsics)]

src/librustc/error_codes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ position that needs that trait. For example, when the following code is
607607
compiled:
608608
609609
```compile_fail
610-
#![feature(on_unimplemented)]
610+
#![feature(rustc_attrs)]
611611
612612
fn foo<T: Index<u8>>(x: T){}
613613
@@ -639,7 +639,7 @@ position that needs that trait. For example, when the following code is
639639
compiled:
640640
641641
```compile_fail
642-
#![feature(on_unimplemented)]
642+
#![feature(rustc_attrs)]
643643
644644
fn foo<T: Index<u8>>(x: T){}
645645
@@ -669,7 +669,7 @@ position that needs that trait. For example, when the following code is
669669
compiled:
670670
671671
```compile_fail
672-
#![feature(on_unimplemented)]
672+
#![feature(rustc_attrs)]
673673
674674
fn foo<T: Index<u8>>(x: T){}
675675

src/libstd/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
#![feature(never_type)]
285285
#![feature(nll)]
286286
#![cfg_attr(bootstrap, feature(non_exhaustive))]
287-
#![feature(on_unimplemented)]
287+
#![cfg_attr(bootstrap, feature(on_unimplemented))]
288288
#![feature(optin_builtin_traits)]
289289
#![feature(panic_info_message)]
290290
#![feature(panic_internals)]

src/libsyntax/feature_gate/active.rs

-3
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ declare_features! (
134134
/// Allows using `rustc_*` attributes (RFC 572).
135135
(active, rustc_attrs, "1.0.0", Some(29642), None),
136136

137-
/// Allows using `#[on_unimplemented(..)]` on traits.
138-
(active, on_unimplemented, "1.0.0", Some(29628), None),
139-
140137
/// Allows using the `box $expr` syntax.
141138
(active, box_syntax, "1.0.0", Some(49733), None),
142139

src/libsyntax/feature_gate/builtin_attrs.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ macro_rules! experimental {
166166
}
167167

168168
const IMPL_DETAIL: &str = "internal implementation detail";
169-
const INTERAL_UNSTABLE: &str = "this is an internal attribute that will never be stable";
169+
const INTERNAL_UNSTABLE: &str = "this is an internal attribute that will never be stable";
170170

171171
pub type BuiltinAttribute = (Symbol, AttributeType, AttributeTemplate, AttributeGate);
172172

@@ -418,14 +418,14 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
418418
linkage, Whitelisted, template!(NameValueStr: "external|internal|..."),
419419
"the `linkage` attribute is experimental and not portable across platforms",
420420
),
421-
rustc_attr!(rustc_std_internal_symbol, Whitelisted, template!(Word), INTERAL_UNSTABLE),
421+
rustc_attr!(rustc_std_internal_symbol, Whitelisted, template!(Word), INTERNAL_UNSTABLE),
422422

423423
// ==========================================================================
424424
// Internal attributes, Macro related:
425425
// ==========================================================================
426426

427427
rustc_attr!(rustc_builtin_macro, Whitelisted, template!(Word), IMPL_DETAIL),
428-
rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), INTERAL_UNSTABLE),
428+
rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), INTERNAL_UNSTABLE),
429429
rustc_attr!(
430430
rustc_macro_transparency, Whitelisted,
431431
template!(NameValueStr: "transparent|semitransparent|opaque"),
@@ -436,25 +436,24 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
436436
// Internal attributes, Diagnostics related:
437437
// ==========================================================================
438438

439-
gated!(
439+
rustc_attr!(
440440
rustc_on_unimplemented, Whitelisted,
441441
template!(
442442
List: r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#,
443443
NameValueStr: "message"
444444
),
445-
on_unimplemented,
446-
experimental!(rustc_on_unimplemented),
445+
INTERNAL_UNSTABLE
447446
),
448447
// Whitelists "identity-like" conversion methods to suggest on type mismatch.
449-
rustc_attr!(rustc_conversion_suggestion, Whitelisted, template!(Word), INTERAL_UNSTABLE),
448+
rustc_attr!(rustc_conversion_suggestion, Whitelisted, template!(Word), INTERNAL_UNSTABLE),
450449

451450
// ==========================================================================
452451
// Internal attributes, Const related:
453452
// ==========================================================================
454453

455454
rustc_attr!(rustc_promotable, Whitelisted, template!(Word), IMPL_DETAIL),
456455
rustc_attr!(rustc_allow_const_fn_ptr, Whitelisted, template!(Word), IMPL_DETAIL),
457-
rustc_attr!(rustc_args_required_const, Whitelisted, template!(List: "N"), INTERAL_UNSTABLE),
456+
rustc_attr!(rustc_args_required_const, Whitelisted, template!(List: "N"), INTERNAL_UNSTABLE),
458457

459458
// ==========================================================================
460459
// Internal attributes, Layout related:

src/libsyntax/feature_gate/removed.rs

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ declare_features! (
9999
/// + `__register_diagnostic`
100100
/// +`__build_diagnostic_array`
101101
(removed, rustc_diagnostic_macros, "1.38.0", None, None, None),
102+
/// Allows using `#[on_unimplemented(..)]` on traits.
103+
/// (Moved to `rustc_attrs`.)
104+
(removed, on_unimplemented, "1.40.0", None, None, None),
102105

103106
// -------------------------------------------------------------------------
104107
// feature-group-end: removed features

src/test/incremental/issue-59523-on-implemented-is-not-unused.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// revisions: cfail1 cfail2
66
// build-pass (FIXME(62277): could be check-pass?)
77

8-
#![feature(on_unimplemented)]
8+
#![feature(rustc_attrs)]
99
#![deny(unused_attributes)]
1010

1111
#[rustc_on_unimplemented = "invalid"]

src/test/ui/feature-gates/feature-gate-on-unimplemented.rs

-9
This file was deleted.

src/test/ui/on-unimplemented/bad-annotation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ignore-tidy-linelength
22

3-
#![feature(on_unimplemented)]
3+
#![feature(rustc_attrs)]
44

55
#![allow(unused)]
66

src/test/ui/on-unimplemented/expected-comma-found-token.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// access to the variable, whether that mutable access be used
33
// for direct assignment or for taking mutable ref. Issue #6801.
44

5-
#![feature(on_unimplemented)]
5+
#![feature(rustc_attrs)]
66

77
#[rustc_on_unimplemented(
88
message="the message"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test that `#[rustc_on_unimplemented]` is gated by `rustc_attrs` feature gate.
2+
3+
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}`"]
4+
//~^ ERROR this is an internal attribute that will never be stable
5+
trait Foo<Bar>
6+
{}
7+
8+
fn main() {}

src/test/ui/feature-gates/feature-gate-on-unimplemented.stderr src/test/ui/on-unimplemented/feature-gate-on-unimplemented.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0658]: the `#[rustc_on_unimplemented]` attribute is an experimental feature
2-
--> $DIR/feature-gate-on-unimplemented.rs:4:1
1+
error[E0658]: this is an internal attribute that will never be stable
2+
--> $DIR/feature-gate-on-unimplemented.rs:3:1
33
|
44
LL | #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}`"]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: for more information, see https://github.com/rust-lang/rust/issues/29628
8-
= help: add `#![feature(on_unimplemented)]` to the crate attributes to enable
7+
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
8+
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
99

1010
error: aborting due to previous error
1111

src/test/ui/on-unimplemented/multiple-impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test if the on_unimplemented message override works
22

3-
#![feature(on_unimplemented)]
3+
#![feature(rustc_attrs)]
44

55

66
struct Foo<T>(T);

src/test/ui/on-unimplemented/on-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test if the on_unimplemented message override works
22

3-
#![feature(on_unimplemented)]
3+
#![feature(rustc_attrs)]
44

55

66
#[rustc_on_unimplemented = "invalid"]

src/test/ui/on-unimplemented/on-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ignore-tidy-linelength
22

3-
#![feature(on_unimplemented)]
3+
#![feature(rustc_attrs)]
44

55
pub mod Bar {
66
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}` in `{Foo}`"]

0 commit comments

Comments
 (0)