Skip to content

Commit d4d0a26

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 160879 b: refs/heads/auto c: 3293ab1 h: refs/heads/master i: 160877: bfedb7b 160875: b6fd22e 160871: 3fbbb13 160863: 5e7205f v: v3
1 parent b9afde6 commit d4d0a26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+783
-2819
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 61af40278909eb899f1bdfbb8c45d4e4fb3dad5d
13+
refs/heads/auto: 3293ab14e24d136d0482bb18afef577aebed251e
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/mk/crates.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
################################################################################
5151

5252
TARGET_CRATES := libc std flate arena term \
53-
serialize getopts collections test time rand \
53+
serialize sync getopts collections test time rand \
5454
log regex graphviz core rbml alloc rustrt \
5555
unicode
5656
HOST_CRATES := syntax rustc rustc_trans rustdoc regex_macros fmt_macros \
@@ -63,7 +63,7 @@ DEPS_libc := core
6363
DEPS_unicode := core
6464
DEPS_alloc := core libc native:jemalloc
6565
DEPS_rustrt := alloc core libc collections native:rustrt_native
66-
DEPS_std := core libc rand alloc collections rustrt unicode \
66+
DEPS_std := core libc rand alloc collections rustrt sync unicode \
6767
native:rust_builtin native:backtrace
6868
DEPS_graphviz := std
6969
DEPS_syntax := std term serialize log fmt_macros arena libc
@@ -81,6 +81,7 @@ DEPS_glob := std
8181
DEPS_serialize := std log
8282
DEPS_rbml := std log serialize
8383
DEPS_term := std log
84+
DEPS_sync := core alloc rustrt collections
8485
DEPS_getopts := std
8586
DEPS_collections := core alloc unicode
8687
DEPS_num := std

branches/auto/src/compiletest/errors.rs

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
use self::WhichLine::*;
1110

1211
use std::ascii::AsciiExt;
1312
use std::io::{BufferedReader, File};
@@ -19,74 +18,28 @@ pub struct ExpectedError {
1918
pub msg: String,
2019
}
2120

22-
/// Looks for either "//~| KIND MESSAGE" or "//~^^... KIND MESSAGE"
23-
/// The former is a "follow" that inherits its target from the preceding line;
24-
/// the latter is an "adjusts" that goes that many lines up.
25-
///
26-
/// Goal is to enable tests both like: //~^^^ ERROR go up three
27-
/// and also //~^ ERROR message one for the preceding line, and
28-
/// //~| ERROR message two for that same line.
29-
30-
pub static EXPECTED_PATTERN : &'static str =
31-
r"//~(?P<follow>\|)?(?P<adjusts>\^*)\s*(?P<kind>\S*)\s*(?P<msg>.*)";
32-
33-
#[deriving(PartialEq, Show)]
34-
enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }
21+
pub static EXPECTED_PATTERN : &'static str = r"//~(?P<adjusts>\^*)\s*(?P<kind>\S*)\s*(?P<msg>.*)";
3522

3623
// Load any test directives embedded in the file
3724
pub fn load_errors(re: &Regex, testfile: &Path) -> Vec<ExpectedError> {
3825
let mut rdr = BufferedReader::new(File::open(testfile).unwrap());
3926

40-
// `last_nonfollow_error` tracks the most recently seen
41-
// line with an error template that did not use the
42-
// follow-syntax, "//~| ...".
43-
//
44-
// (pnkfelix could not find an easy way to compose Iterator::scan
45-
// and Iterator::filter_map to pass along this information into
46-
// `parse_expected`. So instead I am storing that state here and
47-
// updating it in the map callback below.)
48-
let mut last_nonfollow_error = None;
49-
5027
rdr.lines().enumerate().filter_map(|(line_no, ln)| {
51-
parse_expected(last_nonfollow_error,
52-
line_no + 1,
53-
ln.unwrap().as_slice(), re)
54-
.map(|(which, error)| {
55-
match which {
56-
FollowPrevious(_) => {}
57-
_ => last_nonfollow_error = Some(error.line),
58-
}
59-
error
60-
})
28+
parse_expected(line_no + 1, ln.unwrap().as_slice(), re)
6129
}).collect()
6230
}
6331

