Skip to content

Commit f273ec6

Browse files
authored
Merge pull request #11 from simonsan/fixes
Fixes for mdbook test
2 parents 8583740 + 555c377 commit f273ec6

File tree

10 files changed

+24
-24
lines changed

10 files changed

+24
-24
lines changed

src/code-considerations/breaking-changes/fundamental.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Typically, the scope of [breakage in new trait impls](./reviewing-code/breakage/
1717

1818
Look out for blanket trait implementations for fundamental types, like:
1919

20-
```rust
20+
```rust,ignore
2121
impl<'a, T> PublicTrait for &'a T
2222
where
2323
T: SomeBound,

src/code-considerations/breaking-changes/new-trait-impls.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Also see [`#[fundamental]` types](./fundamental.md) for special considerations f
88

99
Rust will use the fact that there's only a single impl for a generic trait during inference. This breaks once a second impl makes the type of that generic ambiguous. Say we have:
1010

11-
```rust
11+
```rust,ignore
1212
// in `std`
1313
impl From<&str> for Arc<str> { .. }
1414
```
1515

16-
```rust
16+
```rust,ignore
1717
// in an external `lib`
1818
let b = Arc::from("a");
1919
```
@@ -27,7 +27,7 @@ impl From<&str> for Arc<str> { .. }
2727

2828
then
2929

30-
```rust
30+
```rust,ignore
3131
let b = Arc::from("a");
3232
```
3333

@@ -39,14 +39,14 @@ This kind of breakage can be ok, but a [crater] run should estimate the scope.
3939

4040
Rust will use deref coercion to find a valid trait impl if the arguments don't type check directly. This only seems to occur if there's a single impl so introducing a new one may break consumers relying on deref coercion. Say we have:
4141

42-
```rust
42+
```rust,ignore
4343
// in `std`
4444
impl Add<&str> for String { .. }
4545
4646
impl Deref for String { type Target = str; .. }
4747
```
4848

49-
```rust
49+
```rust,ignore
5050
// in an external `lib`
5151
let a = String::from("a");
5252
let b = String::from("b");
@@ -56,14 +56,14 @@ let c = a + &b;
5656

5757
then we add:
5858

59-
```diff
59+
```diff,ignore
6060
impl Add<&str> for String { .. }
6161
+ impl Add<char> for String { .. }
6262
```
6363

6464
then
6565

66-
```rust
66+
```rust,ignore
6767
let c = a + &b;
6868
```
6969

src/code-considerations/safety-and-soundness/generics-and-unsafe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Be careful of generic types that interact with unsafe code. Unless the generic t
44

55
A place where this commonly comes up is with the `RangeBounds` trait. You might assume that the start and end bounds given by a `RangeBounds` implementation will remain the same since it works through shared references. That's not necessarily the case though, an adversarial implementation may change the bounds between calls:
66

7-
```rust
7+
```rust,ignore
88
struct EvilRange(Cell<bool>);
99
1010
impl RangeBounds<usize> for EvilRange {

src/code-considerations/safety-and-soundness/may-dangle.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ If a generic `Type<T>` has a manual drop implementation that may also involve dr
66

77
As a real-world example of where this can go wrong, consider an `OptionCell<T>` that looks something like this:
88

9-
```rust
9+
```rust,ignore
1010
struct OptionCell<T> {
1111
is_init: bool,
1212
value: MaybeUninit<T>,
@@ -25,7 +25,7 @@ impl<T> Drop for OptionCell<T> {
2525

2626
Adding a `#[may_dangle]` attribute to this `OptionCell<T>` that didn't have a `PhantomData<T>` marker field opened up [a soundness hole](https://github.com/rust-lang/rust/issues/76367) for `T`'s that didn't strictly outlive the `OptionCell<T>`, and so could be accessed after being dropped in their own `Drop` implementations. The correct application of `#[may_dangle]` also required a `PhantomData<T>` field:
2727

28-
```diff
28+
```diff,ignore
2929
struct OptionCell<T> {
3030
is_init: bool,
3131
value: MaybeUninit<T>,

src/code-considerations/using-unstable-lang/const-generics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Const generics are ok to use in public APIs, so long as they fit in the [`min_co
1010

1111
Look out for const operations on const generics in public APIs like:
1212

13-
```rust
13+
```rust,ignore
1414
pub fn extend_array<T, const N: usize, const M: usize>(arr: [T; N]) -> [T; N + 1] {
1515
..
1616
}
1717
```
1818

1919
or for const generics that aren't integers, bools, or chars:
2020

21-
```rust
21+
```rust,ignore
2222
pub fn tag<const S: &'static str>() {
2323
..
2424
}

src/code-considerations/using-unstable-lang/specialization.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ We try to avoid leaning on specialization too heavily, limiting its use to optim
66

77
As an example of how to use specialization in the standard library, consider the case of creating an `Rc<[T]>` from a `&[T]`:
88

9-
```rust
9+
```rust,ignore
1010
impl<T: Clone> From<&[T]> for Rc<[T]> {
1111
#[inline]
1212
fn from(v: &[T]) -> Rc<[T]> {
@@ -17,7 +17,7 @@ impl<T: Clone> From<&[T]> for Rc<[T]> {
1717

1818
It would be nice to have an optimized implementation for the case where `T: Copy`:
1919

20-
```rust
20+
```rust,ignore
2121
impl<T: Copy> From<&[T]> for Rc<[T]> {
2222
#[inline]
2323
fn from(v: &[T]) -> Rc<[T]> {
@@ -28,7 +28,7 @@ impl<T: Copy> From<&[T]> for Rc<[T]> {
2828

2929
Unfortunately we couldn't have both of these impls normally, because they'd overlap. This is where private specialization can be used to choose the right implementation internally. In this case, we use a trait called `RcFromSlice` that switches the implementation:
3030

31-
```rust
31+
```rust,ignore
3232
impl<T: Clone> From<&[T]> for Rc<[T]> {
3333
#[inline]
3434
fn from(v: &[T]) -> Rc<[T]> {

src/reviewer-checklist.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Check the [getting started](./getting-started.md) guide for an introduction to d
66

77
If you'd like to reassign the PR, you can:
88

9-
```
9+
```ignore
1010
r? @user
1111
```
1212

@@ -40,12 +40,12 @@ Use [`@bors`](./tools-and-bots/bors.md) to merge the pull request.
4040

4141
To roll up:
4242

43-
```
43+
```ignore
4444
@bors r+ rollup
4545
```
4646

4747
or just:
4848

49-
```
49+
```ignore
5050
@bors r+
5151
```

src/tools-and-bots/bors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PRs to the standard library aren’t merged manually using GitHub’s UI or by p
66

77
You can approve a PR with:
88

9-
```
9+
```ignore
1010
@bors r+
1111
```
1212

src/tools-and-bots/crater.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
You can kick off a crater run by first calling:
88

9-
```
9+
```ignore
1010
@bors try
1111
```
1212

1313
Once that finishes, you can then call:
1414

15-
```
15+
```ignore
1616
@craterbot check
1717
```
1818

1919
to ensure crates compile, or:
2020

21-
```
21+
```ignore
2222
@craterbot run mode=build-and-test
2323
```

src/tools-and-bots/timer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
You can kick off a performance test using `@rust-timer`:
66

7-
```
7+
```ignore
88
@bors try @rust-timer queue
99
```

0 commit comments

Comments
 (0)