Skip to content

Commit 15104d5

Browse files
committed
---
yaml --- r: 103607 b: refs/heads/try c: 1fdd231 h: refs/heads/master i: 103605: fdf5d49 103603: c8b899f 103599: f07e3c8 v: v3
1 parent a89f701 commit 15104d5

File tree

167 files changed

+2819
-2534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+2819
-2534
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
5-
refs/heads/try: 2846ee6ba54ccebaa4aa5518a866badf88f44a75
5+
refs/heads/try: 1fdd23166d4b0d7791111b8067fec38d711c79c5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/mk/tests.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ ifeq ($(NO_REBUILD),)
344344
STDTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
345345
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.extra \
346346
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustuv \
347-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.green
347+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.green \
348+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.native
348349
else
349350
STDTESTDEP_$(1)_$(2)_$(3)_$(4) =
350351
endif

branches/try/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
<keyword>f64</keyword>
8888
<keyword>char</keyword>
8989
<keyword>str</keyword>
90-
<keyword>Either</keyword>
9190
<keyword>Option</keyword>
9291
<keyword>Result</keyword>
9392
</context>
@@ -134,8 +133,6 @@
134133
<keyword>false</keyword>
135134
<keyword>Some</keyword>
136135
<keyword>None</keyword>
137-
<keyword>Left</keyword>
138-
<keyword>Right</keyword>
139136
<keyword>Ok</keyword>
140137
<keyword>Err</keyword>
141138
<keyword>Success</keyword>
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/env python
2+
# xfail-license
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+
"""
14+
This script creates a pile of compile-fail tests check that all the
15+
derivings have spans that point to the fields, rather than the
16+
#[deriving(...)] line.
17+
18+
sample usage: src/etc/generate-deriving-span-tests.py
19+
"""
20+
21+
import sys, os, datetime, stat
22+
23+
TEST_DIR = os.path.abspath(
24+
os.path.join(os.path.dirname(__file__), '../test/compile-fail'))
25+
26+
YEAR = datetime.datetime.now().year
27+
28+
TEMPLATE = """// Copyright {year} The Rust Project Developers. See the COPYRIGHT
29+
// file at the top-level directory of this distribution and at
30+
// http://rust-lang.org/COPYRIGHT.
31+
//
32+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
33+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
34+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
35+
// option. This file may not be copied, modified, or distributed
36+
// except according to those terms.
37+
38+
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
39+
40+
#[feature(struct_variant)];
41+
extern mod extra;
42+
43+
{error_deriving}
44+
struct Error;
45+
{code}
46+
fn main() {{}}
47+
"""
48+
49+
ENUM_STRING = """
50+
#[deriving({traits})]
51+
enum Enum {{
52+
A(
53+
Error {errors}
54+
)
55+
}}
56+
"""
57+
ENUM_STRUCT_VARIANT_STRING = """
58+
#[deriving({traits})]
59+
enum Enum {{
60+
A {{
61+
x: Error {errors}
62+
}}
63+
}}
64+
"""
65+
STRUCT_STRING = """
66+
#[deriving({traits})]
67+
struct Struct {{
68+
x: Error {errors}
69+
}}
70+
"""
71+
STRUCT_TUPLE_STRING = """
72+
#[deriving({traits})]
73+
struct Struct(
74+
Error {errors}
75+
);
76+
"""
77+
78+
ENUM_TUPLE, ENUM_STRUCT, STRUCT_FIELDS, STRUCT_TUPLE = range(4)
79+
80+
def create_test_case(type, trait, super_traits, number_of_errors):
81+
string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type]
82+
all_traits = ','.join([trait] + super_traits)
83+
super_traits = ','.join(super_traits)
84+
error_deriving = '#[deriving(%s)]' % super_traits if super_traits else ''
85+
86+
errors = '\n'.join('//~%s ERROR' % ('^' * n) for n in range(error_count))
87+
code = string.format(traits = all_traits, errors = errors)
88+
return TEMPLATE.format(year = YEAR, error_deriving=error_deriving, code = code)
89+
90+
def write_file(name, string):
91+
test_file = os.path.join(TEST_DIR, 'deriving-span-%s.rs' % name)
92+
93+
# set write permission if file exists, so it can be changed
94+
if os.path.exists(test_file):
95+
os.chmod(test_file, stat.S_IWUSR)
96+
97+
with open(test_file, 'wt') as f:
98+
f.write(string)
99+
100+
# mark file read-only
101+
os.chmod(test_file, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
102+
103+
104+
105+
ENUM = 1
106+
STRUCT = 2
107+
ALL = STRUCT | ENUM
108+
109+
traits = {
110+
'Zero': (STRUCT, [], 1),
111+
'Default': (STRUCT, [], 1),
112+
'FromPrimitive': (0, [], 0), # only works for C-like enums
113+
114+
'Decodable': (0, [], 0), # FIXME: quoting gives horrible spans
115+
'Encodable': (0, [], 0), # FIXME: quoting gives horrible spans
116+
}
117+
118+
for (trait, supers, errs) in [('Rand', [], 1),
119+
('Clone', [], 1), ('DeepClone', ['Clone'], 1),
120+
('Eq', [], 2), ('Ord', [], 8),
121+
('TotalEq', [], 1), ('TotalOrd', ['TotalEq'], 1)]:
122+
traits[trait] = (ALL, supers, errs)
123+
124+
for (trait, (types, super_traits, error_count)) in traits.items():
125+
mk = lambda ty: create_test_case(ty, trait, super_traits, error_count)
126+
if types & ENUM:
127+
write_file(trait + '-enum', mk(ENUM_TUPLE))
128+
write_file(trait + '-enum-struct-variant', mk(ENUM_STRUCT))
129+
if types & STRUCT:
130+
write_file(trait + '-struct', mk(STRUCT_FIELDS))
131+
write_file(trait + '-tuple-struct', mk(STRUCT_TUPLE))

branches/try/src/etc/kate/rust.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
<item> float </item>
8787
<item> char </item>
8888
<item> str </item>
89-
<item> Either </item>
9089
<item> Option </item>
9190
<item> Result </item>
9291
<item> Self </item>
@@ -131,8 +130,6 @@
131130
<item> false </item>
132131
<item> Some </item>
133132
<item> None </item>
134-
<item> Left </item>
135-
<item> Right </item>
136133
<item> Ok </item>
137134
<item> Err </item>
138135
<item> Success </item>

branches/try/src/etc/vim/syntax/rust.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ syn keyword rustType f64 i8 i16 i32 i64 str Self
4646
" to make it easy to update.
4747

4848
" Core operators {{{3
49-
syn keyword rustEnum Either
50-
syn keyword rustEnumVariant Left Right
5149
syn keyword rustTrait Sized
5250
syn keyword rustTrait Freeze Send
5351
syn keyword rustTrait Add Sub Mul Div Rem Neg Not
@@ -113,7 +111,6 @@ syn keyword rustSelf self
113111
syn keyword rustBoolean true false
114112

115113
syn keyword rustConstant Some None " option
116-
syn keyword rustConstant Left Right " either
117114
syn keyword rustConstant Ok Err " result
118115
syn keyword rustConstant Less Equal Greater " Ordering
119116

branches/try/src/libextra/dlist.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,17 @@ struct Node<T> {
4747
}
4848

4949
/// Double-ended DList iterator
50-
#[deriving(Clone)]
5150
pub struct Items<'a, T> {
5251
priv head: &'a Link<T>,
5352
priv tail: Rawlink<Node<T>>,
5453
priv nelem: uint,
5554
}
5655

