Skip to content

Commit

Permalink
auto merge of #10709 : alexcrichton/rust/snapshot, r=pcwalton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Nov 29, 2013
2 parents 90d06ec + ab387a6 commit bf6964e
Show file tree
Hide file tree
Showing 182 changed files with 1,287 additions and 1,334 deletions.
6 changes: 3 additions & 3 deletions doc/rust.md
Expand Up @@ -2820,7 +2820,7 @@ expression*, which is the value to compare to the patterns. The type of the
patterns must equal the type of the head expression.

In a pattern whose head expression has an `enum` type, a placeholder (`_`) stands for a
*single* data field, whereas a wildcard `*` stands for *all* the fields of a particular
*single* data field, whereas a wildcard `..` stands for *all* the fields of a particular
variant. For example:

~~~~
Expand All @@ -2830,15 +2830,15 @@ let x: List<int> = Cons(10, @Cons(11, @Nil));
match x {
Cons(_, @Nil) => fail!("singleton list"),
Cons(*) => return,
Cons(..) => return,
Nil => fail!("empty list")
}
~~~~

The first pattern matches lists constructed by applying `Cons` to any head value, and a
tail value of `@Nil`. The second pattern matches _any_ list constructed with `Cons`,
ignoring the values of its arguments. The difference between `_` and `*` is that the pattern `C(_)` is only type-correct if
`C` has exactly one argument, while the pattern `C(*)` is type-correct for any enum variant `C`, regardless of how many arguments `C` has.
`C` has exactly one argument, while the pattern `C(..)` is type-correct for any enum variant `C`, regardless of how many arguments `C` has.

