From 1e0c23d781dac5d6cb267465f4dc54de1cddc1e6 Mon Sep 17 00:00:00 2001 From: William Throwe Date: Thu, 24 Sep 2015 00:34:20 -0400 Subject: [PATCH] Allow multi-digit GDB minor version numbers GDB 7.10 was recently released. --- src/compiletest/compiletest.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index f508798a8b6ed..0e928345d931f 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -348,7 +348,7 @@ fn extract_gdb_version(full_version_line: Option) -> Option { if !full_version_line.trim().is_empty() => { let full_version_line = full_version_line.trim(); - // used to be a regex "(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)" + // used to be a regex "(^|[^0-9])([0-9]\.[0-9]+)" for (pos, c) in full_version_line.char_indices() { if !c.is_digit(10) { continue } if pos + 2 >= full_version_line.len() { continue } @@ -357,11 +357,12 @@ fn extract_gdb_version(full_version_line: Option) -> Option { if pos > 0 && full_version_line.char_at_reverse(pos).is_digit(10) { continue } - if pos + 3 < full_version_line.len() && - full_version_line.char_at(pos + 3).is_digit(10) { - continue + let mut end = pos + 3; + while end < full_version_line.len() && + full_version_line.char_at(end).is_digit(10) { + end += 1; } - return Some(full_version_line[pos..pos+3].to_owned()); + return Some(full_version_line[pos..end].to_owned()); } println!("Could not extract GDB version from line '{}'", full_version_line);