aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting/tests.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-23 14:25:43 +0100
committerGitHub <[email protected]>2020-06-23 14:25:43 +0100
commit3e09dbba94de103d4d7a211ec578b049d0adc3c7 (patch)
treed52a0a75e2ffcc7d71481f2d452969522c76d91e /crates/ra_ide/src/syntax_highlighting/tests.rs
parent45f3a5f9c151e7728cda47ea20fa72b18927ca2b (diff)
parent0b971625c389c1638957b010a35c7bb1a6bd69b9 (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/syntax_highlighting/tests.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs
index 93a276ffe..b1f48f03b 100644
--- a/crates/ra_ide/src/syntax_highlighting/tests.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tests.rs
@@ -291,6 +291,9 @@ fn main() {
291fn test_highlight_doctest() { 291fn test_highlight_doctest() {
292 check_highlighting( 292 check_highlighting(
293 r#" 293 r#"
294/// ```
295/// let _ = "early doctests should not go boom";
296/// ```
294struct Foo { 297struct Foo {
295 bar: bool, 298 bar: bool,
296} 299}