Skip to content

Commit

Permalink
privacy: Stabilize lint unnameable_types
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jan 19, 2024
1 parent 88189a7 commit f8d62a8
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 27 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ declare_features! (
(accepted, type_alias_enum_variants, "1.37.0", Some(49683)),
/// Allows macros to appear in the type position.
(accepted, type_macros, "1.13.0", Some(27245)),
/// Allows using type privacy lints (`private_interfaces`, `private_bounds`, `unnameable_types`).
(accepted, type_privacy_lints, "CURRENT_RUSTC_VERSION", Some(48054)),
/// Allows `const _: TYPE = VALUE`.
(accepted, underscore_const_names, "1.37.0", Some(54912)),
/// Allows `use path as _;` and `extern crate c as _;`.
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,6 @@ declare_features! (
/// Allows creation of instances of a struct by moving fields that have
/// not changed from prior instances of the same struct (RFC #2528)
(unstable, type_changing_struct_update, "1.58.0", Some(86555)),
/// Allows using type privacy lints (`private_interfaces`, `private_bounds`, `unnameable_types`).
(unstable, type_privacy_lints, "1.72.0", Some(48054)),
/// Enables rustc to generate code that instructs libstd to NOT ignore SIGPIPE.
(unstable, unix_sigpipe, "1.65.0", Some(97889)),
/// Allows unnamed fields of struct and union type
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4395,7 +4395,6 @@ declare_lint! {
/// ### Example
///
/// ```rust,compile_fail
/// # #![feature(type_privacy_lints)]
/// # #![allow(unused)]
/// #![deny(unnameable_types)]
/// mod m {
Expand All @@ -4415,7 +4414,6 @@ declare_lint! {
pub UNNAMEABLE_TYPES,
Allow,
"effective visibility of a type is larger than the area in which it can be named",
@feature_gate = sym::type_privacy_lints;
}

declare_lint! {
Expand Down
4 changes: 0 additions & 4 deletions tests/ui/feature-gates/feature-gate-type_privacy_lints.rs

This file was deleted.

14 changes: 0 additions & 14 deletions tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr

This file was deleted.

1 change: 0 additions & 1 deletion tests/ui/privacy/unnameable_types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(type_privacy_lints)]
#![deny(unnameable_types)]

mod m {
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/privacy/unnameable_types.stderr
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error: struct `PubStruct` is reachable but cannot be named
--> $DIR/unnameable_types.rs:5:5
--> $DIR/unnameable_types.rs:4:5
|
LL | pub struct PubStruct(pub i32);
| ^^^^^^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
|
note: the lint level is defined here
--> $DIR/unnameable_types.rs:2:9
--> $DIR/unnameable_types.rs:1:9
|
LL | #![deny(unnameable_types)]
| ^^^^^^^^^^^^^^^^

error: enum `PubE` is reachable but cannot be named
--> $DIR/unnameable_types.rs:7:5
--> $DIR/unnameable_types.rs:6:5
|
LL | pub enum PubE {
| ^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`

error: trait `PubTr` is reachable but cannot be named
--> $DIR/unnameable_types.rs:11:5
--> $DIR/unnameable_types.rs:10:5
|
LL | pub trait PubTr {
| ^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
Expand Down

0 comments on commit f8d62a8

Please sign in to comment.