Skip to content

Commit e6e254e

Browse files
committed
Add internal_features lint
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
1 parent ec08074 commit e6e254e

File tree

10 files changed

+12
-0
lines changed

10 files changed

+12
-0
lines changed

alloc/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
#![warn(missing_docs)]
8989
#![allow(explicit_outlives_requirements)]
9090
#![warn(multiple_supertrait_upcastable)]
91+
#![cfg_attr(not(bootstrap), allow(internal_features))]
9192
//
9293
// Library features:
9394
// tidy-alphabetical-start

core/src/intrinsics/mir.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//!
1515
//! ```rust
1616
//! #![feature(core_intrinsics, custom_mir)]
17+
#![cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")]
1718
//!
1819
//! use core::intrinsics::mir::*;
1920
//!
@@ -63,6 +64,7 @@
6364
//!
6465
//! ```rust
6566
//! #![feature(core_intrinsics, custom_mir)]
67+
#![cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")]
6668
//!
6769
//! use core::intrinsics::mir::*;
6870
//!
@@ -315,6 +317,7 @@ define!(
315317
/// # Examples
316318
///
317319
/// ```rust
320+
#[cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")]
318321
/// #![feature(custom_mir, core_intrinsics)]
319322
///
320323
/// use core::intrinsics::mir::*;

core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
#![allow(explicit_outlives_requirements)]
9797
#![allow(incomplete_features)]
9898
#![warn(multiple_supertrait_upcastable)]
99+
#![cfg_attr(not(bootstrap), allow(internal_features))]
99100
//
100101
// Library features:
101102
// tidy-alphabetical-start

panic_abort/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#![feature(staged_api)]
1515
#![feature(rustc_attrs)]
1616
#![feature(c_unwind)]
17+
#![cfg_attr(not(bootstrap), allow(internal_features))]
1718

1819
#[cfg(target_os = "android")]
1920
mod android;

panic_unwind/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#![feature(c_unwind)]
2727
// `real_imp` is unused with Miri, so silence warnings.
2828
#![cfg_attr(miri, allow(dead_code))]
29+
#![cfg_attr(not(bootstrap), allow(internal_features))]
2930

3031
use alloc::boxed::Box;
3132
use core::any::Any;

proc_macro/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#![feature(min_specialization)]
3434
#![feature(strict_provenance)]
3535
#![recursion_limit = "256"]
36+
#![cfg_attr(not(bootstrap), allow(internal_features))]
3637

3738
#[unstable(feature = "proc_macro_internals", issue = "27812")]
3839
#[doc(hidden)]

profiler_builtins/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
issue = "none"
88
)]
99
#![allow(unused_features)]
10+
#![cfg_attr(not(bootstrap), allow(internal_features))]
1011
#![feature(staged_api)]

std/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@
220220
#![warn(missing_debug_implementations)]
221221
#![allow(explicit_outlives_requirements)]
222222
#![allow(unused_lifetimes)]
223+
#![cfg_attr(not(bootstrap), allow(internal_features))]
223224
#![deny(rustc::existing_doc_keyword)]
224225
#![deny(fuzzy_provenance_casts)]
225226
// Ensure that std can be linked against panic_abort despite compiled with `-C panic=unwind`

test/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#![feature(process_exitcode_internals)]
2222
#![feature(panic_can_unwind)]
2323
#![feature(test)]
24+
#![cfg_attr(not(bootstrap), allow(internal_features))]
2425

2526
// Public reexports
2627
pub use self::bench::{black_box, Bencher};

unwind/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![feature(c_unwind)]
66
#![feature(cfg_target_abi)]
77
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
8+
#![cfg_attr(not(bootstrap), allow(internal_features))]
89

910
cfg_if::cfg_if! {
1011
if #[cfg(target_env = "msvc")] {

0 commit comments

Comments
 (0)