privacy: Fix type privacy holes when it doesn't cause too much breakage#152543
privacy: Fix type privacy holes when it doesn't cause too much breakage#152543petrochenkov wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
@bors try |
privacy: Fix type privacy holes when it doesn't cause too much breakage
This comment has been minimized.
This comment has been minimized.
|
TODO: |
|
r? @fmease rustbot has assigned @fmease. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
|
Crater results are basically the same as #146470 without the second commit (see e.g. #146470 (comment)). |
|
Previous FCP - #146470 (comment). |
|
We talked about this in the lang call last week. @petrochenkov, it'd be helpful to us to have a brief write-up of what's being proposed here and what's changed since our FCP in #146470 (comment). |
Nothing is changed since the FCP in #146470 (comment). |
|
The previous summary (#146470 (comment)) is still relevant, except user-written private bounds on associated types are not turned into an error due to the amount breakage. pub trait PubTrait {
fn foo1() -> impl PrivTrait; // error now
fn foo2() -> impl PubTrait<PrivType>; // error now
type A1: PrivTrait; // not error, too much breakage (but reports `private_bounds` lint)
type A2: PubTrait<PrivType>; // not error, too much breakage (but reports `private_bounds` lint)
} |
|
Thanks for that. For my part, I'm still motivated to fix the asymmetry with RPIT, so: @rfcbot fcp merge lang It is a bit inelegant that we're left, for now, with an asymmetry between RPITIT and associated types. If we were to turn out to need this space, e.g., to make a future feature sound, we'd need to fix that. |
|
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
|
Making RPITIT match the RPIT behaviour makes sense to me. (TBH it's not obvious to me that private bounds on an associated type are even a "problem" that we'd need to fix, but now that this isn't changing that, sure, happy to make it consistent in function return position. Especially if the public trait is sealed, having various non-public bounds on things doesn't seem unreasonable.) @rfcbot reviewed |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
Soooooo I still feel like I am missing a mental model for what we are attempting to achieve with our rules around privacy and private traits. It makes all of these changes feel kind of random to me. That said, I think we previously decided to move forward here, and this seems consistent with that, and RPITIT/RPIT consistency is good, and it seems like this will give us room to make more decisions in the future, so.... @rfcbot reviewed |
View all comments
A subset of #146470.
Private types in RPITITs now report hard errors.
Private types in bounds of associated types still only report the
private_boundslint due to unacceptable amount of breakage (#146470 (comment)).Closes #144139