From 3293ab14e24d136d0482bb18afef577aebed251e Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 21 Nov 2014 17:10:42 -0500 Subject: Deprecate MaybeOwned[Vector] in favor of Cow --- src/libsyntax/parse/lexer/mod.rs | 8 ++++---- src/libsyntax/parse/parser.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index a88029e087b..b5358e7d485 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -272,13 +272,13 @@ impl<'a> StringReader<'a> { /// Converts CRLF to LF in the given string, raising an error on bare CR. fn translate_crlf<'a>(&self, start: BytePos, - s: &'a str, errmsg: &'a str) -> str::MaybeOwned<'a> { + s: &'a str, errmsg: &'a str) -> str::CowString<'a> { let mut i = 0u; while i < s.len() { let str::CharRange { ch, next } = s.char_range_at(i); if ch == '\r' { if next < s.len() && s.char_at(next) == '\n' { - return translate_crlf_(self, start, s, errmsg, i).into_maybe_owned(); + return translate_crlf_(self, start, s, errmsg, i).into_cow(); } let pos = start + BytePos(i as u32); let end_pos = start + BytePos(next as u32); @@ -286,7 +286,7 @@ impl<'a> StringReader<'a> { } i = next; } - return s.into_maybe_owned(); + return s.into_cow(); fn translate_crlf_(rdr: &StringReader, start: BytePos, s: &str, errmsg: &str, mut i: uint) -> String { @@ -550,7 +550,7 @@ impl<'a> StringReader<'a> { let string = if has_cr { self.translate_crlf(start_bpos, string, "bare CR not allowed in block doc-comment") - } else { string.into_maybe_owned() }; + } else { string.into_cow() }; token::DocComment(token::intern(string.as_slice())) } else { token::Comment diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index a9306c71240..c731a0005f8 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4966,10 +4966,10 @@ impl<'a> Parser<'a> { let mut err = String::from_str("circular modules: "); let len = included_mod_stack.len(); for p in included_mod_stack.slice(i, len).iter() { - err.push_str(p.display().as_maybe_owned().as_slice()); + err.push_str(p.display().as_cow().as_slice()); err.push_str(" -> "); } - err.push_str(path.display().as_maybe_owned().as_slice()); + err.push_str(path.display().as_cow().as_slice()); self.span_fatal(id_sp, err.as_slice()); } None => () -- cgit 1.4.1-3-g733a5