Skip to content

Commit 58715de

Browse files
committed
---
yaml --- r: 49888 b: refs/heads/auto c: a9643d3 h: refs/heads/master v: v3
1 parent b179110 commit 58715de

File tree

10 files changed

+146
-10
lines changed

10 files changed

+146
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: f9269a1bda7a8e128ce52327df35cd645332a77e
17+
refs/heads/auto: a9643d39f8243dceb1184f446d988081a607d824
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/src/librust/rust.rc

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

1111
// rust - central access to other rust tools
12-
// FIXME #2238 Make commands run and test emit proper file endings on winds
13-
// FIXME #2238 Make run only accept source that emits an executable
12+
// XXX: Make commands run and test emit proper file endings on winds
13+
// XXX: Make run only accept source that emits an executable
1414

1515
#[deny(deprecated_self)];
1616

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ pub fn in_lpad_scope_cx(bcx: block, f: &fn(+si: &mut scope_info)) {
867867
let mut bcx = bcx;
868868
loop {
869869
{
870-
// FIXME #4280: Borrow check bug workaround.
870+
// XXX: Borrow check bug workaround.
871871
let kind: &mut block_kind = &mut *bcx.kind;
872872
match *kind {
873873
block_scope(ref mut inf) => {
@@ -1272,7 +1272,7 @@ pub fn cleanup_and_leave(bcx: block,
12721272
}
12731273

12741274
{
1275-
// FIXME #4280: Borrow check bug workaround.
1275+
// XXX: Borrow check bug workaround.
12761276
let kind: &mut block_kind = &mut *cur.kind;
12771277
match *kind {
12781278
block_scope(ref mut inf) if !inf.cleanups.is_empty() => {
@@ -1850,7 +1850,8 @@ pub fn trans_enum_variant(ccx: @CrateContext,
18501850
};
18511851
let fcx = new_fn_ctxt_w_id(ccx, ~[], llfndecl, variant.node.id, None,
18521852
param_substs, None);
1853-
let raw_llargs = create_llargs_for_fn_args(fcx, no_self, fn_args);
1853+
// XXX: Bad copy.
1854+
let raw_llargs = create_llargs_for_fn_args(fcx, no_self, copy fn_args);
18541855
let ty_param_substs = match param_substs {
18551856
Some(ref substs) => /*bad*/copy substs.tys,
18561857
None => ~[]

branches/auto/src/libstd/getopts.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ pub fn opt_count(mm: &Matches, nm: &str) -> uint {
372372
pub fn opts_present(mm: &Matches, names: &[~str]) -> bool {
373373
for vec::each(names) |nm| {
374374
match find_opt(mm.opts, mkname(*nm)) {
375-
Some(_) => return true,
376-
None => ()
377-
}
375+
Some(id) if !mm.vals[id].is_empty() => return true,
376+
_ => (),
377+
};
378378
}
379379
false
380380
}
@@ -1177,7 +1177,7 @@ mod tests {
11771177
#[test]
11781178
pub fn test_multi() {
11791179
let args = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
1180-
let opts = ~[optopt(~"e"), optopt(~"encrypt")];
1180+
let opts = ~[optopt(~"e"), optopt(~"encrypt"), optopt(~"f")];
11811181
let matches = &match getopts(args, opts) {
11821182
result::Ok(m) => m,
11831183
result::Err(_) => fail!()
@@ -1186,6 +1186,7 @@ mod tests {
11861186
fail_unless!(opts_present(matches, ~[~"encrypt"]));
11871187
fail_unless!(opts_present(matches, ~[~"encrypt", ~"e"]));
11881188
fail_unless!(opts_present(matches, ~[~"e", ~"encrypt"]));
1189+
fail_unless!(!opts_present(matches, ~[~"f"]));
11891190
fail_unless!(!opts_present(matches, ~[~"thing"]));
11901191
fail_unless!(!opts_present(matches, ~[]));
11911192

branches/auto/src/libsyntax/ext/base.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ pub fn syntax_expander_table() -> SyntaxEnv {
148148
syntax_expanders.insert(@~"log_syntax",
149149
builtin_normal_tt(
150150
ext::log_syntax::expand_syntax_ext));
151+
syntax_expanders.insert(@~"deriving",
152+
@SE(ItemDecorator(
153+
ext::deriving::expand_meta_deriving)));
151154
syntax_expanders.insert(@~"deriving_eq",
152155
@SE(ItemDecorator(
153156
ext::deriving::expand_deriving_eq)));

branches/auto/src/libsyntax/ext/deriving.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,48 @@ type ExpandDerivingEnumDefFn = &self/fn(ext_ctxt,
5656
ident,
5757
y: &Generics) -> @item;
5858

59+
pub fn expand_meta_deriving(cx: ext_ctxt,
60+
_span: span,
61+
mitem: @meta_item,
62+
in_items: ~[@item])
63+
-> ~[@item] {
64+
use ast::{meta_list, meta_name_value, meta_word};
65+
66+
match mitem.node {
67+
meta_name_value(_, l) => {
68+
cx.span_err(l.span, ~"unexpected value in `deriving`");
69+
in_items
70+
}
71+
meta_word(_) | meta_list(_, []) => {
72+
cx.span_warn(mitem.span, ~"empty trait list in `deriving`");
73+
in_items
74+
}
75+
meta_list(_, titems) => {
76+
do titems.foldr(in_items) |&titem, in_items| {
77+
match titem.node {
78+
meta_name_value(tname, _) |
79+
meta_list(tname, _) |
80+
meta_word(tname) => {
81+
match *tname {
82+
~"Clone" => expand_deriving_clone(cx,
83+
titem.span, titem, in_items),
84+
~"Eq" => expand_deriving_eq(cx, titem.span,
85+
titem, in_items),
86+
~"IterBytes" => expand_deriving_iter_bytes(cx,
87+
titem.span, titem, in_items),
88+
tname => {
89+
cx.span_err(titem.span, fmt!("unknown \
90+
`deriving` trait: `%s`", tname));
91+
in_items
92+
}
93+
}
94+
}
95+
}
96+
}
97+
}
98+
}
99+
}
100+
59101
pub fn expand_deriving_eq(cx: ext_ctxt,
60102
span: span,
61103
_mitem: @meta_item,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[deriving(Eqr)] //~ ERROR unknown `deriving` trait: `Eqr`
12+
struct Foo;
13+
14+
pub fn main() {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// xfail-pretty
2+
3+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
4+
// file at the top-level directory of this distribution and at
5+
// http://rust-lang.org/COPYRIGHT.
6+
//
7+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
// option. This file may not be copied, modified, or distributed
11+
// except according to those terms.
12+
13+
#[deriving] //~ WARNING empty trait list in `deriving`
14+
struct Foo;
15+
16+
#[deriving()] //~ WARNING empty trait list in `deriving`
17+
struct Bar;
18+
19+
pub fn main() {}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// xfail-fast
2+
3+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
4+
// file at the top-level directory of this distribution and at
5+
// http://rust-lang.org/COPYRIGHT.
6+
//
7+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
// option. This file may not be copied, modified, or distributed
11+
// except according to those terms.
12+
13+
#[deriving(Eq)]
14+
#[deriving(Clone)]
15+
#[deriving(IterBytes)]
16+
struct Foo {
17+
bar: uint,
18+
baz: int
19+
}
20+
21+
pub fn main() {
22+
use core::hash::{Hash, HashUtil}; // necessary for IterBytes check
23+
24+
let a = Foo {bar: 4, baz: -3};
25+
26+
a == a; // check for Eq impl w/o testing its correctness
27+
a.clone(); // check for Clone impl w/o testing its correctness
28+
a.hash(); // check for IterBytes impl w/o testing its correctness
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// xfail-fast
2+
3+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
4+
// file at the top-level directory of this distribution and at
5+
// http://rust-lang.org/COPYRIGHT.
6+
//
7+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
// option. This file may not be copied, modified, or distributed
11+
// except according to those terms.
12+
13+
#[deriving(Eq, Clone, IterBytes)]
14+
struct Foo {
15+
bar: uint,
16+
baz: int
17+
}
18+
19+
pub fn main() {
20+
use core::hash::{Hash, HashUtil}; // necessary for IterBytes check
21+
22+
let a = Foo {bar: 4, baz: -3};
23+
24+
a == a; // check for Eq impl w/o testing its correctness
25+
a.clone(); // check for Clone impl w/o testing its correctness
26+
a.hash(); // check for IterBytes impl w/o testing its correctness
27+
}

0 commit comments

Comments
 (0)