Skip to content

Commit c11cd6d

Browse files
authored
Merge pull request #105 from 0ndorio/task/add_missing_source_language_hints
Add missing source code language hints in drop-flags and phantom-data.
2 parents f8a4e96 + a73391d commit c11cd6d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/drop-flags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Note that this is not a problem that all assignments need worry about. In
1212
particular, assigning through a dereference unconditionally drops, and assigning
1313
in a `let` unconditionally doesn't drop:
1414

15-
```
15+
```rust
1616
let mut x = Box::new(0); // let makes a fresh variable, so never need to drop
1717
let y = &mut x;
1818
*y = Box::new(1); // Deref assumes the referent is initialized, so always drops

src/phantom-data.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ useful such as the information needed by drop check.
2727
Iter logically contains a bunch of `&'a T`s, so this is exactly what we tell
2828
the PhantomData to simulate:
2929

30-
```
30+
```rust
3131
use std::marker;
3232

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

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

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

69-
```
69+
```rust
7070
use std::marker;
7171

7272
struct Vec<T> {

0 commit comments

Comments
 (0)