From 056a21d4f0144a26ffff6688e1657953083b0efa Mon Sep 17 00:00:00 2001 From: Greg Chapple Date: Wed, 4 Mar 2015 12:59:39 +0000 Subject: [PATCH 1/2] Fixed compilation errors - fixes #50 --- src/parse.rs | 2 +- src/re.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parse.rs b/src/parse.rs index afdbba38e5..1e811b8b69 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -1036,7 +1036,7 @@ fn find_class(classes: NamedClasses, name: &str) -> Option> { } type Class = &'static [(char, char)]; -type NamedClasses = &'static [(&'static str, &'static Class)]; +type NamedClasses = &'static [(&'static str, Class)]; static ASCII_CLASSES: NamedClasses = &[ // Classes must be in alphabetical order so that bsearch works. diff --git a/src/re.rs b/src/re.rs index 81e48344a8..50736c2da1 100644 --- a/src/re.rs +++ b/src/re.rs @@ -952,7 +952,7 @@ impl<'r, 't> Iterator for FindMatches<'r, 't> { } } -struct RegexSearcher<'r, 't> { +pub struct RegexSearcher<'r, 't> { it: FindMatches<'r, 't>, last_step_end: usize, next_match: Option<(usize, usize)>, From 021506803849e4ae11e3d40540f52e16e1cc908b Mon Sep 17 00:00:00 2001 From: Thomas Jespersen Date: Wed, 4 Mar 2015 17:38:14 +0100 Subject: [PATCH 2/2] Change static to const. This commit https://github.com/rust-lang/rust/commit/f35f973cb700c444d8c029ee13b37dc16d560225 changes `static`s to `const`s in quite a few places in libunicode. For some reason, this causes rustc to dump its core, which is in itself a bug, but here we can fix it by changing some static variables to const. --- src/parse.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/parse.rs b/src/parse.rs index 1e811b8b69..3f00deaf50 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -1071,18 +1071,18 @@ static ASCII_CLASSES: NamedClasses = &[ ("xdigit", &XDIGIT), ]; -static ALNUM: Class = &[('0', '9'), ('A', 'Z'), ('a', 'z')]; -static ALPHA: Class = &[('A', 'Z'), ('a', 'z')]; -static ASCII: Class = &[('\x00', '\x7F')]; -static BLANK: Class = &[(' ', ' '), ('\t', '\t')]; -static CNTRL: Class = &[('\x00', '\x1F'), ('\x7F', '\x7F')]; -static DIGIT: Class = &[('0', '9')]; -static GRAPH: Class = &[('!', '~')]; -static LOWER: Class = &[('a', 'z')]; -static PRINT: Class = &[(' ', '~')]; -static PUNCT: Class = &[('!', '/'), (':', '@'), ('[', '`'), ('{', '~')]; -static SPACE: Class = &[('\t', '\t'), ('\n', '\n'), ('\x0B', '\x0B'), +const ALNUM: Class = &[('0', '9'), ('A', 'Z'), ('a', 'z')]; +const ALPHA: Class = &[('A', 'Z'), ('a', 'z')]; +const ASCII: Class = &[('\x00', '\x7F')]; +const BLANK: Class = &[(' ', ' '), ('\t', '\t')]; +const CNTRL: Class = &[('\x00', '\x1F'), ('\x7F', '\x7F')]; +const DIGIT: Class = &[('0', '9')]; +const GRAPH: Class = &[('!', '~')]; +const LOWER: Class = &[('a', 'z')]; +const PRINT: Class = &[(' ', '~')]; +const PUNCT: Class = &[('!', '/'), (':', '@'), ('[', '`'), ('{', '~')]; +const SPACE: Class = &[('\t', '\t'), ('\n', '\n'), ('\x0B', '\x0B'), ('\x0C', '\x0C'), ('\r', '\r'), (' ', ' ')]; -static UPPER: Class = &[('A', 'Z')]; -static WORD: Class = &[('0', '9'), ('A', 'Z'), ('a', 'z'), ('_', '_')]; -static XDIGIT: Class = &[('0', '9'), ('A', 'F'), ('a', 'f')]; +const UPPER: Class = &[('A', 'Z')]; +const WORD: Class = &[('0', '9'), ('A', 'Z'), ('a', 'z'), ('_', '_')]; +const XDIGIT: Class = &[('0', '9'), ('A', 'F'), ('a', 'f')];