Skip to content

Commit ee1de61

Browse files
committed
---
yaml --- r: 53818 b: refs/heads/dist-snap c: ece0986 h: refs/heads/master v: v3
1 parent 8823211 commit ee1de61

File tree

9 files changed

+141
-3
lines changed

9 files changed

+141
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 05c103238d977fe8c5d6b614f21f581069373524
10+
refs/heads/dist-snap: ece098667d8ac56f537caa04810d3d1a8097e81f
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/etc/tidy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from licenseck import *
66

77
err=0
8-
cols=100
8+
cols=78
99

1010
# Be careful to support Python 2.4, 2.6, and 3.x here!
1111
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,11 @@ pub fn link_binary(sess: Session,
818818
do cstore::iter_crate_data(cstore) |crate_num, _| {
819819
let link_args = csearch::get_link_args_for_crate(cstore, crate_num);
820820
do vec::consume(link_args) |_, link_arg| {
821-
cc_args.push(link_arg);
821+
// Linker arguments that don't begin with - are likely file names,
822+
// so they should not be necessary.
823+
if link_arg.starts_with("-") {
824+
cc_args.push(link_arg);
825+
}
822826
}
823827
}
824828

branches/dist-snap/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/dist-snap/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)