64-
fn parse_expected(last_nonfollow_error: Option<uint>,
65-
line_num: uint,
66-
line: &str,
67-
re: &Regex) -> Option<(WhichLine, ExpectedError)> {
32+
fn parse_expected(line_num: uint, line: &str, re: &Regex) -> Option<ExpectedError> {
6833
re.captures(line).and_then(|caps| {
6934
let adjusts = caps.name("adjusts").len();
7035
let kind = caps.name("kind").to_ascii_lower();
7136
let msg = caps.name("msg").trim().to_string();
72-
let follow = caps.name("follow").len() > 0;
73-
74-
let (which, line) = if follow {
75-
assert!(adjusts == 0, "use either //~| or //~^, not both.");
76-
let line = last_nonfollow_error.unwrap_or_else(|| {
77-
panic!("encountered //~| without preceding //~^ line.")
78-
});
79-
(FollowPrevious(line), line)
80-
} else {
81-
let which =
82-
if adjusts > 0 { AdjustBackward(adjusts) } else { ThisLine };
83-
let line = line_num - adjusts;
84-
(which, line)
85-
};
8637

87-
debug!("line={} which={} kind={} msg={}", line_num, which, kind, msg);
88-
Some((which, ExpectedError { line: line,
89-
kind: kind,
90-
msg: msg, }))
38+
debug!("line={} kind={} msg={}", line_num, kind, msg);
39+
Some(ExpectedError {
40+
line: line_num - adjusts,
41+
kind: kind,
42+
msg: msg,
43+
})
9144
})
9245
}

branches/auto/src/etc/licenseck.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@
3838
"rt/isaac/randport.cpp", # public domain
3939
"rt/isaac/rand.h", # public domain
4040
"rt/isaac/standard.h", # public domain
41-
"libstd/sync/mpsc_queue.rs", # BSD
42-
"libstd/sync/spsc_queue.rs", # BSD
43-
"libstd/sync/mpmc_bounded_queue.rs", # BSD
41+
"libsync/mpsc_queue.rs", # BSD
42+
"libsync/spsc_queue.rs", # BSD
43+
"libsync/mpmc_bounded_queue.rs", # BSD
44+
"libsync/mpsc_intrusive.rs", # BSD
4445
"test/bench/shootout-binarytrees.rs", # BSD
4546
"test/bench/shootout-chameneos-redux.rs", # BSD
4647
"test/bench/shootout-fannkuch-redux.rs", # BSD

branches/auto/src/libcollections/hash/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ use core::prelude::*;
6767

6868
use alloc::boxed::Box;
6969
use alloc::rc::Rc;
70+
use core::borrow::{Cow, ToOwned};
7071
use core::intrinsics::TypeId;
7172
use core::mem;
7273
use core::num::Int;
@@ -284,6 +285,13 @@ impl<S: Writer, T: Hash<S>, U: Hash<S>> Hash<S> for Result<T, U> {
284285
}
285286
}
286287

288+
impl<'a, T, Sized? B, S> Hash<S> for Cow<'a, T, B> where B: Hash<S> + ToOwned<T> {
289+
#[inline]
290+
fn hash(&self, state: &mut S) {
291+
Hash::hash(&**self, state)
292+
}
293+
}
294+
287295
//////////////////////////////////////////////////////////////////////////////
288296

289297
#[cfg(test)]

branches/auto/src/libcollections/str.rs

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
pub use self::MaybeOwned::*;
5555
use self::RecompositionState::*;
5656
use self::DecompositionType::*;
57-
use core::borrow::{BorrowFrom, ToOwned};
57+
use core::borrow::{BorrowFrom, Cow, ToOwned};
5858
use core::default::Default;
5959
use core::fmt;
6060
use core::cmp;
@@ -67,7 +67,7 @@ use core::prelude::{range};
6767

6868
use hash;
6969
use ring_buf::RingBuf;
70-
use string::{String, ToString};
70+
use string::String;
7171
use unicode;
7272
use vec::Vec;
7373

