diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-23 14:25:43 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-23 14:25:43 +0100 |
commit | 3e09dbba94de103d4d7a211ec578b049d0adc3c7 (patch) | |
tree | d52a0a75e2ffcc7d71481f2d452969522c76d91e /crates/ra_ide/src/snapshots/highlight_doctest.html | |
parent | 45f3a5f9c151e7728cda47ea20fa72b18927ca2b (diff) | |
parent | 0b971625c389c1638957b010a35c7bb1a6bd69b9 (diff) |
Merge #5002
5002: Fix underflow panic when doctests are at top of file r=Nashenas88 a=Nashenas88
While debugging a comment at the top of a test string, I discovered that the offset calculations could underflow and panic. This only seemed to occur in tests, I assume because it's running a debug mode. The wrapping is quickly fixed later on in release mode, which is why this seems to have gone unnoticed. The new checks ensure the value is always positive or zero.
Co-authored-by: Paul Daniel Faria <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/snapshots/highlight_doctest.html')
-rw-r--r-- | crates/ra_ide/src/snapshots/highlight_doctest.html | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_ide/src/snapshots/highlight_doctest.html b/crates/ra_ide/src/snapshots/highlight_doctest.html index 63199cdbe..ac546806e 100644 --- a/crates/ra_ide/src/snapshots/highlight_doctest.html +++ b/crates/ra_ide/src/snapshots/highlight_doctest.html | |||
@@ -32,7 +32,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
32 | .keyword.unsafe { color: #BC8383; font-weight: bold; } | 32 | .keyword.unsafe { color: #BC8383; font-weight: bold; } |
33 | .control { font-style: italic; } | 33 | .control { font-style: italic; } |
34 | </style> | 34 | </style> |
35 | <pre><code><span class="keyword">struct</span> <span class="struct declaration">Foo</span> { | 35 | <pre><code><span class="comment documentation">/// ```</span> |
36 | <span class="comment documentation">/// </span><span class="keyword">let</span> _ = <span class="string_literal">"early doctests should not go boom"</span>; | ||
37 | <span class="comment documentation">/// ```</span> | ||
38 | <span class="keyword">struct</span> <span class="struct declaration">Foo</span> { | ||
36 | <span class="field declaration">bar</span>: <span class="builtin_type">bool</span>, | 39 | <span class="field declaration">bar</span>: <span class="builtin_type">bool</span>, |
37 | } | 40 | } |
38 | 41 | ||