Skip to content

Commit

Permalink
Merge pull request #105 from 0ndorio/task/add_missing_source_language…
Browse files Browse the repository at this point in the history
…_hints

Add missing source code language hints in drop-flags and phantom-data.
  • Loading branch information
Gankra committed Nov 21, 2018
2 parents f8a4e96 + a73391d commit c11cd6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/drop-flags.md
Expand Up @@ -12,7 +12,7 @@ Note that this is not a problem that all assignments need worry about. In
particular, assigning through a dereference unconditionally drops, and assigning
in a `let` unconditionally doesn't drop:

```
```rust
let mut x = Box::new(0); // let makes a fresh variable, so never need to drop
let y = &mut x;
*y = Box::new(1); // Deref assumes the referent is initialized, so always drops
Expand Down
6 changes: 3 additions & 3 deletions src/phantom-data.md
Expand Up @@ -27,7 +27,7 @@ useful such as the information needed by drop check.
Iter logically contains a bunch of `&'a T`s, so this is exactly what we tell
the PhantomData to simulate:

```
```rust
use std::marker;

struct Iter<'a, T: 'a> {
Expand All @@ -42,7 +42,7 @@ over `'a` and `T`. Everything Just Works.

Another important example is Vec, which is (approximately) defined as follows:

```
```rust
struct Vec<T> {
data: *const T, // *const for variance!
len: usize,
Expand All @@ -66,7 +66,7 @@ In order to tell dropck that we *do* own values of type T, and therefore may
drop some T's when *we* drop, we must add an extra PhantomData saying exactly
that:

```
```rust
use std::marker;

struct Vec<T> {
Expand Down

0 comments on commit c11cd6d

Please sign in to comment.