56+
// FIXME #11820: the &'a Option<> of the Link stops clone working.
57+
impl<'a, T> Clone for Items<'a, T> {
58+
fn clone(&self) -> Items<'a, T> { *self }
59+
}
60+
5761
/// Double-ended mutable DList iterator
5862
pub struct MutItems<'a, T> {
5963
priv list: &'a mut DList<T>,

branches/try/src/libextra/sync.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ impl<'a> RWLockReadMode<'a> {
686686

687687
/// A barrier enables multiple tasks to synchronize the beginning
688688
/// of some computation.
689+
///
689690
/// ```rust
690691
/// use extra::sync::Barrier;
691692
///

branches/try/src/libextra/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ pub fn run_test(force_ignore: bool,
895895
return;
896896
}
897897
StaticBenchFn(benchfn) => {
898-
let bs = ::test::bench::benchmark(benchfn);
898+
let bs = ::test::bench::benchmark(|harness| benchfn(harness));
899899
monitor_ch.send((desc, TrBench(bs)));
900900
return;
901901
}

branches/try/src/librustc/back/abi.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ pub static general_code_alignment: uint = 16u;
4242

4343
pub static tydesc_field_size: uint = 0u;
4444
pub static tydesc_field_align: uint = 1u;
45-
pub static tydesc_field_take_glue: uint = 2u;
46-
pub static tydesc_field_drop_glue: uint = 3u;
47-
pub static tydesc_field_visit_glue: uint = 4u;
48-
pub static tydesc_field_name_offset: uint = 5u;
49-
pub static n_tydesc_fields: uint = 6u;
45+
pub static tydesc_field_drop_glue: uint = 2u;
46+
pub static tydesc_field_visit_glue: uint = 3u;
47+
pub static tydesc_field_name_offset: uint = 4u;
48+
pub static n_tydesc_fields: uint = 5u;
5049

5150
// The two halves of a closure: code and environment.
5251
pub static fn_field_code: uint = 0u;

branches/try/src/librustc/driver/driver.rs

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -897,42 +897,56 @@ pub fn build_session_options(binary: ~str,
897897
return sopts;
898898
}
899899

900-
pub fn build_session(sopts: @session::Options, demitter: @diagnostic::Emitter)
900+
pub fn build_session(sopts: @session::Options,
901+
local_crate_source_file: Option<Path>,
902+
demitter: @diagnostic::Emitter)
901903
-> Session {
902904
let codemap = @codemap::CodeMap::new();
903905
let diagnostic_handler =
904906
diagnostic::mk_handler(Some(demitter));
905907
let span_diagnostic_handler =
906908
diagnostic::mk_span_handler(diagnostic_handler, codemap);
907-
build_session_(sopts, codemap, demitter, span_diagnostic_handler)
909+
910+
build_session_(sopts, local_crate_source_file, codemap, demitter, span_diagnostic_handler)
908911
}
909912

910913
pub fn build_session_(sopts: @session::Options,
911-
cm: @codemap::CodeMap,
914+
local_crate_source_file: Option<Path>,
915+
codemap: @codemap::CodeMap,
912916
demitter: @diagnostic::Emitter,
913917
span_diagnostic_handler: @diagnostic::SpanHandler)
914918
-> Session {
915919
let target_cfg = build_target_config(sopts, demitter);
916-
let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler,
917-
cm);
920+
let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler, codemap);
918921
let cstore = @CStore::new(token::get_ident_interner());
919922
let filesearch = @filesearch::FileSearch::new(
920923
&sopts.maybe_sysroot,
921924
sopts.target_triple,
922925
sopts.addl_lib_search_paths);
926+
927+
// Make the path absolute, if necessary
928+
let local_crate_source_file = local_crate_source_file.map(|path|
929+
if path.is_absolute() {
930+
path.clone()
931+
} else {
932+
os::getcwd().join(path.clone())
933+
}
934+
);
935+
923936
@Session_ {
924937
targ_cfg: target_cfg,
925938
opts: sopts,
926939
cstore: cstore,
927940
parse_sess: p_s,
928-
codemap: cm,
941+
codemap: codemap,
929942
// For a library crate, this is always none
930943
entry_fn: RefCell::new(None),
931944
entry_type: Cell::new(None),
932945
macro_registrar_fn: RefCell::new(None),
933946
span_diagnostic: span_diagnostic_handler,
934947
filesearch: filesearch,
935948
building_library: Cell::new(false),
949+
local_crate_source_file: local_crate_source_file,
936950
working_dir: os::getcwd(),
937951
lints: RefCell::new(HashMap::new()),
938952
node_id: Cell::new(1),
@@ -1164,13 +1178,8 @@ mod test {
11641178
Ok(m) => m,
11651179
Err(f) => fail!("test_switch_implies_cfg_test: {}", f.to_err_msg())
11661180
};
1167-
let sessopts = build_session_options(
1168-
~"rustc",
1169-
matches,
1170-
@diagnostic::DefaultEmitter as @diagnostic::Emitter);
1171-
let sess = build_session(sessopts,
1172-
@diagnostic::DefaultEmitter as
1173-
@diagnostic::Emitter);
1181+
let sessopts = build_session_options(~"rustc", matches, @diagnostic::DefaultEmitter);
1182+
let sess = build_session(sessopts, None, @diagnostic::DefaultEmitter);
11741183
let cfg = build_configuration(sess);
11751184
assert!((attr::contains_name(cfg, "test")));
11761185
}
@@ -1187,13 +1196,8 @@ mod test {
11871196
f.to_err_msg());
11881197
}
11891198
};
1190-
let sessopts = build_session_options(
1191-
~"rustc",
1192-
matches,
1193-
@diagnostic::DefaultEmitter as @diagnostic::Emitter);
1194-
let sess = build_session(sessopts,
1195-
@diagnostic::DefaultEmitter as
1196-
@diagnostic::Emitter);
1199+
let sessopts = build_session_options(~"rustc", matches, @diagnostic::DefaultEmitter);
1200+
let sess = build_session(sessopts, None, @diagnostic::DefaultEmitter);
11971201
let cfg = build_configuration(sess);
11981202
let mut test_items = cfg.iter().filter(|m| "test" == m.name());
11991203
assert!(test_items.next().is_some());

