Skip to content

lazy_type_alias: breaks visibility: private type alias .. in public interface #114213

Closed as not planned
@matthiaskrgr

Description

@matthiaskrgr

I tried this code:

#![allow(nonstandard_style)]
#![allow(clippy::missing_safety_doc, unused)]

type pid_t = i32;
pub unsafe fn getpid() -> pid_t {
    pid_t::from(0)
}
pub fn getpid_SAFE_TRUTH() -> pid_t {
    unsafe { getpid() }
}

without `-Zcrate-attr=feature(lazy_type_alias)´: no warnings

with -Zcrate-attr=feature(lazy_type_alias):

error[E0446]: private type alias `pid_t` in public interface
 --> src/tools/clippy/tests/ui/auxiliary/extern_fake_libc.rs:5:1
  |
4 | type pid_t = i32;
  | ---------- `pid_t` declared as private
5 | pub unsafe fn getpid() -> pid_t {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type alias

error[E0446]: private type alias `pid_t` in public interface
 --> src/tools/clippy/tests/ui/auxiliary/extern_fake_libc.rs:8:1
  |
4 | type pid_t = i32;
  | ---------- `pid_t` declared as private
...
8 | pub fn getpid_SAFE_TRUTH() -> pid_t {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type alias

error: aborting due to 2 previous errors
rustc 1.73.0-nightly (04abc370b 2023-07-28)
binary: rustc
commit-hash: 04abc370b9f3855b28172b65a7f7d5a433f41412
commit-date: 2023-07-28
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-visibilityArea: Visibility / privacyC-bugCategory: This is a bug.F-lazy_type_alias`#![feature(lazy_type_alias)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions