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

Fix build on nightly rustc #13

Merged
merged 1 commit into from
May 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 16 additions & 23 deletions src/intern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,38 @@ use std::fmt;
use std::ascii::AsciiExt;
use string_intern::{Symbol, Validator};

mod private {
// These structs are implementation details.
pub struct UpstreamValidator;
pub struct HandlerValidator;
pub struct DiskPoolValidator;
pub struct SessionPoolValidator;
pub struct SessionIdValidator;
pub struct TopicValidator;
pub struct LatticeNamespaceValidator;
pub struct LatticeKeyValidator;
pub struct LatticeVarValidator;
pub struct LdapValidator;
pub struct AuthorizerValidator;
pub struct NetworkValidator;
}
use self::private::*;

struct UpstreamValidator;
pub type Upstream = Symbol<UpstreamValidator>;

struct HandlerValidator;
pub type HandlerName = Symbol<HandlerValidator>;

struct DiskPoolValidator;
pub type DiskPoolName = Symbol<DiskPoolValidator>;

struct SessionPoolValidator;
pub type SessionPoolName = Symbol<SessionPoolValidator>;

struct SessionIdValidator;
pub type SessionId = Symbol<SessionIdValidator>;

struct TopicValidator;
pub type Topic = Symbol<TopicValidator>;

struct LatticeNamespaceValidator;
/// Name of the lattice namespace (set of keys)
pub type Lattice = Symbol<LatticeNamespaceValidator>;

struct LatticeKeyValidator;
/// Key in lattice namespace (set of CRDT variables),
/// logically should validate same as Topic
pub type LatticeKey = Symbol<LatticeKeyValidator>;

struct LatticeVarValidator;
/// CRDT variable name in lattice
pub type LatticeVar = Symbol<LatticeVarValidator>;

struct LdapValidator;
pub type LdapUpstream = Symbol<LdapValidator>;

struct AuthorizerValidator;
pub type Authorizer = Symbol<AuthorizerValidator>;

struct NetworkValidator;
pub type Network = Symbol<NetworkValidator>;

quick_error! {
Expand Down
5 changes: 0 additions & 5 deletions src/main-dev.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// I don't see **any** reason for this waring to enabled. We only build binary
// and most of these warnings do not apply to real visibility of types inside
// the crate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is that private types cannot be leaked from modules they are defined in, so if you see a private type you have a guarantee that it's restricted to this module.
These crate wants to leak private types like UpstreamValidator from their module, therefore the error.

If UpstreamValidator and friends are intended to be implementation details (1), but still leaked in some form (2) (e.g. through aliases), they have to be marked as pub (because 2), but made "unnameable" by placing them into a private module (because 1).
(The tracking issue for private_in_public contains a similar example.)

#![allow(private_in_public)]

#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
#[macro_use] extern crate matches;
Expand Down
5 changes: 0 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// I don't see **any** reason for this warning to be enabled. We only build binary
// and most of these warnings do not apply to real visibility of types inside
// the crate
#![allow(private_in_public)]

#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
#[macro_use] extern crate matches;
Expand Down