@@ -425,22 +425,24 @@ Section: MaybeOwned
425425
/// A string type that can hold either a `String` or a `&str`.
426426
/// This can be useful as an optimization when an allocation is sometimes
427427
/// needed but not always.
428+
#[deprecated = "use std::str::CowString"]
428429
pub enum MaybeOwned<'a> {
429430
/// A borrowed string.
430431
Slice(&'a str),
431432
/// An owned string.
432433
Owned(String)
433434
}
434435

435-
/// A specialization of `MaybeOwned` to be sendable.
436-
pub type SendStr = MaybeOwned<'static>;
436+
/// A specialization of `CowString` to be sendable.
437+
pub type SendStr = CowString<'static>;
437438

439+
#[deprecated = "use std::str::CowString"]
438440
impl<'a> MaybeOwned<'a> {
439441
/// Returns `true` if this `MaybeOwned` wraps an owned string.
440442
///
441443
/// # Example
442444
///
443-
/// ```rust
445+
/// ``` ignore
444446
/// let string = String::from_str("orange");
445447
/// let maybe_owned_string = string.into_maybe_owned();
446448
/// assert_eq!(true, maybe_owned_string.is_owned());
@@ -457,7 +459,7 @@ impl<'a> MaybeOwned<'a> {
457459
///
458460
/// # Example
459461
///
460-
/// ```rust
462+
/// ``` ignore
461463
/// let string = "orange";
462464
/// let maybe_owned_string = string.as_slice().into_maybe_owned();
463465
/// assert_eq!(true, maybe_owned_string.is_slice());
@@ -475,46 +477,56 @@ impl<'a> MaybeOwned<'a> {
475477
pub fn len(&self) -> uint { self.as_slice().len() }
476478

477479
/// Returns true if the string contains no bytes
480+
#[allow(deprecated)]
478481
#[inline]
479482
pub fn is_empty(&self) -> bool { self.len() == 0 }
480483
}
481484

485+
#[deprecated = "use std::borrow::IntoCow"]
482486
/// Trait for moving into a `MaybeOwned`.
483487
pub trait IntoMaybeOwned<'a> {
484488
/// Moves `self` into a `MaybeOwned`.
485489
fn into_maybe_owned(self) -> MaybeOwned<'a>;
486490
}
487491

492+
#[deprecated = "use std::borrow::IntoCow"]
493+
#[allow(deprecated)]
488494
impl<'a> IntoMaybeOwned<'a> for String {
489495
/// # Example
490496
///
491-
/// ```rust
497+
/// ``` ignore
492498
/// let owned_string = String::from_str("orange");
493499
/// let maybe_owned_string = owned_string.into_maybe_owned();
494500
/// assert_eq!(true, maybe_owned_string.is_owned());
495501
/// ```
502+
#[allow(deprecated)]
496503
#[inline]
497504
fn into_maybe_owned(self) -> MaybeOwned<'a> {
498505
Owned(self)
499506
}
500507
}
501508

509+
#[deprecated = "use std::borrow::IntoCow"]
510+
#[allow(deprecated)]
502511
impl<'a> IntoMaybeOwned<'a> for &'a str {
503512
/// # Example
504513
///
505-
/// ```rust
514+
/// ``` ignore
506515
/// let string = "orange";
507516
/// let maybe_owned_str = string.as_slice().into_maybe_owned();
508517
/// assert_eq!(false, maybe_owned_str.is_owned());
509518
/// ```
519+
#[allow(deprecated)]
510520
#[inline]
511521
fn into_maybe_owned(self) -> MaybeOwned<'a> { Slice(self) }
512522
}
513523

524+
#[allow(deprecated)]
525+
#[deprecated = "use std::borrow::IntoCow"]
514526
impl<'a> IntoMaybeOwned<'a> for MaybeOwned<'a> {
515527
/// # Example
516528
///
517-
/// ```rust
529+
/// ``` ignore
518530
/// let str = "orange";
519531
/// let maybe_owned_str = str.as_slice().into_maybe_owned();
520532
/// let maybe_maybe_owned_str = maybe_owned_str.into_maybe_owned();
@@ -524,37 +536,44 @@ impl<'a> IntoMaybeOwned<'a> for MaybeOwned<'a> {
524536
fn into_maybe_owned(self) -> MaybeOwned<'a> { self }
525537
}
526538

