Skip to content

update privacy checker to work with associated types #22990

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 2 commits into from
Mar 3, 2015

Conversation

japaric
Copy link
Member

@japaric japaric commented Mar 3, 2015

Associated types are now treated as part of the public API by the privacy checker.

If you were exposing a private type in your public API via an associated type, make that type public:

  pub struct PublicType { .. }

- struct Struct { .. }
+ pub struct Struct { .. }

  pub trait PublicTrait {
      type Output;

      fn foo(&self) -> Self::Output;
  }

  impl PublicTrait for PublicType {
      type Output = Struct;

      fn foo(&self) -> Struct {  // `Struct` is part of the public API, it must be marked as `pub`lic
          ..
      }
  }

[breaking-change]


r? @nikomatsakis
closes #22912

@alexcrichton
Copy link
Member

@bors: r+ 89776ae

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 3, 2015
 Associated types are now treated as part of the public API by the privacy checker.

If you were exposing a private type in your public API via an associated type, make that type public:

``` diff
  pub struct PublicType { .. }

- struct Struct { .. }
+ pub struct Struct { .. }

  pub trait PublicTrait {
      type Output;

      fn foo(&self) -> Self::Output;
  }

  impl PublicTrait for PublicType {
      type Output = Struct;

      fn foo(&self) -> Struct {  // `Struct` is part of the public API, it must be marked as `pub`lic
          ..
      }
  }
```

[breaking-change]

---

r? @nikomatsakis
closes rust-lang#22912
@bors bors merged commit 89776ae into rust-lang:master Mar 3, 2015
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.

Associated types lets you expose private types in public signatures (?)
4 participants