Skip to content

Commit d6e939a

Browse files
committed
Round 3 test fixes and conflicts
1 parent 1506b34 commit d6e939a

28 files changed

+127
-135
lines changed

src/libcore/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ macro_rules! array_impls {
4545
#[stable(feature = "rust1", since = "1.0.0")]
4646
impl<T: Hash> Hash for [T; $N] {
4747
fn hash<H: hash::Hasher>(&self, state: &mut H) {
48-
Hash::hash(&self[], state)
48+
Hash::hash(&self[..], state)
4949
}
5050
}
5151

src/libcore/hash/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,4 @@ mod impls {
494494
state.write_usize(*self as usize)
495495
}
496496
}
497-
498-
#[stable(feature = "rust1", since = "1.0.0")]
499-
impl<'a, T, B: ?Sized> Hash for Cow<'a, T, B>
500-
where B: Hash + ToOwned<T>
501-
{
502-
fn hash<H: Hasher>(&self, state: &mut H) {
503-
Hash::hash(&**self, state)
504-
}
505-
}
506497
}

src/libcore/marker.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,18 @@ pub struct Managed;
233233

234234
macro_rules! impls{
235235
($t: ident) => (
236+
#[cfg(stage0)]
236237
impl<T:?Sized, S: Hasher> Hash<S> for $t<T> {
237238
#[inline]
238239
fn hash(&self, _: &mut S) {
239240
}
240241
}
242+
#[cfg(not(stage0))]
243+
impl<T:?Sized> Hash for $t<T> {
244+
#[inline]
245+
fn hash<H: Hasher>(&self, _: &mut H) {
246+
}
247+
}
241248

242249
impl<T:?Sized> cmp::PartialEq for $t<T> {
243250
fn eq(&self, _other: &$t<T>) -> bool {

src/libgraphviz/lib.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -275,23 +275,20 @@
275275
html_root_url = "http://doc.rust-lang.org/nightly/")]
276276
#![feature(int_uint)]
277277
#![feature(collections)]
278-
#![feature(core)]
279278
#![feature(old_io)]
280279

281280
use self::LabelText::*;
282281

283-
use std::borrow::IntoCow;
282+
use std::borrow::{IntoCow, Cow};
284283
use std::old_io;
285-
use std::string::CowString;
286-
use std::vec::CowVec;
287284

288285
/// The text for a graphviz label on a node or edge.
289286
pub enum LabelText<'a> {
290287
/// This kind of label preserves the text directly as is.
291288
///
292289
/// Occurrences of backslashes (`\`) are escaped, and thus appear
293290
/// as backslashes in the rendered label.
294-
LabelStr(CowString<'a>),
291+
LabelStr(Cow<'a, str>),
295292

296293
/// This kind of label uses the graphviz label escString type:
297294
/// http://www.graphviz.org/content/attrs#kescString
@@ -303,7 +300,7 @@ pub enum LabelText<'a> {
303300
/// to break a line (centering the line preceding the `\n`), there
304301
/// are also the escape sequences `\l` which left-justifies the
305302
/// preceding line and `\r` which right-justifies it.
306-
EscStr(CowString<'a>),
303+
EscStr(Cow<'a, str>),
307304
}
308305

309306
// There is a tension in the design of the labelling API.
@@ -340,7 +337,7 @@ pub enum LabelText<'a> {
340337

341338
/// `Id` is a Graphviz `ID`.
342339
pub struct Id<'a> {
343-
name: CowString<'a>,
340+
name: Cow<'a, str>,
344341
}
345342

346343
impl<'a> Id<'a> {
@@ -387,7 +384,7 @@ impl<'a> Id<'a> {
387384
&*self.name
388385
}
389386

390-
pub fn name(self) -> CowString<'a> {
387+
pub fn name(self) -> Cow<'a, str> {
391388
self.name
392389
}
393390
}
@@ -463,7 +460,7 @@ impl<'a> LabelText<'a> {
463460
/// yields same content as self. The result obeys the law
464461
/// render(`lt`) == render(`EscStr(lt.pre_escaped_content())`) for
465462
/// all `lt: LabelText`.
466-
fn pre_escaped_content(self) -> CowString<'a> {
463+
fn pre_escaped_content(self) -> Cow<'a, str> {
467464
match self {
468465
EscStr(s) => s,
469466
LabelStr(s) => if s.contains_char('\\') {
@@ -489,8 +486,8 @@ impl<'a> LabelText<'a> {
489486
}
490487
}
491488

492-
pub type Nodes<'a,N> = CowVec<'a,N>;
493-
pub type Edges<'a,E> = CowVec<'a,E>;
489+
pub type Nodes<'a,N> = Cow<'a,[N]>;
490+
pub type Edges<'a,E> = Cow<'a,[E]>;
494491

495492
// (The type parameters in GraphWalk should be associated items,
496493
// when/if Rust supports such.)

src/libsyntax/diagnostic.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,16 @@ fn print_diagnostic(dst: &mut EmitterWriter, topic: &str, lvl: Level,
311311
}
312312

313313
try!(print_maybe_styled(dst,
314-
&format!("{}: ", lvl.to_string())[],
314+
&format!("{}: ", lvl.to_string()),
315315
term::attr::ForegroundColor(lvl.color())));
316316
try!(print_maybe_styled(dst,
317-
&format!("{}", msg)[],
317+
&format!("{}", msg),
318318
term::attr::Bold));
319319

320320
match code {
321321
Some(code) => {
322322
let style = term::attr::ForegroundColor(term::color::BRIGHT_MAGENTA);
323-
try!(print_maybe_styled(dst, &format!(" [{}]", code.clone())[], style));
323+
try!(print_maybe_styled(dst, &format!(" [{}]", code.clone()), style));
324324
}
325325
None => ()
326326
}
@@ -438,7 +438,7 @@ fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
438438
Some(_) => {
439439
try!(print_diagnostic(dst, &ss[..], Help,
440440
&format!("pass `--explain {}` to see a detailed \
441-
explanation", code)[], None));
441+
explanation", code), None));
442442
}
443443
None => ()
444444
},
@@ -542,7 +542,7 @@ fn highlight_lines(err: &mut EmitterWriter,
542542
}
543543

544544
try!(print_maybe_styled(err,
545-
&format!("{}\n", s)[],
545+
&format!("{}\n", s),
546546
term::attr::ForegroundColor(lvl.color())));
547547
}
548548
}

src/libsyntax/ext/source_util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree
117117
None => self.p.span_fatal(
118118
self.p.span,
119119
&format!("expected item, found `{}`",
120-
self.p.this_token_to_string())[]
120+
self.p.this_token_to_string())
121121
)
122122
}
123123
}
@@ -141,7 +141,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
141141
cx.span_err(sp,
142142
&format!("couldn't read {}: {}",
143143
file.display(),
144-
e)[]);
144+
e));
145145
return DummyResult::expr(sp);
146146
}
147147
Ok(bytes) => bytes,
@@ -159,7 +159,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
159159
Err(_) => {
160160
cx.span_err(sp,
161161
&format!("{} wasn't a utf-8 file",
162-
file.display())[]);
162+
file.display()));
163163
return DummyResult::expr(sp);
164164
}
165165
}
@@ -175,7 +175,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
175175
match File::open(&file).read_to_end() {
176176
Err(e) => {
177177
cx.span_err(sp,
178-
&format!("couldn't read {}: {}", file.display(), e)[]);
178+
&format!("couldn't read {}: {}", file.display(), e));
179179
return DummyResult::expr(sp);
180180
}
181181
Ok(bytes) => {

src/libsyntax/ext/tt/macro_parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ pub fn nameize(p_s: &ParseSess, ms: &[TokenTree], res: &[Rc<NamedMatch>])
229229
p_s.span_diagnostic
230230
.span_fatal(sp,
231231
&format!("duplicated bind name: {}",
232-
&string)[])
232+
&string))
233233
}
234234
}
235235
}
@@ -533,7 +533,7 @@ pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal {
533533
_ => {
534534
let token_str = pprust::token_to_string(&p.token);
535535
p.fatal(&format!("expected ident, found {}",
536-
&token_str[..])[])
536+
&token_str[..]))
537537
}
538538
},
539539
"path" => {
@@ -542,7 +542,7 @@ pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal {
542542
"meta" => token::NtMeta(p.parse_meta_item()),
543543
_ => {
544544
p.span_fatal_help(sp,
545-
&format!("invalid fragment specifier `{}`", name)[],
545+
&format!("invalid fragment specifier `{}`", name),
546546
"valid fragment specifiers are `ident`, `block`, \
547547
`stmt`, `expr`, `pat`, `ty`, `path`, `meta`, `tt` \
548548
and `item`")

src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ impl TTMacroExpander for MacroRulesMacroExpander {
123123
self.name,
124124
self.imported_from,
125125
arg,
126-
&self.lhses[],
127-
&self.rhses[])
126+
&self.lhses,
127+
&self.rhses)
128128
}
129129
}
130130

@@ -151,7 +151,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
151151
match **lhs {
152152
MatchedNonterminal(NtTT(ref lhs_tt)) => {
153153
let lhs_tt = match **lhs_tt {
154-
TtDelimited(_, ref delim) => &delim.tts[],
154+
TtDelimited(_, ref delim) => &delim.tts[..],
155155
_ => cx.span_fatal(sp, "malformed macro lhs")
156156
};
157157
// `None` is because we're not interpolating

src/libsyntax/ext/tt/transcribe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
309309
r.sp_diag.span_fatal(
310310
r.cur_span, /* blame the macro writer */
311311
&format!("variable '{:?}' is still repeating at this depth",
312-
token::get_ident(ident))[]);
312+
token::get_ident(ident)));
313313
}
314314
}
315315
}

src/libsyntax/parse/lexer/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ use ext::tt::transcribe::tt_next_token;
1616
use parse::token;
1717
use parse::token::{str_to_ident};
1818

19-
use std::borrow::IntoCow;
19+
use std::borrow::{IntoCow, Cow};
2020
use std::char;
2121
use std::fmt;
2222
use std::mem::replace;
2323
use std::num;
2424
use std::rc::Rc;
2525
use std::str;
26-
use std::string::CowString;
2726

2827
pub use ext::tt::transcribe::{TtReader, new_tt_reader, new_tt_reader_with_doc_flag};
2928

@@ -278,7 +277,7 @@ impl<'a> StringReader<'a> {
278277

279278
/// Converts CRLF to LF in the given string, raising an error on bare CR.
280279
fn translate_crlf<'b>(&self, start: BytePos,
281-
s: &'b str, errmsg: &'b str) -> CowString<'b> {
280+
s: &'b str, errmsg: &'b str) -> Cow<'b, str> {
282281
let mut i = 0;
283282
while i < s.len() {
284283
let str::CharRange { ch, next } = s.char_range_at(i);

0 commit comments

Comments
 (0)