539+
#[deprecated = "use std::str::CowString"]
527540
impl<'a> PartialEq for MaybeOwned<'a> {
528541
#[inline]
529542
fn eq(&self, other: &MaybeOwned) -> bool {
530543
self.as_slice() == other.as_slice()
531544
}
532545
}
533546

547+
#[deprecated = "use std::str::CowString"]
534548
impl<'a> Eq for MaybeOwned<'a> {}
535549

550+
#[deprecated = "use std::str::CowString"]
536551
impl<'a> PartialOrd for MaybeOwned<'a> {
537552
#[inline]
538553
fn partial_cmp(&self, other: &MaybeOwned) -> Option<Ordering> {
539554
Some(self.cmp(other))
540555
}
541556
}
542557

558+
#[deprecated = "use std::str::CowString"]
543559
impl<'a> Ord for MaybeOwned<'a> {
544560
#[inline]
545561
fn cmp(&self, other: &MaybeOwned) -> Ordering {
546562
self.as_slice().cmp(other.as_slice())
547563
}
548564
}
549565

566+
#[deprecated = "use std::str::CowString"]
550567
impl<'a, S: Str> Equiv<S> for MaybeOwned<'a> {
551568
#[inline]
552569
fn equiv(&self, other: &S) -> bool {
553570
self.as_slice() == other.as_slice()
554571
}
555572
}
556573

574+
#[deprecated = "use std::str::CowString"]
557575
impl<'a> Str for MaybeOwned<'a> {
576+
#[allow(deprecated)]
558577
#[inline]
559578
fn as_slice<'b>(&'b self) -> &'b str {
560579
match *self {
@@ -564,7 +583,9 @@ impl<'a> Str for MaybeOwned<'a> {
564583
}
565584
}
566585

586+
#[deprecated = "use std::str::CowString"]
567587
impl<'a> StrAllocating for MaybeOwned<'a> {
588+
#[allow(deprecated)]
568589
#[inline]
569590
fn into_string(self) -> String {
570591
match self {
@@ -574,7 +595,9 @@ impl<'a> StrAllocating for MaybeOwned<'a> {
574595
}
575596
}
576597

598+
#[deprecated = "use std::str::CowString"]
577599
impl<'a> Clone for MaybeOwned<'a> {
600+
#[allow(deprecated)]
578601
#[inline]
579602
fn clone(&self) -> MaybeOwned<'a> {
580603
match *self {
@@ -584,18 +607,22 @@ impl<'a> Clone for MaybeOwned<'a> {
584607
}
585608
}
586609

610+
#[deprecated = "use std::str::CowString"]
587611
impl<'a> Default for MaybeOwned<'a> {
612+
#[allow(deprecated)]
588613
#[inline]
589614
fn default() -> MaybeOwned<'a> { Slice("") }
590615
}
591616

617+
#[deprecated = "use std::str::CowString"]
592618
impl<'a, H: hash::Writer> hash::Hash<H> for MaybeOwned<'a> {
593619
#[inline]
594620
fn hash(&self, hasher: &mut H) {
595621
self.as_slice().hash(hasher)
596622
}
597623
}
598624

625+
#[deprecated = "use std::str::CowString"]
599626
impl<'a> fmt::Show for MaybeOwned<'a> {
600627
#[inline]
601628
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -613,7 +640,7 @@ impl BorrowFrom<String> for str {
613640

614641
#[unstable = "trait is unstable"]
615642
impl ToOwned<String> for str {
616-
fn to_owned(&self) -> String { self.to_string() }
643+
fn to_owned(&self) -> String { self.into_string() }
617644
}
618645

619646
/// Unsafe string operations.
@@ -622,6 +649,13 @@ pub mod raw {
622649
pub use core::str::raw::{slice_unchecked};
623650
}
624651

652+
/*
653+
Section: CowString
654+
*/
655+
656+
/// A clone-on-write string
657+
pub type CowString<'a> = Cow<'a, String, str>;
658+
625659
/*
626660
Section: Trait implementations
627661
*/

0 commit comments

Comments
 (0)