To execute an `match` expression, first the head expression is evaluated, then
its value is sequentially compared to the patterns in the arms until a match
Expand Down
12 changes: 6 additions & 6 deletions doc/tutorial.md
Expand Up @@ -606,16 +606,16 @@ match mypoint {

In general, the field names of a struct do not have to appear in the same
order they appear in the type. When you are not interested in all
the fields of a struct, a struct pattern may end with `, _` (as in
`Name { field1, _ }`) to indicate that you're ignoring all other fields.
the fields of a struct, a struct pattern may end with `, ..` (as in
`Name { field1, .. }`) to indicate that you're ignoring all other fields.
Additionally, struct fields have a shorthand matching form that simply
reuses the field name as the binding name.

~~~
# struct Point { x: f64, y: f64 }
# let mypoint = Point { x: 0.0, y: 0.0 };
match mypoint {
Point { x, _ } => { println(x.to_str()) }
Point { x, .. } => { println(x.to_str()) }
}
~~~

Expand Down Expand Up @@ -696,7 +696,7 @@ fn area(sh: Shape) -> f64 {
~~~~

You can write a lone `_` to ignore an individual field, and can
ignore all fields of a variant like: `Circle(*)`. As in their
ignore all fields of a variant like: `Circle(..)`. As in their
introduction form, nullary enum patterns are written without
parentheses.

Expand Down Expand Up @@ -725,7 +725,7 @@ enum Shape {
}
fn area(sh: Shape) -> f64 {
match sh {
Circle { radius: radius, _ } => f64::consts::PI * square(radius),
Circle { radius: radius, .. } => f64::consts::PI * square(radius),
Rectangle { top_left: top_left, bottom_right: bottom_right } => {
(bottom_right.x - top_left.x) * (top_left.y - bottom_right.y)
}
Expand Down Expand Up @@ -1698,7 +1698,7 @@ a function that returns `Option<T>` instead of `T`.
fn radius(shape: Shape) -> Option<f64> {
match shape {
Circle(_, radius) => Some(radius),
Rectangle(*) => None
Rectangle(..) => None
}
}
~~~~
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/runtest.rs
Expand Up @@ -166,7 +166,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
&ProcRes);
}

let ProcRes{ stdout, _ } = ProcRes;
let ProcRes{ stdout, .. } = ProcRes;
srcs.push(stdout);
round += 1;
}
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/arc.rs
Expand Up @@ -256,7 +256,7 @@ impl<T:Send> MutexArc<T> {
pub fn unwrap(self) -> T {
let MutexArc { x: x } = self;
let inner = x.unwrap();
let MutexArcInner { failed: failed, data: data, _ } = inner;
let MutexArcInner { failed: failed, data: data, .. } = inner;
if failed {
fail!("Can't unwrap poisoned MutexArc - another task failed inside!");
}
Expand Down Expand Up @@ -504,9 +504,9 @@ impl<T:Freeze + Send> RWArc<T> {
* in write mode.
*/
pub fn unwrap(self) -> T {
let RWArc { x: x, _ } = self;
let RWArc { x: x, .. } = self;
let inner = x.unwrap();
let RWArcInner { failed: failed, data: data, _ } = inner;
let RWArcInner { failed: failed, data: data, .. } = inner;
if failed {
fail!("Can't unwrap poisoned RWArc - another task failed inside!")
}
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/bitv.rs
Expand Up @@ -663,7 +663,7 @@ impl BitvSet {
size += 1;
true
});
let Bitv{rep, _} = bitv;
let Bitv{rep, ..} = bitv;
match rep {
Big(b) => BitvSet{ size: size, bitv: b },
Small(SmallBitv{bits}) =>
Expand All @@ -678,7 +678,7 @@ impl BitvSet {
/// Consumes this set to return the underlying bit vector
pub fn unwrap(self) -> Bitv {
let cap = self.capacity();
let BitvSet{bitv, _} = self;
let BitvSet{bitv, ..} = self;
return Bitv{ nbits:cap, rep: Big(bitv) };
}

Expand Down
6 changes: 3 additions & 3 deletions src/libextra/btree.rs
Expand Up @@ -111,8 +111,8 @@ impl<K: Clone + TotalOrd, V: Clone> Node<K, V>{
///Differentiates between leaf and branch nodes.
fn is_leaf(&self) -> bool{
match self{
&LeafNode(*) => true,
&BranchNode(*) => false
&LeafNode(..) => true,
&BranchNode(..) => false
}
}

Expand Down Expand Up @@ -208,7 +208,7 @@ impl<K: ToStr + TotalOrd, V: ToStr> ToStr for Node<K, V>{
fn to_str(&self) -> ~str{
match *self{
LeafNode(ref leaf) => leaf.to_str(),
BranchNode(*) => ~""
BranchNode(..) => ~""
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/dlist.rs
Expand Up @@ -241,7 +241,7 @@ impl<T> Deque<T> for DList<T> {
///
/// O(1)
fn pop_front(&mut self) -> Option<T> {
self.pop_front_node().map(|~Node{value, _}| value)
self.pop_front_node().map(|~Node{value, ..}| value)
}

/// Add an element last in the list
Expand All @@ -255,7 +255,7 @@ impl<T> Deque<T> for DList<T> {
///
/// O(1)
fn pop_back(&mut self) -> Option<T> {
self.pop_back_node().map(|~Node{value, _}| value)
self.pop_back_node().map(|~Node{value, ..}| value)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/libextra/getopts.rs
Expand Up @@ -549,7 +549,7 @@ pub mod groups {
long_name: long_name,
hasarg: hasarg,
occur: occur,
_
..
} = (*self).clone();
match (short_name.len(), long_name.len()) {
Expand Down Expand Up @@ -686,7 +686,7 @@ pub mod groups {
hint: hint,
desc: desc,
hasarg: hasarg,
_} = (*optref).clone();
..} = (*optref).clone();

let mut row = " ".repeat(4);

Expand Down
2 changes: 1 addition & 1 deletion src/libextra/glob.rs
Expand Up @@ -154,7 +154,7 @@ fn list_dir_sorted(path: &Path) -> ~[Path] {
sort::quick_sort(children, |p1, p2| p2.filename() <= p1.filename());
children
}
Err(*) => ~[]
Err(..) => ~[]
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/libextra/json.rs
Expand Up @@ -875,11 +875,11 @@ impl Decoder {
fn expected(&self, expected: &str, found: &Json) -> ! {
let found_s = match *found {
Null => "null",
List(*) => "list",
Object(*) => "object",
Number(*) => "number",
String(*) => "string",
Boolean(*) => "boolean"
List(..) => "list",
Object(..) => "object",
Number(..) => "number",
String(..) => "string",
Boolean(..) => "boolean"
};
self.err(format!("expected {expct} but found {fnd}: {val}",
expct=expected, fnd=found_s, val=found.to_str()))
Expand Down
2 changes: 0 additions & 2 deletions src/libextra/lib.rs
Expand Up @@ -38,8 +38,6 @@ Rust extras are part of the standard Rust distribution.

#[deny(non_camel_case_types)];
#[deny(missing_doc)];
#[allow(unrecognized_lint)]; // NOTE: remove after the next snapshot
#[allow(cstack)]; // NOTE: remove after the next snapshot.

use std::str::{StrSlice, OwnedStr};

Expand Down
2 changes: 1 addition & 1 deletion src/libextra/tempfile.rs
Expand Up @@ -39,7 +39,7 @@ impl TempDir {
for _ in range(0u, 1000) {
let p = tmpdir.join(r.gen_ascii_str(16) + suffix);
match io::result(|| fs::mkdir(&p, io::UserRWX)) {
Err(*) => {}
Err(..) => {}
Ok(()) => return Some(TempDir { path: Some(p) })
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/libextra/test.rs
Expand Up @@ -97,12 +97,12 @@ pub enum TestFn {
impl TestFn {
fn padding(&self) -> NamePadding {
match self {
&StaticTestFn(*) => PadNone,
&StaticBenchFn(*) => PadOnRight,
&StaticMetricFn(*) => PadOnRight,
&DynTestFn(*) => PadNone,
&DynMetricFn(*) => PadOnRight,
&DynBenchFn(*) => PadOnRight,
&StaticTestFn(..) => PadNone,
&StaticBenchFn(..) => PadOnRight,
&StaticMetricFn(..) => PadOnRight,
&DynTestFn(..) => PadNone,
&DynMetricFn(..) => PadOnRight,
&DynBenchFn(..) => PadOnRight,
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/time.rs
Expand Up @@ -681,13 +681,13 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {

let mut buf = [0];
let c = match rdr.read(buf) {
Some(*) => buf[0] as u8 as char,
Some(..) => buf[0] as u8 as char,
None => break
};
match c {
'%' => {
let ch = match rdr.read(buf) {
Some(*) => buf[0] as u8 as char,
Some(..) => buf[0] as u8 as char,
None => break
};
match parse_type(s, pos, ch, &mut tm) {
Expand Down Expand Up @@ -932,7 +932,7 @@ pub fn strftime(format: &str, tm: &Tm) -> ~str {
loop {
let mut b = [0];
let ch = match rdr.read(b) {
Some(*) => b[0],
Some(..) => b[0],
None => break,
};
match ch as char {
Expand Down
8 changes: 4 additions & 4 deletions src/libextra/treemap.rs
Expand Up @@ -686,7 +686,7 @@ fn mutate_values<'r,
-> bool {
match *node {
Some(~TreeNode{key: ref key, value: ref mut value, left: ref mut left,
right: ref mut right, _}) => {
right: ref mut right, ..}) => {
if !mutate_values(left, |k,v| f(k,v)) { return false }
if !f(key, value) { return false }
if !mutate_values(right, |k,v| f(k,v)) { return false }
Expand Down Expand Up @@ -801,13 +801,13 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
(remove(&mut save.left, key), true)
} else {
let new = save.left.take_unwrap();
let ~TreeNode{value, _} = replace(save, new);
let ~TreeNode{value, ..} = replace(save, new);
*save = save.left.take_unwrap();
(Some(value), true)
}
} else if save.right.is_some() {
let new = save.right.take_unwrap();
let ~TreeNode{value, _} = replace(save, new);
let ~TreeNode{value, ..} = replace(save, new);
(Some(value), true)
} else {
(None, false)
Expand Down Expand Up @@ -843,7 +843,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
}
}
return match node.take() {
Some(~TreeNode{value, _}) => Some(value), None => fail!()
Some(~TreeNode{value, ..}) => Some(value), None => fail!()
};
}

Expand Down
10 changes: 5 additions & 5 deletions src/libextra/url.rs
Expand Up @@ -74,7 +74,7 @@ fn encode_inner(s: &str, full_url: bool) -> ~str {
let mut buf = [0];
let ch = match rdr.read(buf) {
None => break,
Some(*) => buf[0] as char,
Some(..) => buf[0] as char,
};

match ch {
Expand Down Expand Up @@ -138,7 +138,7 @@ fn decode_inner(s: &str, full_url: bool) -> ~str {
let mut buf = [0];
let ch = match rdr.read(buf) {
None => break,
Some(*) => buf[0] as char
Some(..) => buf[0] as char
};
match ch {
'%' => {
Expand Down Expand Up @@ -199,7 +199,7 @@ fn encode_plus(s: &str) -> ~str {
loop {
let mut buf = [0];
let ch = match rdr.read(buf) {
Some(*) => buf[0] as char,
Some(..) => buf[0] as char,
None => break,
};
match ch {
Expand Down Expand Up @@ -253,7 +253,7 @@ pub fn decode_form_urlencoded(s: &[u8]) -> HashMap<~str, ~[~str]> {
loop {
let mut buf = [0];
let ch = match rdr.read(buf) {
Some(*) => buf[0] as char,
Some(..) => buf[0] as char,
None => break,
};
match ch {
Expand Down Expand Up @@ -318,7 +318,7 @@ fn split_char_first(s: &str, c: char) -> (~str, ~str) {
loop {
let mut buf = [0];
let ch = match rdr.read(buf) {
Some(*) => buf[0] as char,
Some(..) => buf[0] as char,
None => break,
};
if ch == c {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/back/link.rs
Expand Up @@ -973,7 +973,7 @@ fn is_writeable(p: &Path) -> bool {

!p.exists() ||
(match io::result(|| p.stat()) {
Err(*) => false,
Err(..) => false,
Ok(m) => m.perm & io::UserWrite == io::UserWrite
})
}
Expand Down
7 changes: 2 additions & 5 deletions src/librustc/front/feature_gate.rs
Expand Up @@ -95,7 +95,7 @@ impl Visitor<()> for Context {
ast::view_item_use(ref paths) => {
for path in paths.iter() {
match path.node {
ast::view_path_glob(*) => {
ast::view_path_glob(..) => {
self.gate_feature("globs", path.span,
"glob import statements are \
experimental and possibly buggy");
Expand All @@ -110,8 +110,6 @@ impl Visitor<()> for Context {
}

fn visit_item(&mut self, i: @ast::item, _:()) {
// NOTE: uncomment after snapshot
/*
for attr in i.attrs.iter() {
if "thread_local" == attr.name() {
self.gate_feature("thread_local", i.span,
Expand All @@ -120,12 +118,11 @@ impl Visitor<()> for Context {
`#[task_local]` mapping to the task model");
}
}
*/
match i.node {
ast::item_enum(ref def, _) => {
for variant in def.variants.iter() {
match variant.node.kind {
ast::struct_variant_kind(*) => {
ast::struct_variant_kind(..) => {
self.gate_feature("struct_variant", variant.span,
"enum struct variants are \
experimental and possibly buggy");
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/lib.rs
Expand Up @@ -19,8 +19,6 @@
#[crate_type = "lib"];

#[feature(macro_rules, globs, struct_variant, managed_boxes)];
#[allow(unrecognized_lint)]; // NOTE: remove after the next snapshot
#[allow(cstack)]; // NOTE: remove after the next snapshot.

extern mod extra;
extern mod syntax;
Expand Down

0 comments on commit bf6964e

Please sign in to comment.