fix mdbook test

This commit is contained in:
Mark Mansi 2019-06-26 14:34:56 -05:00
parent b32b9ae934
commit 53b84f92f4
3 changed files with 14 additions and 14 deletions

View File

@ -88,7 +88,7 @@ have to compute `Values(R1) = Values(R1) union Values(R2)`.
One observation that follows from this is that if you have `R1: R2`
and `R2: R1`, then `R1 = R2` must be true. Similarly, if you have:
```
```txt
R1: R2
R2: R3
R3: R4
@ -119,7 +119,7 @@ context.
When using a graph representation, we can detect regions that must be equal
by looking for cycles. That is, if you have a constraint like
```
```txt
'a: 'b
'b: 'c
'c: 'd
@ -153,7 +153,7 @@ When we compute SCCs, we not only figure out which regions are a
member of each SCC, we also figure out the edges between them. So for example
consider this set of outlives constraints:
```
```txt
'a: 'b
'b: 'a
@ -178,7 +178,7 @@ expressed in terms of regions -- that is, we have a map like
in terms of SCCs -- we can integrate these liveness constraints very
easily just by taking the union:
```
```txt
for each region R:
let S be the SCC that contains R
Values(S) = Values(S) union Liveness(R)
@ -195,7 +195,7 @@ the value of `S1`, we first compute the values of each successor `S2`.
Then we simply union all of those values together. To use a
quasi-iterator-like notation:
```
```txt
Values(S1) =
s1.successors()
.map(|s2| Values(s2))

View File

@ -7,7 +7,7 @@ derives from the fact that such lifetimes are "universally quantified"
lifetimes). It is worth spending a bit of discussing how lifetime
parameters are handled during region inference. Consider this example:
```rust
```rust,ignore
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
x
}
@ -92,7 +92,7 @@ itself). In the code, these liveness constraints are setup in
So, consider the first example of this section:
```rust
```rust,ignore
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
x
}
@ -102,7 +102,7 @@ Here, returning `x` requires that `&'a u32 <: &'b u32`, which gives
rise to an outlives constraint `'a: 'b`. Combined with our default liveness
constraints we get:
```
```txt
'a live at {B, end('a)} // B represents the "function body"
'b live at {B, end('b)}
'a: 'b

View File

@ -6,7 +6,7 @@ some `i`). These constraints cannot be expressed by users, but they
arise from `impl Trait` due to its lifetime capture rules. Consider a
function such as the following:
```rust
```rust,ignore
fn make(a: &'a u32, b: &'b u32) -> impl Trait<'a, 'b> { .. }
```
@ -15,7 +15,7 @@ permitted to capture the lifetimes `'a` or `'b`. You can kind of see
this more clearly by desugaring that `impl Trait` return type into its
more explicit form:
```rust
```rust,ignore
type MakeReturn<'x, 'y> = impl Trait<'x, 'y>;
fn make(a: &'a u32, b: &'b u32) -> MakeReturn<'a, 'b> { .. }
```
@ -34,14 +34,14 @@ To help us explain member constraints in more detail, let's spell out
the `make` example in a bit more detail. First off, let's assume that
you have some dummy trait:
```rust
```rust,ignore
trait Trait<'a, 'b> { }
impl<T> Trait<'_, '_> for T { }
```
and this is the `make` function (in desugared form):
```rust
```rust,ignore
type MakeReturn<'x, 'y> = impl Trait<'x, 'y>;
fn make(a: &'a u32, b: &'b u32) -> MakeReturn<'a, 'b> {
(a, b)
@ -52,7 +52,7 @@ What happens in this case is that the return type will be `(&'0 u32, &'1 u32)`,
where `'0` and `'1` are fresh region variables. We will have the following
region constraints:
```
```txt
'0 live at {L}
'1 live at {L}
'a: '0
@ -73,7 +73,7 @@ u32)` -- the region variables reflect that the lifetimes of these
references could be made smaller. For this value to be created from
`a` and `b`, however, we do require that:
```
```txt
(&'a u32, &'b u32) <: (&'0 u32, &'1 u32)
```