Skip to content

Commit 7bead8b

Browse files
committed
---
yaml --- r: 152047 b: refs/heads/try2 c: 68455a1 h: refs/heads/master i: 152045: b12020f 152043: b5aba06 152039: 993354a 152031: f7b19a1 v: v3
1 parent 328f976 commit 7bead8b

File tree

19 files changed

+248
-503
lines changed

19 files changed

+248
-503
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: 746d086f9322d24fa7b389dd911e204ca35012ae
8+
refs/heads/try2: 68455a12db890a6021e77b9746749ebd4557e78d
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/tutorial.md

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,13 @@ they don't contain references to names that aren't actually defined.
5757
5858
# Getting started
5959

60-
There are two ways to install the Rust compiler: by building from source or
61-
by downloading prebuilt binaries or installers for your platform. The
62-
[install page][rust-install] contains links to download binaries for both
63-
the nightly build and the most current Rust major release. For Windows and
64-
OS X, the install page provides links to native installers.
60+
> *Warning:* The tarball and installer links are for the most recent
61+
> release, not master. To use master, you **must** build from [git].
6562
66-
> *Note:* Windows users should read the detailed
67-
> [Getting started][wiki-start] notes on the wiki. Even when using
68-
> the binary installer, the Windows build requires a MinGW installation,
69-
> the precise details of which are not discussed here.
70-
71-
For Linux and OS X, the install page provides links to binary tarballs.
72-
To install the Rust compiler from the from a binary tarball, download
73-
the binary package, extract it, and execute the `install.sh` script in
74-
the root directory of the package.
75-
76-
To build the Rust compiler from source, you will need to obtain the source through
77-
[Git][git] or by downloading the source package from the [install page][rust-install].
63+
The Rust compiler currently must be built from a [tarball] or [git], unless
64+
you are on Windows, in which case using the [installer][win-exe] is
65+
recommended. There is a list of community-maintained nightly builds and
66+
packages [on the wiki][wiki-packages].
7867

