Skip to content

Commit 9e71904

Browse files
committed
---
yaml --- r: 107695 b: refs/heads/dist-snap c: feacb59 h: refs/heads/master i: 107693: a1904b0 107691: 474a775 107687: 77d76be 107679: e1917b4 v: v3
1 parent 194a16d commit 9e71904

File tree

136 files changed

+2511
-2315
lines changed

Some content is hidden

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

136 files changed

+2511
-2315
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: b4bb8c0f4ee1234e9d84aa7cb1a9ad691a509212
9+
refs/heads/dist-snap: feacb594669f505d2f7ba0805c7fd5c5d7d28bad
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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', [], 2), ('TotalOrd', ['TotalEq'], 2)]:
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/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/src/librustc/front/feature_gate.rs

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

5051
// These are used to test this portion of the compiler, they don't actually
5152
// mean anything
@@ -193,6 +194,10 @@ impl Visitor<()> for Context {
193194
self.gate_feature("log_syntax", path.span, "`log_syntax!` is not \
194195
stable enough for use and is subject to change");
195196
}
197+
else if path.segments.last().unwrap().identifier == self.sess.ident_of("trace_macros") {
198+
self.gate_feature("trace_macros", path.span, "`trace_macros` is not \
199+
stable enough for use and is subject to change");
200+
}
196201
}
197202

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

branches/dist-snap/src/librustc/metadata/common.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,24 +176,23 @@ pub static tag_link_args_arg: uint = 0x7a;
176176

177177
pub static tag_item_method_tps: uint = 0x7b;
178178
pub static tag_item_method_fty: uint = 0x7c;
179-
pub static tag_item_method_transformed_self_ty: uint = 0x7d;
180179

181-
pub static tag_mod_child: uint = 0x7e;
182-
pub static tag_misc_info: uint = 0x7f;
183-
pub static tag_misc_info_crate_items: uint = 0x80;
180+
pub static tag_mod_child: uint = 0x7d;
181+
pub static tag_misc_info: uint = 0x7e;
182+
pub static tag_misc_info_crate_items: uint = 0x7f;
184183

185-
pub static tag_item_method_provided_source: uint = 0x81;
186-
pub static tag_item_impl_vtables: uint = 0x82;
184+
pub static tag_item_method_provided_source: uint = 0x80;
185+
pub static tag_item_impl_vtables: uint = 0x81;
187186

188-
pub static tag_impls: uint = 0x83;
189-
pub static tag_impls_impl: uint = 0x84;
187+
pub static tag_impls: uint = 0x82;
188+
pub static tag_impls_impl: uint = 0x83;
190189

191-
pub static tag_items_data_item_inherent_impl: uint = 0x85;
192-
pub static tag_items_data_item_extension_impl: uint = 0x86;
190+
pub static tag_items_data_item_inherent_impl: uint = 0x84;
191+
pub static tag_items_data_item_extension_impl: uint = 0x85;
193192

194-
pub static tag_path_elem_pretty_name: uint = 0x87;
195-
pub static tag_path_elem_pretty_name_ident: uint = 0x88;
196-
pub static tag_path_elem_pretty_name_extra: uint = 0x89;
193+
pub static tag_path_elem_pretty_name: uint = 0x86;
194+
pub static tag_path_elem_pretty_name_ident: uint = 0x87;
195+
pub static tag_path_elem_pretty_name_extra: uint = 0x88;
197196

198197
pub static tag_region_param_def: uint = 0x100;
199198
pub static tag_region_param_def_ident: uint = 0x101;

branches/dist-snap/src/librustc/metadata/decoder.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,6 @@ fn doc_method_fty(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::BareFnTy {
227227
|_, did| translate_def_id(cdata, did))
228228
}
229229

230-
fn doc_transformed_self_ty(doc: ebml::Doc,
231-
tcx: ty::ctxt,
232-
cdata: Cmd) -> Option<ty::t>
233-
{
234-
reader::maybe_get_doc(doc, tag_item_method_transformed_self_ty).map(|tp| {
235-
parse_ty_data(tp.data, cdata.cnum, tp.start, tcx,
236-
|_, did| translate_def_id(cdata, did))
237-
})
238-
}
239-
240230
pub fn item_type(_item_id: ast::DefId, item: ebml::Doc,
241231
tcx: ty::ctxt, cdata: Cmd) -> ty::t {
242232
doc_type(item, tcx, cdata)
@@ -781,9 +771,9 @@ fn get_explicit_self(item: ebml::Doc) -> ast::ExplicitSelf_ {
781771
let explicit_self_kind = string[0];
782772
match explicit_self_kind as char {
783773
's' => ast::SelfStatic,
784-
'v' => ast::SelfValue(get_mutability(string[1])),
774+
'v' => ast::SelfValue,
785775
'@' => ast::SelfBox,
786-
'~' => ast::SelfUniq(get_mutability(string[1])),
776+
'~' => ast::SelfUniq,
787777
// FIXME(#4846) expl. region
788778
'&' => ast::SelfRegion(None, get_mutability(string[1])),
789779
_ => fail!("unknown self type code: `{}`", explicit_self_kind as char)
@@ -847,7 +837,6 @@ pub fn get_method(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
847837
let type_param_defs = item_ty_param_defs(method_doc, tcx, cdata,
848838
tag_item_method_tps);
849839
let rp_defs = item_region_param_defs(method_doc, tcx, cdata);
850-
let transformed_self_ty = doc_transformed_self_ty(method_doc, tcx, cdata);
851840
let fty = doc_method_fty(method_doc, tcx, cdata);
852841
let vis = item_visibility(method_doc);
853842
let explicit_self = get_explicit_self(method_doc);
@@ -859,7 +848,6 @@ pub fn get_method(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
859848
type_param_defs: type_param_defs,
860849
region_param_defs: rp_defs,
861850
},
862-
transformed_self_ty,
863851
fty,
864852
explicit_self,
865853
vis,

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,6 @@ fn encode_type(ecx: &EncodeContext,
261261
ebml_w.end_tag();
262262
}
263263

264-
fn encode_transformed_self_ty(ecx: &EncodeContext,
265-
ebml_w: &mut writer::Encoder,
266-
opt_typ: Option<ty::t>) {
267-
for &typ in opt_typ.iter() {
268-
ebml_w.start_tag(tag_item_method_transformed_self_ty);
269-
write_type(ecx, ebml_w, typ);
270-
ebml_w.end_tag();
271-
}
272-
}
273-
274264
fn encode_method_fty(ecx: &EncodeContext,
275265
ebml_w: &mut writer::Encoder,
276266
typ: &ty::BareFnTy) {
@@ -679,23 +669,13 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::Explic
679669

680670
// Encode the base self type.
681671
match explicit_self {
682-
SelfStatic => {
683-
ebml_w.writer.write(&[ 's' as u8 ]);
684-
}
685-
SelfValue(m) => {
686-
ebml_w.writer.write(&[ 'v' as u8 ]);
687-
encode_mutability(ebml_w, m);
688-
}
672+
SelfStatic => ebml_w.writer.write(&[ 's' as u8 ]),
673+
SelfValue => ebml_w.writer.write(&[ 'v' as u8 ]),
674+
SelfBox => ebml_w.writer.write(&[ '@' as u8 ]),
675+
SelfUniq => ebml_w.writer.write(&[ '~' as u8 ]),
689676
SelfRegion(_, m) => {
690677
// FIXME(#4846) encode custom lifetime
691-
ebml_w.writer.write(&[ '&' as u8 ]);
692-
encode_mutability(ebml_w, m);
693-
}
694-
SelfBox => {
695-
ebml_w.writer.write(&[ '@' as u8 ]);
696-
}
697-
SelfUniq(m) => {
698-
ebml_w.writer.write(&[ '~' as u8 ]);
678+
ebml_w.writer.write(&['&' as u8]);
699679
encode_mutability(ebml_w, m);
700680
}
701681
}
@@ -807,7 +787,6 @@ fn encode_method_ty_fields(ecx: &EncodeContext,
807787
encode_ty_type_param_defs(ebml_w, ecx,
808788
method_ty.generics.type_param_defs,
809789
tag_item_method_tps);
810-
encode_transformed_self_ty(ecx, ebml_w, method_ty.transformed_self_ty);
811790
encode_method_fty(ecx, ebml_w, &method_ty.fty);
812791
encode_visibility(ebml_w, method_ty.vis);
813792
encode_explicit_self(ebml_w, method_ty.explicit_self);

branches/dist-snap/src/librustc/metadata/tydecode.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,6 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
374374
return ty::mk_bare_fn(st.tcx, parse_bare_fn_ty(st, |x,y| conv(x,y)));
375375
}
376376
'Y' => return ty::mk_type(st.tcx),
377-
'C' => {
378-
let sigil = parse_sigil(st);
379-
return ty::mk_opaque_closure_ptr(st.tcx, sigil);
380-
}
381377
'#' => {
382378
let pos = parse_hex(st);
383379
assert_eq!(next(st), ':');

branches/dist-snap/src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,6 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
327327
mywrite!(w, "s{}|", (cx.ds)(did));
328328
}
329329
ty::ty_type => mywrite!(w, "Y"),
330-
ty::ty_opaque_closure_ptr(p) => {
331-
mywrite!(w, "C&");
332-
enc_sigil(w, p);
333-
}
334330
ty::ty_struct(def, ref substs) => {
335331
mywrite!(w, "a[{}|", (cx.ds)(def));
336332
enc_substs(w, cx, substs);

0 commit comments

Comments
 (0)