branches/try/src/librustc/driver/session.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ pub struct Session_ {
211211
macro_registrar_fn: RefCell<Option<ast::DefId>>,
212212
filesearch: @filesearch::FileSearch,
213213
building_library: Cell<bool>,
214+
// The name of the root source file of the crate, in the local file system. The path is always
215+
// expected to be absolute. `None` means that there is no source file.
216+
local_crate_source_file: Option<Path>,
214217
working_dir: Path,
215218
lints: RefCell<HashMap<ast::NodeId,
216219
~[(lint::Lint, codemap::Span, ~str)]>>,

branches/try/src/librustc/front/feature_gate.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
4646
("phase", Active),
4747
("macro_registrar", Active),
4848
("log_syntax", Active),
49+
("trace_macros", Active),
50+
("simd", Active),
4951

5052
// These are used to test this portion of the compiler, they don't actually
5153
// mean anything
@@ -170,6 +172,13 @@ impl Visitor<()> for Context {
170172
}
171173
}
172174

175+
ast::ItemStruct(..) => {
176+
if attr::contains_name(i.attrs, "simd") {
177+
self.gate_feature("simd", i.span,
178+
"SIMD types are experimental and possibly buggy");
179+
}
180+
}
181+
173182
_ => {}
174183
}
175184

@@ -193,6 +202,10 @@ impl Visitor<()> for Context {
193202
self.gate_feature("log_syntax", path.span, "`log_syntax!` is not \
194203
stable enough for use and is subject to change");
195204
}
205+
else if path.segments.last().unwrap().identifier == self.sess.ident_of("trace_macros") {
206+
self.gate_feature("trace_macros", path.span, "`trace_macros` is not \
207+
stable enough for use and is subject to change");
208+
}
196209
}
197210

198211
fn visit_ty(&mut self, t: &ast::Ty, _: ()) {

0 commit comments

Comments
 (0)