Skip to content

Implement a lint for the use of private types in exported type signatures #12595

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

Merged
merged 3 commits into from
Feb 28, 2014

Conversation

huonw
Copy link
Member

@huonw huonw commented Feb 27, 2014

These are types that are in exported type signatures, but are not
exported themselves, e.g.

struct Foo { ... }

pub fn bar() -> Foo { ... }

will warn about the Foo.

Such types are not listed in documentation, and cannot be named outside
the crate in which they are declared, which is very user-unfriendly.

cc #10573.

@huonw
Copy link
Member Author

huonw commented Feb 27, 2014

r? @alexcrichton

A long delayed reimplementation of #11773.

@alexcrichton
Copy link
Member

This is some good work, nice job! Most of my comments are just small things here and there, I think that we'll get a lot of good use cases for this lint once landed because it's warn-by-default.

Travis also has some failures you may be interested in.

@huonw
Copy link
Member Author

huonw commented Feb 27, 2014

Added a new commit addressing everything. Will squash post-re-review.

@alexcrichton
Copy link
Member

r=me, nice job!

huonw added 3 commits March 1, 2014 00:11
These are types that are in exported type signatures, but are not
exported themselves, e.g.

    struct Foo { ... }

    pub fn bar() -> Foo { ... }

will warn about the Foo.

Such types are not listed in documentation, and cannot be named outside
the crate in which they are declared, which is very user-unfriendly.

cc rust-lang#10573
The sync submodule also has a `Condvar` type, and its reexport was
shadowing the `arc` type, making it crate-private.
…laces.

There's a lot of these types in the compiler libraries, and a few of the
older or private stdlib ones. Some types are obviously meant to be
public, others not so much.
bors added a commit that referenced this pull request Feb 28, 2014
These are types that are in exported type signatures, but are not
exported themselves, e.g.

    struct Foo { ... }

    pub fn bar() -> Foo { ... }

will warn about the Foo.

Such types are not listed in documentation, and cannot be named outside
the crate in which they are declared, which is very user-unfriendly.

cc #10573.
@bors bors closed this Feb 28, 2014
@bors bors merged commit 218eae0 into rust-lang:master Feb 28, 2014
@huonw huonw deleted the pub-vis-typ branch June 27, 2014 06:48
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 2, 2024
Modify lint pass note for consistency with the book

This PR:
- removes the note which appears when an early lint pass is created using `cargo dev new_lint`.
- adds a note that encourages contributors to use an early pass unless type information is needed if a late lint pass is created using `cargo dev new_lint`.

Late pass remains the default value if no pass is specified as most lints use late pass.

Closes rust-lang#12595

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants