Skip to content

Commit 767a885

Browse files
committed
---
yaml --- r: 95457 b: refs/heads/dist-snap c: 0adb41d h: refs/heads/master i: 95455: e2af7ec v: v3
1 parent 31fd30d commit 767a885

File tree

12 files changed

+45
-227
lines changed

12 files changed

+45
-227
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: d4a32386f3b61a4997de54ed00c0a80fd07ecc75
9+
refs/heads/dist-snap: 0adb41d0eb44ef74e897c22d9f1fcd8f97ef3458
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/back/rpath.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,12 @@ mod test {
189189
let mut d = Path::new(env!("CFG_PREFIX"));
190190
d.push("lib/rustc/triple/lib");
191191
debug2!("test_prefix_path: {} vs. {}",
192-
res,
192+
res.to_str(),
193193
d.display());
194-
assert!(res.as_bytes().ends_with(d.as_vec()));
194+
assert!(ends_with(res.as_bytes(), d.as_vec()));
195+
fn ends_with(v: &[u8], needle: &[u8]) -> bool {
196+
v.len() >= needle.len() && v.slice_from(v.len()-needle.len()) == needle
197+
}
195198
}
196199
197200
#[test]

branches/dist-snap/src/librustpkg/tests.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ fn is_read_only(p: &Path) -> bool {
217217
}
218218
}
219219

220+
fn ends_with(v: &[u8], needle: &[u8]) -> bool {
221+
v.len() >= needle.len() && v.slice_from(v.len() - needle.len()) == needle
222+
}
223+
220224
fn test_sysroot() -> Path {
221225
// Totally gross hack but it's just for test cases.
222226
// Infer the sysroot from the exe name and pray that it's right.
@@ -743,7 +747,7 @@ fn test_package_version() {
743747
&ws) {
744748
Some(p) => {
745749
let suffix = format!("0.4{}", os::consts::DLL_SUFFIX);
746-
p.as_vec().ends_with(suffix.as_bytes())
750+
ends_with(p.as_vec(), suffix.as_bytes())
747751
}
748752
None => false
749753
});
@@ -781,7 +785,7 @@ fn test_package_request_version() {
781785
Some(p) => {
782786
debug2!("installed: {}", p.display());
783787
let suffix = format!("0.3{}", os::consts::DLL_SUFFIX);
784-
p.as_vec().ends_with(suffix.as_bytes())
788+
ends_with(p.as_vec(), suffix.as_bytes())
785789
}
786790
None => false
787791
});

branches/dist-snap/src/libstd/fmt/mod.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -673,24 +673,6 @@ impl<'self> Formatter<'self> {
673673
}
674674
}
675675