7968
Since the Rust compiler is written in Rust, it must be built by
8069
a precompiled "snapshot" version of itself (made in an earlier state
@@ -90,9 +79,13 @@ Snapshot binaries are currently built and tested on several platforms:
9079
You may find that other platforms work, but these are our "tier 1"
9180
supported build environments that are most likely to work.
9281

82+
> *Note:* Windows users should read the detailed
83+
> [Getting started][wiki-start] notes on the wiki. Even when using
84+
> the binary installer, the Windows build requires a MinGW installation,
85+
> the precise details of which are not discussed here.
86+
9387
[wiki-start]: https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust
9488
[git]: https://github.com/mozilla/rust.git
95-
[rust-install]: http://www.rust-lang.org/install.html
9689

9790
To build from source you will also need the following prerequisite
9891
packages:
@@ -1106,7 +1099,7 @@ let ys = xs;
11061099
11071100
xs = Nil;
11081101
1109-
// `xs` can be used again
1102+
// `xs` can't be used again
11101103
~~~
11111104

11121105
A destructor call will only occur for a variable that has not been moved from,

branches/try2/src/libcore/tuple.rs

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,8 @@
99
// except according to those terms.
1010

1111
//! Operations on tuples
12-
//!
13-
//! To access a single element of a tuple one can use the following
14-
//! methods:
15-
//!
16-
//! * `valN` - returns a value of _N_-th element
17-
//! * `refN` - returns a reference to _N_-th element
18-
//! * `mutN` - returns a mutable reference to _N_-th element
19-
//!
20-
//! Indexing starts from zero, so `val0` returns first value, `val1`
21-
//! returns second value, and so on. In general, a tuple with _S_
22-
//! elements provides aforementioned methods suffixed with numbers
23-
//! from `0` to `S-1`. Traits which contain these methods are
24-
//! implemented for tuples with up to 12 elements.
25-
//!
26-
//! If every type inside a tuple implements one of the following
27-
//! traits, then a tuple itself also implements it.
28-
//!
29-
//! * `Clone`
30-
//! * `Eq`
31-
//! * `TotalEq`
32-
//! * `Ord`
33-
//! * `TotalOrd`
34-
//! * `Default`
35-
//!
36-
//! # Examples
37-
//!
38-
//! Using methods:
39-
//!
40-
//! ```
41-
//! let pair = ("pi", 3.14);
42-
//! assert_eq!(pair.val0(), "pi");
43-
//! assert_eq!(pair.val1(), 3.14);
44-
//! ```
45-
//!
46-
//! Using traits implemented for tuples:
47-
//!
48-
//! ```
49-
//! use std::default::Default;
50-
//!
51-
//! let a = (1, 2);
52-
//! let b = (3, 4);
53-
//! assert!(a != b);
54-
//!
55-
//! let c = b.clone();
56-
//! assert!(b == c);
57-
//!
58-
//! let d : (u32, f32) = Default::default();
59-
//! assert_eq!(d, (0u32, 0.0f32));
60-
//! ```
12+
13+
#![allow(missing_doc)]
6114

6215
use clone::Clone;
6316
#[cfg(not(test))] use cmp::*;
@@ -73,7 +26,6 @@ macro_rules! tuple_impls {
7326
}
7427
)+) => {
7528
$(
76-
#[allow(missing_doc)]
7729
pub trait $Tuple<$($T),+> {
7830
$(fn $valN(self) -> $T;)+
7931
$(fn $refN<'a>(&'a self) -> &'a $T;)+

branches/try2/src/libregex/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ pub mod native {
401401
// undesirable consequences (such as requiring a dependency on
402402
// `libsyntax`).
403403
//
404-
// Secondly, the code generated by `regex!` must *also* be able
404+
// Secondly, the code generated generated by `regex!` must *also* be able
405405
// to access various functions in this crate to reduce code duplication
406406
// and to provide a value with precisely the same `Regex` type in this
407407
// crate. This, AFAIK, is impossible to mitigate.

branches/try2/src/libregex/re.rs

Lines changed: 34 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -100,45 +100,38 @@ pub fn is_match(regex: &str, text: &str) -> Result<bool, parse::Error> {
100100
/// documentation.
101101
#[deriving(Clone)]
102102
#[allow(visible_private_types)]
103-
pub enum Regex {
104-
// The representation of `Regex` is exported to support the `regex!`
105-
// syntax extension. Do not rely on it.
106-
//
107-
// See the comments for the `program` module in `lib.rs` for a more
108-
// detailed explanation for what `regex!` requires.
103+
pub struct Regex {
104+
/// The representation of `Regex` is exported to support the `regex!`
105+
/// syntax extension. Do not rely on it.
106+
///
107+
/// See the comments for the `program` module in `lib.rs` for a more
108+
/// detailed explanation for what `regex!` requires.
109109
#[doc(hidden)]
110-
Dynamic(Dynamic),
110+
pub original: String,
111111
#[doc(hidden)]
112-
Native(Native),
113-
}
114-
115-
#[deriving(Clone)]
116-
#[doc(hidden)]
117-
pub struct Dynamic {
118-
original: String,
119-
names: Vec<Option<String>>,
112+
pub names: Vec<Option<String>>,
120113
#[doc(hidden)]
121-
pub prog: Program
114+
pub p: MaybeNative,
122115
}
123116

124-
#[doc(hidden)]
125-
pub struct Native {
126-
#[doc(hidden)]
127-
pub original: &'static str,
128-
#[doc(hidden)]
129-
pub names: &'static [Option<&'static str>],
130-
#[doc(hidden)]
131-
pub prog: fn(MatchKind, &str, uint, uint) -> Vec<Option<uint>>
117+
impl fmt::Show for Regex {
118+
/// Shows the original regular expression.
119+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
120+
write!(f, "{}", self.original)
121+
}
132122
}
133123

134-
impl Clone for Native {
135-
fn clone(&self) -> Native { *self }
124+
pub enum MaybeNative {
125+
Dynamic(Program),
126+
Native(fn(MatchKind, &str, uint, uint) -> Vec<Option<uint>>),
136127
}
137128

138-
impl fmt::Show for Regex {
139-
/// Shows the original regular expression.
140-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
141-
write!(f, "{}", self.as_str())
129+
impl Clone for MaybeNative {
130+
fn clone(&self) -> MaybeNative {
131+
match *self {
132+
Dynamic(ref p) => Dynamic(p.clone()),
133+
Native(fp) => Native(fp),
134+
}
142135
}
143136
}
144137

@@ -153,11 +146,10 @@ impl Regex {
153146
pub fn new(re: &str) -> Result<Regex, parse::Error> {
154147
let ast = try!(parse::parse(re));
155148
let (prog, names) = Program::new(ast);
156-
Ok(Dynamic(Dynamic {
149+
Ok(Regex {
157150
original: re.to_strbuf(),
158-
names: names,
159-
prog: prog,
160-
}))
151+
names: names, p: Dynamic(prog),
152+
})
161153
}
162154

163155
/// Returns true if and only if the regex matches the string given.
@@ -503,46 +495,6 @@ impl Regex {
503495
}
504496
new.append(text.slice(last_match, text.len()))
505497
}
506-
507-
/// Returns the original string of this regex.
508-
pub fn as_str<'a>(&'a self) -> &'a str {
509-
match *self {
510-
Dynamic(Dynamic { ref original, .. }) => original.as_slice(),
511-
Native(Native { ref original, .. }) => original.as_slice(),
512-
}
513-
}
514-
515-
#[doc(hidden)]
516-
#[allow(visible_private_types)]
517-
#[experimental]
518-
pub fn names_iter<'a>(&'a self) -> NamesIter<'a> {
519-
match *self {
520-
Native(ref n) => NamesIterNative(n.names.iter()),
521-
Dynamic(ref d) => NamesIterDynamic(d.names.iter())
522-
}
523-
}
524-
525-
fn names_len(&self) -> uint {
526-
match *self {
527-
Native(ref n) => n.names.len(),
528-
Dynamic(ref d) => d.names.len()
529-
}
530-
}
531-
532-
}
533-
534-
enum NamesIter<'a> {
535-
NamesIterNative(::std::slice::Items<'a, Option<&'static str>>),
536-
NamesIterDynamic(::std::slice::Items<'a, Option<String>>)
537-
}
538-
539-
impl<'a> Iterator<Option<String>> for NamesIter<'a> {
540-
fn next(&mut self) -> Option<Option<String>> {
541-
match *self {
542-
NamesIterNative(ref mut i) => i.next().map(|x| x.map(|s| s.to_strbuf())),
543-
NamesIterDynamic(ref mut i) => i.next().map(|x| x.as_ref().map(|s| s.to_strbuf())),
544-
}
545-
}
546498
}
547499

548500
/// NoExpand indicates literal string replacement.
@@ -660,23 +612,22 @@ pub struct Captures<'t> {
660612
}
661613

662614
impl<'t> Captures<'t> {
663-
#[allow(experimental)]
664615
fn new(re: &Regex, search: &'t str, locs: CaptureLocs)
665616
-> Option<Captures<'t>> {
666617
if !has_match(&locs) {
667618
return None
668619
}
669620

670621
let named =
671-
if re.names_len() == 0 {
622+
if re.names.len() == 0 {
672623
None
673624
} else {
674625
let mut named = HashMap::new();
675-
for (i, name) in re.names_iter().enumerate() {
626+
for (i, name) in re.names.iter().enumerate() {
676627
match name {
677-
None => {},
678-
Some(name) => {
679-
named.insert(name, i);
628+
&None => {},
629+
&Some(ref name) => {
630+
named.insert(name.to_strbuf(), i);
680631
}
681632
}
682633
}
@@ -911,9 +862,9 @@ fn exec(re: &Regex, which: MatchKind, input: &str) -> CaptureLocs {
911862

912863
fn exec_slice(re: &Regex, which: MatchKind,
913864
input: &str, s: uint, e: uint) -> CaptureLocs {
914-
match *re {
915-
Dynamic(Dynamic { ref prog, .. }) => vm::run(which, prog, input, s, e),
916-
Native(Native { prog, .. }) => prog(which, input, s, e),
865+
match re.p {
866+
Dynamic(ref prog) => vm::run(which, prog, input, s, e),
867+
Native(exec) => exec(which, input, s, e),
917868
}
918869
}
919870

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ mod native_bench;
2020
#[path = "tests.rs"]
2121
mod native_tests;
2222

23-
#[cfg(not(stage1))]
24-
mod native_static;
25-
2623
// Due to macro scoping rules, this definition only applies for the modules
2724
// defined below. Effectively, it allows us to use the same tests for both
2825
// native and dynamic regexes.

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

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)