Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const generic ty's do not get hard errors for privacy violations #111939

Closed
BoxyUwU opened this issue May 25, 2023 · 1 comment
Closed

const generic ty's do not get hard errors for privacy violations #111939

BoxyUwU opened this issue May 25, 2023 · 1 comment
Labels
A-resolve Area: Name resolution C-bug Category: This is a bug. F-adt_const_params `#![feature(adt_const_params)]` T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@BoxyUwU
Copy link
Member

BoxyUwU commented May 25, 2023

I tried this code:

#![feature(adt_const_params)]

#[derive(Eq, PartialEq)]
struct Foo;

pub fn bar<const N: Foo>() {}

I expected to see this happen: it error, Foo is a private type in a public signature

Instead, this happened:
It just gives a warning, since adt_const_params is unstable we can make this a hard error

warning: private type `Foo` in public interface (error E0446)
 --> src/lib.rs:6:1
  |
6 | pub fn bar<const N: Foo>() {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, [see issue #34537 <https://github.com/rust-lang/rust/issues/34537>](https://github.com/rust-lang/rust/issues/34537)
  = note: `#[warn(private_in_public)]` on by default

Meta

rustc --version --verbose:

Nightly channel

Build using the Nightly version: 1.71.0-nightly

(2023-05-23 5ea3f0ae08c07472239a)
Backtrace

<backtrace>

@BoxyUwU BoxyUwU added A-resolve Area: Name resolution C-bug Category: This is a bug. F-adt_const_params `#![feature(adt_const_params)]` T-types Relevant to the types team, which will review and decide on the PR/issue. labels May 25, 2023
@Noratrieb
Copy link
Member

Noratrieb commented May 26, 2023

since rust-lang/rfcs#2145 (tracking issue #48054) the plan is to move away from hard errors I think, cc @petrochenkov

@BoxyUwU BoxyUwU closed this as completed May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution C-bug Category: This is a bug. F-adt_const_params `#![feature(adt_const_params)]` T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants