Skip to content

Commit 8e75c50

Browse files
committed
community fixups
1 parent 9997a6e commit 8e75c50

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct Foo<u32, u16> {
8888
}
8989
```
9090

91-
The former case quite simply wastes space. An optimal use of space therefore requires
91+
The latter case quite simply wastes space. An optimal use of space therefore requires
9292
different monomorphizations to *have different field orderings*.
9393

9494
**Note: this is a hypothetical optimization that is not yet implemented in Rust 1.0.0**

lifetimes.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ Of course, it might be bounded by the *wrong* lifetime, but this will usually
247247
just cause a compiler error, rather than allow memory safety to be trivially
248248
violated.
249249

250-
Within a function, bounding lifetimes is more error-prone. The safest route
251-
is to just use a small function to ensure the lifetime is bound. However if
252-
this is unacceptable, the reference can be placed in a location with a specific
253-
lifetime. Unfortunately it's impossible to name all lifetimes involved in a
254-
function. To get around this, you can in principle use `copy_lifetime`, though
250+
Within a function, bounding lifetimes is more error-prone. The safest and easiest
251+
way to bound a lifetime is to return it from a function with a bound lifetime.
252+
However if this is unacceptable, the reference can be placed in a location with
253+
a specific lifetime. Unfortunately it's impossible to name all lifetimes involved
254+
in a function. To get around this, you can in principle use `copy_lifetime`, though
255255
these are unstable due to their awkward nature and questionable utility.
256256

257257

@@ -425,7 +425,7 @@ must be invariant to avoid lifetime smuggling.
425425

426426
`Fn` is the most confusing case, largely because contravariance is easily the
427427
most confusing kind of variance, and basically never comes up. To understand it,
428-
consider a function that *takes* a function `len` that takes a function `F`.
428+
consider a function `len` that takes a function `F`.
429429

430430
```rust
431431
fn len<F>(func: F) -> usize
@@ -435,8 +435,8 @@ fn len<F>(func: F) -> usize
435435
}
436436
```
437437

438-
We require that F is a Fn that can take an `&'static str` and print a usize. Now
439-
say we have a function that can take an `&'a str` (for *some* 'a). Such a function actually
438+
We require that F is a Fn that can take an `&'static str` and returns a usize. Now
439+
say we have a function that can take an `&'a str` (for *some* `'a`). Such a function actually
440440
accepts *more* inputs, since `&'static str` is a subtype of `&'a str`. Therefore
441441
`len` should happily accept such a function!
442442

@@ -643,8 +643,8 @@ trait Iterator {
643643
Given this definition, Self::Item has *no* connection to `self`. This means
644644
that we can call `next` several times in a row, and hold onto all the results
645645
*concurrently*. This is perfectly fine for by-value iterators, which have exactly
646-
these semantics. It's also actually fine for shared references, as it's perfectly
647-
fine to grab a huge pile of shared references to the same thing (although the
646+
these semantics. It's also actually fine for shared references, as they admit
647+
arbitrarily many references to the same thing (although the
648648
iterator needs to be a separate object from the thing being shared). But mutable
649649
references make this a mess. At first glance, they might seem completely
650650
incompatible with this API, as it would produce multiple mutable references to

0 commit comments

Comments
 (0)