@@ -151,7 +151,7 @@ mod m {
151
151
let x = m :: leak ();
152
152
```
153
153
154
- The rule behind private-in-public rules is very simple, if some type has
154
+ The logic behind private-in-public rules is very simple, if some type has
155
155
visibility ` vis_type ` then it cannot be used in interfaces of items with
156
156
visibilities ` vis_interface ` where ` vis_interface > vis_type ` .
157
157
In particular, this code is illegal
@@ -197,7 +197,7 @@ Meet reachability-based private-in-public *lints*!
197
197
198
198
Effective visibility of an item is how far it's actually reexported or leaked
199
199
through other means, like return types.
200
- Effective visibility can never be larger than nominal visibility (e.g . what
200
+ Effective visibility can never be larger than nominal visibility (i.e . what
201
201
` pub ` annotation says), but it can be smaller.
202
202
203
203
For example, in the ` outer ` /` inner ` example nominal visibility of ` f ` is ` pub ` ,
@@ -256,8 +256,8 @@ Provisional name for the lint - `private_bounds`.
256
256
Consider this code
257
257
``` rust
258
258
mod m {
259
- // `S` has public nominal visibility,
260
- // but its effective visibility is `pub(in m)`
259
+ // `S` has public nominal and effective visibility,
260
+ // but it can't be *named* outside of `m::super`.
261
261
pub struct S ;
262
262
}
263
263
@@ -271,7 +271,7 @@ The "Voldemort type" (or, more often, "Voldemort trait") pattern has legitimate
271
271
uses, but often it's just an oversight and ` S ` is supposed to be reexported and
272
272
nameable from outer modules.
273
273
The lint is supposed to report items for which effective visibility is larger
274
- than area in which they can be named.
274
+ than the area in which they can be named.
275
275
This lint is new and doesn't replace private-in-public errors, but it provides
276
276
checking that many people * expected* from private-in-public.
277
277
The lint should be allow-by-default or it can be placed into Clippy as an
@@ -415,9 +415,9 @@ let x = Pub::C;
415
415
let x : <Pub <_ > as Trait >:: A ;
416
416
```
417
417
In principle, this restriction can be considered a part of the primary type
418
- privacy rule - "can't name a private type" - if all ` _ ` s (types to infer) are
419
- replaced by their inferred types before checking, so ` Pub ` and ` Pub<_> ` in the
420
- examples above become ` Pub<Priv> ` .
418
+ privacy rule - "can't name a private type" - if all ` _ ` s (types to infer,
419
+ explicit or implicit) are replaced by their inferred types before checking, so
420
+ ` Pub ` and ` Pub<_> ` in the examples above become ` Pub<Priv> ` .
421
421
422
422
### Lints
423
423
@@ -446,13 +446,13 @@ This lint is warn-by-default.
446
446
447
447
Lint ` private_bounds ` is reported when a type or trait with visibility ` x ` is
448
448
used in secondary interface of an item with effective visibility ` y ` and
449
- ` x < y ` .
449
+ ` x < y ` .
450
450
This lint is warn-by-default.
451
451
452
452
Lint ` unnameable_types ` is reported when effective visibility of a type is
453
453
larger than module in which it can be named, either directly, or through
454
454
reexports, or through trivial type aliases (` type X = Y; ` , no generics on both
455
- sides).
455
+ sides).
456
456
This lint is allow-by-default.
457
457
458
458
Compatibility lint ` private_in_public ` is never reported and removed.
0 commit comments