676-
#[cfg(stage0)]
677-
fn getcount(&mut self, cnt: &parse::Count) -> Option<uint> {
678-
match *cnt {
679-
parse::CountIs(n) => { Some(n) }
680-
parse::CountImplied => { None }
681-
parse::CountIsParam(i) => {
682-
let v = self.args[i].value;
683-
unsafe { Some(*(v as *util::Void as *uint)) }
684-
}
685-
parse::CountIsNextParam => {
686-
let v = self.curarg.next().unwrap().value;
687-
unsafe { Some(*(v as *util::Void as *uint)) }
688-
}
689-
parse::CountIsName(*) => unreachable!()
690-
}
691-
}
692-
693-
#[cfg(not(stage0))]
694676
fn getcount(&mut self, cnt: &rt::Count) -> Option<uint> {
695677
match *cnt {
696678
rt::CountIs(n) => { Some(n) }

branches/dist-snap/src/libstd/fmt/parse.rs

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,6 @@ pub struct Argument<'self> {
4848

4949
/// Specification for the formatting of an argument in the format string.
5050
#[deriving(Eq)]
51-
#[cfg(stage0)]
52-
pub struct FormatSpec<'self> {
53-
/// Optionally specified character to fill alignment with
54-
fill: Option<char>,
55-
/// Optionally specified alignment
56-
align: Alignment,
57-
/// Packed version of various flags provided
58-
flags: uint,
59-
/// The integer precision to use
60-
precision: Count,
61-
/// The string width requested for the resulting format
62-
width: Count,
63-
/// The descriptor string representing the name of the format desired for
64-
/// this argument, this can be empty or any number of characters, although
65-
/// it is required to be one word.
66-
ty: &'self str
67-
}
68-
69-
/// Specification for the formatting of an argument in the format string.
70-
#[deriving(Eq)]
71-
#[cfg(not(stage0))]
7251
pub struct FormatSpec<'self> {
7352
/// Optionally specified character to fill alignment with
7453
fill: Option<char>,
@@ -113,18 +92,6 @@ pub enum Flag {
11392
/// can reference either an argument or a literal integer.
11493
#[deriving(Eq)]
11594
#[allow(missing_doc)]
116-
#[cfg(stage0)]
117-
pub enum Count {
118-
CountIs(uint),
119-
CountIsParam(uint),
120-
CountIsName(&'static str), // not actually used, see stage1
121-
CountIsNextParam,
122-
CountImplied,
123-
}
124-
125-
#[deriving(Eq)]
126-
#[allow(missing_doc)]
127-
#[cfg(not(stage0))]
12895
pub enum Count<'self> {
12996
CountIs(uint),
13097
CountIsName(&'self str),
@@ -594,20 +561,6 @@ impl<'self> Parser<'self> {
594561
/// Parses a Count parameter at the current position. This does not check
595562
/// for 'CountIsNextParam' because that is only used in precision, not
596563
/// width.
597-
#[cfg(stage0)]
598-
fn count(&mut self) -> Count {
599-
match self.integer() {
600-
Some(i) => {
601-
if self.consume('$') {
602-
CountIsParam(i)
603-
} else {
604-
CountIs(i)
605-
}
606-
}
607-
None => { CountImplied }
608-
}
609-
}
610-
#[cfg(not(stage0))]
611564
fn count(&mut self) -> Count<'self> {
612565
match self.integer() {
613566
Some(i) => {

branches/dist-snap/src/libstd/fmt/rt.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@ pub struct Argument<'self> {
3434
method: Option<&'self Method<'self>>
3535
}
3636

37-
#[cfg(stage0)]
38-
pub struct FormatSpec {
39-
fill: char,
40-
align: parse::Alignment,
41-
flags: uint,
42-
precision: parse::Count,
43-
width: parse::Count,
44-
}
45-
46-
#[cfg(not(stage0))]
4737
pub struct FormatSpec {
4838
fill: char,
4939
align: parse::Alignment,
@@ -52,7 +42,6 @@ pub struct FormatSpec {
5242
width: Count,
5343
}
5444

55-
#[cfg(not(stage0))]
5645
pub enum Count {
5746
CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied,
5847
}

branches/dist-snap/src/libstd/repr.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -367,16 +367,6 @@ impl<'self> TyVisitor for ReprVisitor<'self> {
367367
}
368368
}
369369

370-
#[cfg(stage0)]
371-
fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
372-
do self.get::<raw::Slice<()>> |this, s| {
373-
this.writer.write(['&' as u8]);
374-
this.write_mut_qualifier(mtbl);
375-
this.write_vec_range(s.data, s.len, inner);
376-
}
377-
}
378-
379-
#[cfg(not(stage0))]
380370
fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
381371
do self.get::<raw::Slice<()>> |this, s| {
382372
this.writer.write(['&' as u8]);

branches/dist-snap/src/libstd/str.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,17 @@ pub fn eq(a: &~str, b: &~str) -> bool {
827827
eq_slice(*a, *b)
828828
}
829829

830+
/*
831+
Section: Searching
832+
*/
833+
834+
// Utility used by various searching functions
835+
fn match_at<'a,'b>(haystack: &'a str, needle: &'b str, at: uint) -> bool {
836+
let mut i = at;
837+
for c in needle.byte_iter() { if haystack[i] != c { return false; } i += 1u; }
838+
return true;
839+
}
840+
830841
/*
831842
Section: Misc
832843
*/
@@ -2007,16 +2018,18 @@ impl<'self> StrSlice<'self> for &'self str {
20072018
}
20082019
}
20092020
2010-
#[inline]
20112021
fn starts_with<'a>(&self, needle: &'a str) -> bool {
2012-
let n = needle.len();
2013-
self.len() >= n && needle == self.slice_to(n)
2022+
let (self_len, needle_len) = (self.len(), needle.len());
2023+
if needle_len == 0u { true }
2024+
else if needle_len > self_len { false }
2025+
else { match_at(*self, needle, 0u) }
20142026
}
20152027
2016-
#[inline]
20172028
fn ends_with(&self, needle: &str) -> bool {
2018-
let (m, n) = (self.len(), needle.len());
2019-
m >= n && needle == self.slice_from(m - n)
2029+
let (self_len, needle_len) = (self.len(), needle.len());
2030+
if needle_len == 0u { true }
2031+
else if needle_len > self_len { false }
2032+
else { match_at(*self, needle, self_len - needle_len) }
20202033
}
20212034
20222035
fn escape_default(&self) -> ~str {

branches/dist-snap/src/libstd/unstable/intrinsics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ pub trait TyVisitor {
172172

173173
extern "rust-intrinsic" {
174174
/// Abort the execution of the process.
175-
#[cfg(not(stage0))]
176175
pub fn abort() -> !;
177176

178177
/// Atomic compare and exchange, sequentially consistent.

0 commit comments

Comments
 (0)