Skip to content

Commit 98c8bdf

Browse files
committed
Editorial fixes
1 parent 9901089 commit 98c8bdf

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

text/0000-type-privacy.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ mod m {
151151
let x = m::leak();
152152
```
153153

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
155155
visibility `vis_type` then it cannot be used in interfaces of items with
156156
visibilities `vis_interface` where `vis_interface > vis_type`.
157157
In particular, this code is illegal
@@ -197,7 +197,7 @@ Meet reachability-based private-in-public *lints*!
197197

198198
Effective visibility of an item is how far it's actually reexported or leaked
199199
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
201201
`pub` annotation says), but it can be smaller.
202202

203203
For example, in the `outer`/`inner` example nominal visibility of `f` is `pub`,
@@ -256,8 +256,8 @@ Provisional name for the lint - `private_bounds`.
256256
Consider this code
257257
```rust
258258
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`.
261261
pub struct S;
262262
}
263263

@@ -271,7 +271,7 @@ The "Voldemort type" (or, more often, "Voldemort trait") pattern has legitimate
271271
uses, but often it's just an oversight and `S` is supposed to be reexported and
272272
nameable from outer modules.
273273
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.
275275
This lint is new and doesn't replace private-in-public errors, but it provides
276276
checking that many people *expected* from private-in-public.
277277
The lint should be allow-by-default or it can be placed into Clippy as an
@@ -415,9 +415,9 @@ let x = Pub::C;
415415
let x: <Pub<_> as Trait>::A;
416416
```
417417
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>`.
421421

422422
### Lints
423423

@@ -446,13 +446,13 @@ This lint is warn-by-default.
446446

447447
Lint `private_bounds` is reported when a type or trait with visibility `x` is
448448
used in secondary interface of an item with effective visibility `y` and
449-
`x < y`.
449+
`x < y`.
450450
This lint is warn-by-default.
451451

452452
Lint `unnameable_types` is reported when effective visibility of a type is
453453
larger than module in which it can be named, either directly, or through
454454
reexports, or through trivial type aliases (`type X = Y;`, no generics on both
455-
sides).
455+
sides).
456456
This lint is allow-by-default.
457457

458458
Compatibility lint `private_in_public` is never reported and removed.

0 commit comments

Comments
 (0)