Skip to content

Commit eba4346

Browse files
committed
---
yaml --- r: 152247 b: refs/heads/try2 c: 024df5c h: refs/heads/master i: 152245: 4e7a3c0 152243: 2a1c831 152239: 175a2e7 v: v3
1 parent 30ef0ca commit eba4346

File tree

13 files changed

+37
-250
lines changed

13 files changed

+37
-250
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 7645982efcaced211ad60870e9986c6b9f0f2079
8+
refs/heads/try2: 024df5c8a68928670f10cef45ca3064424016674
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/liballoc/rc.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use core::option::{Option, Some, None};
3333
use core::ptr;
3434
use core::ptr::RawPtr;
3535
use core::mem::{min_align_of, size_of};
36-
use core::fmt;
3736

3837
use heap::deallocate;
3938

@@ -179,12 +178,6 @@ impl<T: Ord> Ord for Rc<T> {
179178
fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) }
180179
}
181180

182-
impl<T: fmt::Show> fmt::Show for Rc<T> {
183-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
184-
(**self).fmt(f)
185-
}
186-
}
187-
188181
/// Weak reference to a reference-counted box
189182
#[unsafe_no_drop_flag]
190183
pub struct Weak<T> {

branches/try2/src/libregex/lib.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,15 @@
155155
//! # Unicode
156156
//!
157157
//! This implementation executes regular expressions **only** on sequences of
158-
//! Unicode code points while exposing match locations as byte indices into the
159-
//! search string.
158+
//! UTF8 codepoints while exposing match locations as byte indices.
160159
//!
161160
//! Currently, only naive case folding is supported. Namely, when matching
162161
//! case insensitively, the characters are first converted to their uppercase
163162
//! forms and then compared.
164163
//!
165164
//! Regular expressions themselves are also **only** interpreted as a sequence
166-
//! of Unicode code points. This means you can use Unicode characters
167-
//! directly in your expression:
165+
//! of UTF8 codepoints. This means you can embed Unicode characters directly
166+
//! into your expression:
168167
//!
169168
//! ```rust
170169
//! # #![feature(phase)]
@@ -230,10 +229,10 @@
230229
//! x*? zero or more of x (ungreedy)
231230
//! x+? one or more of x (ungreedy)
232231
//! x?? zero or one of x (ungreedy)
233-
//! x{n,m} at least n x and at most m x (greedy)
232+
//! x{n,m} at least n and at most x (greedy)
234233
//! x{n,} at least n x (greedy)
235234
//! x{n} exactly n x
236-
//! x{n,m}? at least n x and at most m x (ungreedy)
235+
//! x{n,m}? at least n and at most x (ungreedy)
237236
//! x{n,}? at least n x (ungreedy)
238237
//! x{n}? exactly n x
239238
//! </pre>
@@ -301,7 +300,7 @@
301300
//! \v vertical tab (\x0B)
302301
//! \123 octal character code (up to three digits)
303302
//! \x7F hex character code (exactly two digits)
304-
//! \x{10FFFF} any hex character code corresponding to a Unicode code point
303+
//! \x{10FFFF} any hex character code corresponding to a valid UTF8 codepoint
305304
//! </pre>
306305
//!
307306
//! ## Perl character classes (Unicode friendly)
@@ -391,7 +390,7 @@ mod vm;
391390
#[cfg(test, not(windows))]
392391
mod test;
393392

394-
/// The `native` module exists to support the `regex!` macro. Do not use.
393+
/// The `program` module exists to support the `regex!` macro. Do not use.
395394
#[doc(hidden)]
396395
pub mod native {
397396
// Exporting this stuff is bad form, but it's necessary for two reasons.

branches/try2/src/libregex/parse/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ pub fn parse(s: &str) -> Result<Ast, Error> {
201201

202202
impl<'a> Parser<'a> {
203203
fn parse(&mut self) -> Result<Ast, Error> {
204-
if self.chars.len() == 0 {
205-
return Ok(Nothing);
206-
}
207204
loop {
208205
let c = self.cur();
209206
match c {

branches/try2/src/libregex/re.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ use parse;
1818
use vm;
1919
use vm::{CaptureLocs, MatchKind, Exists, Location, Submatches};
2020

21-
/// Escapes all regular expression meta characters in `text`.
22-
///
23-
/// The string returned may be safely used as a literal in a regular
24-
/// expression.
21+
/// Escapes all regular expression meta characters in `text` so that it may be
22+
/// safely used in a regular expression as a literal string.
2523
pub fn quote(text: &str) -> String {
2624
let mut quoted = String::with_capacity(text.len());
2725
for c in text.chars() {
@@ -47,18 +45,17 @@ pub fn is_match(regex: &str, text: &str) -> Result<bool, parse::Error> {
4745
Regex::new(regex).map(|r| r.is_match(text))
4846
}
4947

50-
/// A compiled regular expression
51-
///
52-
/// It is represented as either a sequence of bytecode instructions (dynamic)
53-
/// or as a specialized Rust function (native). It can be used to search, split
48+
/// Regex is a compiled regular expression, represented as either a sequence
49+
/// of bytecode instructions (dynamic) or as a specialized Rust function
50+
/// (native). It can be used to search, split
5451
/// or replace text. All searching is done with an implicit `.*?` at the
5552
/// beginning and end of an expression. To force an expression to match the
5653
/// whole string (or a prefix or a suffix), you must use an anchor like `^` or
5754
/// `$` (or `\A` and `\z`).
5855
///
5956
/// While this crate will handle Unicode strings (whether in the regular
6057
/// expression or in the search text), all positions returned are **byte
61-
/// indices**. Every byte index is guaranteed to be at a Unicode code point
58+
/// indices**. Every byte index is guaranteed to be at a UTF8 codepoint
6259
/// boundary.
6360
///
6461
/// The lifetimes `'r` and `'t` in this crate correspond to the lifetime of a
@@ -192,7 +189,7 @@ impl Regex {
192189
///
193190
/// # Example
194191
///
195-
/// Find the start and end location of the first word with exactly 13
192+
/// Find the start and end location of every word with exactly 13
196193
/// characters:
197194
///
198195
/// ```rust
@@ -219,7 +216,7 @@ impl Regex {
219216
///
220217
/// # Example
221218
///
222-
/// Find the start and end location of every word with exactly 13
219+
/// Find the start and end location of the first word with exactly 13
223220
/// characters:
224221
///
225222
/// ```rust
@@ -580,8 +577,8 @@ impl<'t> Replacer for &'t str {
580577
}
581578
}
582579

583-
impl<'t> Replacer for |&Captures|: 't -> String {
584-
fn reg_replace<'a>(&'a mut self, caps: &Captures) -> MaybeOwned<'a> {
580+
impl<'a> Replacer for |&Captures|: 'a -> String {
581+
fn reg_replace<'r>(&'r mut self, caps: &Captures) -> MaybeOwned<'r> {
585582
Owned((*self)(caps))
586583
}
587584
}
@@ -826,9 +823,8 @@ impl<'t> Iterator<Option<(uint, uint)>> for SubCapturesPos<'t> {
826823
}
827824

828825
/// An iterator that yields all non-overlapping capture groups matching a
829-
/// particular regular expression.
830-
///
831-
/// The iterator stops when no more matches can be found.
826+
/// particular regular expression. The iterator stops when no more matches can
827+
/// be found.
832828
///
833829
/// `'r` is the lifetime of the compiled expression and `'t` is the lifetime
834830
/// of the matched string.

branches/try2/src/libregex/test/tests.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,6 @@ fn split() {
2828
assert_eq!(subs, vec!("cauchy", "plato", "tyler", "binx"));
2929
}
3030

31-
#[test]
32-
fn empty_regex_empty_match() {
33-
let re = regex!("");
34-
let ms = re.find_iter("").collect::<Vec<(uint, uint)>>();
35-
assert_eq!(ms, vec![(0, 0)]);
36-
}
37-
38-
#[test]
39-
fn empty_regex_nonempty_match() {
40-
let re = regex!("");
41-
let ms = re.find_iter("abc").collect::<Vec<(uint, uint)>>();
42-
assert_eq!(ms, vec![(0, 0), (1, 1), (2, 2), (3, 3)]);
43-
}
44-
4531
macro_rules! replace(
4632
($name:ident, $which:ident, $re:expr,
4733
$search:expr, $replace:expr, $result:expr) => (

branches/try2/src/librustc/back/archive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'a> Archive<'a> {
110110
lto: bool) -> io::IoResult<()> {
111111
let object = format!("{}.o", name);
112112
let bytecode = format!("{}.bc.deflate", name);
113-
let mut ignore = vec!(bytecode.as_slice(), METADATA_FILENAME);
113+
let mut ignore = vec!(METADATA_FILENAME, bytecode.as_slice());
114114
if lto {
115115
ignore.push(object.as_slice());
116116
}

branches/try2/src/librustc/middle/typeck/check/demand.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@
1212
use middle::ty;
1313
use middle::typeck::check::FnCtxt;
1414
use middle::typeck::infer;
15-
use middle::typeck::infer::resolve_type;
16-
use middle::typeck::infer::resolve::try_resolve_tvar_shallow;
1715

1816
use std::result::{Err, Ok};
1917
use std::result;
2018
use syntax::ast;
2119
use syntax::codemap::Span;
22-
use util::ppaux::Repr;
2320

2421
// Requires that the two types unify, and prints an error message if they
2522
// don't.
@@ -61,13 +58,6 @@ pub fn eqtype(fcx: &FnCtxt, sp: Span, expected: ty::t, actual: ty::t) {
6158
// Checks that the type `actual` can be coerced to `expected`.
6259
pub fn coerce(fcx: &FnCtxt, sp: Span, expected: ty::t, expr: &ast::Expr) {
6360
let expr_ty = fcx.expr_ty(expr);
64-
debug!("demand::coerce(expected = {}, expr_ty = {})",
65-
expected.repr(fcx.ccx.tcx),
66-
expr_ty.repr(fcx.ccx.tcx));
67-
let expected = if ty::type_needs_infer(expected) {
68-
resolve_type(fcx.infcx(), expected,
69-
try_resolve_tvar_shallow).unwrap_or(expected)
70-
} else { expected };
7161
match fcx.mk_assignty(expr, expr_ty, expected) {
7262
result::Ok(()) => { /* ok */ }
7363
result::Err(ref err) => {

branches/try2/src/libstd/slice.rs

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -712,103 +712,13 @@ pub trait MutableOrdVector<T> {
712712
/// assert!(v == [-5, -3, 1, 2, 4]);
713713
/// ```
714714
fn sort(self);
715-
716-
/// Mutates the slice to the next lexicographic permutation.
717-
///
718-
/// Returns `true` if successful, `false` if the slice is at the last-ordered permutation.
719-
///
720-
/// # Example
721-
///
722-
/// ```rust
723-
/// let v = &mut [0, 1, 2];
724-
/// v.next_permutation();
725-
/// assert_eq!(v, &mut [0, 2, 1]);
726-
/// v.next_permutation();
727-
/// assert_eq!(v, &mut [1, 0, 2]);
728-
/// ```
729-
fn next_permutation(self) -> bool;
730-
731-
/// Mutates the slice to the previous lexicographic permutation.
732-
///
733-
/// Returns `true` if successful, `false` if the slice is at the first-ordered permutation.
734-
///
735-
/// # Example
736-
///
737-
/// ```rust
738-
/// let v = &mut [1, 0, 2];
739-
/// v.prev_permutation();
740-
/// assert_eq!(v, &mut [0, 2, 1]);
741-
/// v.prev_permutation();
742-
/// assert_eq!(v, &mut [0, 1, 2]);
743-
/// ```
744-
fn prev_permutation(self) -> bool;
745715
}
746716

747717
impl<'a, T: Ord> MutableOrdVector<T> for &'a mut [T] {
748718
#[inline]
749719
fn sort(self) {
750720
self.sort_by(|a,b| a.cmp(b))
751721
}
752-
753-
fn next_permutation(self) -> bool {
754-
// These cases only have 1 permutation each, so we can't do anything.
755-
if self.len() < 2 { return false; }
756-
757-
// Step 1: Identify the longest, rightmost weakly decreasing part of the vector
758-
let mut i = self.len() - 1;
759-
while i > 0 && self[i-1] >= self[i] {
760-
i -= 1;
761-
}
762-
763-
// If that is the entire vector, this is the last-ordered permutation.
764-
if i == 0 {
765-
return false;
766-
}
767-
768-
// Step 2: Find the rightmost element larger than the pivot (i-1)
769-
let mut j = self.len() - 1;
770-
while j >= i && self[j] <= self[i-1] {
771-
j -= 1;
772-
}
773-
774-
// Step 3: Swap that element with the pivot
775-
self.swap(j, i-1);
776-
777-
// Step 4: Reverse the (previously) weakly decreasing part
778-
self.mut_slice_from(i).reverse();
779-
780-
true
781-
}
782-
783-
fn prev_permutation(self) -> bool {
784-
// These cases only have 1 permutation each, so we can't do anything.
785-
if self.len() < 2 { return false; }
786-
787-
// Step 1: Identify the longest, rightmost weakly increasing part of the vector
788-
let mut i = self.len() - 1;
789-
while i > 0 && self[i-1] <= self[i] {
790-
i -= 1;
791-
}
792-
793-
// If that is the entire vector, this is the first-ordered permutation.
794-
if i == 0 {
795-
return false;
796-
}
797-
798-
// Step 2: Reverse the weakly increasing part
799-
self.mut_slice_from(i).reverse();
800-
801-
// Step 3: Find the rightmost element equal to or bigger than the pivot (i-1)
802-
let mut j = self.len() - 1;
803-
while j >= i && self[j-1] < self[i-1] {
804-
j -= 1;
805-
}
806-
807-
// Step 4: Swap that element with the pivot
808-
self.swap(i-1, j);
809-
810-
true
811-
}
812722
}
813723

814724
/// Unsafe operations
@@ -1319,58 +1229,6 @@ mod tests {
13191229
}
13201230
}
13211231

1322-
#[test]
1323-
fn test_lexicographic_permutations() {
1324-
let v : &mut[int] = &mut[1, 2, 3, 4, 5];
1325-
assert!(v.prev_permutation() == false);
1326-
assert!(v.next_permutation());
1327-
assert_eq!(v, &mut[1, 2, 3, 5, 4]);
1328-
assert!(v.prev_permutation());
1329-
assert_eq!(v, &mut[1, 2, 3, 4, 5]);
1330-
assert!(v.next_permutation());
1331-
assert!(v.next_permutation());
1332-
assert_eq!(v, &mut[1, 2, 4, 3, 5]);
1333-
assert!(v.next_permutation());
1334-
assert_eq!(v, &mut[1, 2, 4, 5, 3]);
1335-
1336-
let v : &mut[int] = &mut[1, 0, 0, 0];
1337-
assert!(v.next_permutation() == false);
1338-
assert!(v.prev_permutation());
1339-
assert_eq!(v, &mut[0, 1, 0, 0]);
1340-
assert!(v.prev_permutation());
1341-
assert_eq!(v, &mut[0, 0, 1, 0]);
1342-
assert!(v.prev_permutation());
1343-
assert_eq!(v, &mut[0, 0, 0, 1]);
1344-
assert!(v.prev_permutation() == false);
1345-
}
1346-
1347-
#[test]
1348-
fn test_lexicographic_permutations_empty_and_short() {
1349-
let empty : &mut[int] = &mut[];
1350-
assert!(empty.next_permutation() == false);
1351-
assert_eq!(empty, &mut[]);
1352-
assert!(empty.prev_permutation() == false);
1353-
assert_eq!(empty, &mut[]);
1354-
1355-
let one_elem : &mut[int] = &mut[4];
1356-
assert!(one_elem.prev_permutation() == false);
1357-
assert_eq!(one_elem, &mut[4]);
1358-
assert!(one_elem.next_permutation() == false);
1359-
assert_eq!(one_elem, &mut[4]);
1360-
1361-
let two_elem : &mut[int] = &mut[1, 2];
1362-
assert!(two_elem.prev_permutation() == false);
1363-
assert_eq!(two_elem, &mut[1, 2]);
1364-
assert!(two_elem.next_permutation());
1365-
assert_eq!(two_elem, &mut[2, 1]);
1366-
assert!(two_elem.next_permutation() == false);
1367-
assert_eq!(two_elem, &mut[2, 1]);
1368-
assert!(two_elem.prev_permutation());
1369-
assert_eq!(two_elem, &mut[1, 2]);
1370-
assert!(two_elem.prev_permutation() == false);
1371-
assert_eq!(two_elem, &mut[1, 2]);
1372-
}
1373-
13741232
#[test]
13751233
fn test_position_elem() {
13761234
assert!([].position_elem(&1).is_none());

0 commit comments

Comments
 (0)