Skip to content

Commit 877fcbf

Browse files
committed
---
yaml --- r: 66175 b: refs/heads/master c: ce857e3 h: refs/heads/master i: 66173: d7af184 66171: a8849c0 66167: 3dbe7f6 66159: dcd4bee 66143: 65976b6 66111: f0fe15d 66047: d585d33 v: v3
1 parent 2901d5f commit 877fcbf

Some content is hidden

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

48 files changed

+263
-145
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 8cadca4e41f2aad72391b834f295ae01f9c29551
2+
refs/heads/master: ce857e3d60da1b5eff5d830dbd03f32a8890ad16
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/etc/vim/syntax/rust.vim

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: Rust
33
" Maintainer: Patrick Walton <[email protected]>
44
" Maintainer: Ben Blum <[email protected]>
5-
" Last Change: 2012 Dec 25
5+
" Last Change: 2012 Jun 14
66

77
if version < 600
88
syntax clear
@@ -13,13 +13,16 @@ endif
1313
syn keyword rustConditional match if else
1414
syn keyword rustOperator as
1515

16+
syn match rustAssert "\<assert\(\w\)*!"
17+
syn match rustFail "\<fail\(\w\)*!"
1618
syn keyword rustKeyword break copy do drop extern
1719
syn keyword rustKeyword for if impl let log
1820
syn keyword rustKeyword copy do extern
1921
syn keyword rustKeyword for impl let log
2022
syn keyword rustKeyword loop mod once priv pub
2123
syn keyword rustKeyword return
22-
syn keyword rustKeyword unsafe use while
24+
syn keyword rustKeyword unsafe while
25+
syn keyword rustKeyword use nextgroup=rustModPath skipwhite
2326
" FIXME: Scoped impl's name is also fallen in this category
2427
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite
2528
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
@@ -45,7 +48,8 @@ syn keyword rustType c_longlong c_ulonglong intptr_t uintptr_t
4548
syn keyword rustType off_t dev_t ino_t pid_t mode_t ssize_t
4649

4750
syn keyword rustTrait Const Copy Send Owned Sized " inherent traits
48-
syn keyword rustTrait Eq Ord Num Ptr
51+
syn keyword rustTrait Clone Decodable Encodable IterBytes Rand ToStr
52+
syn keyword rustTrait Eq Ord TotalEq TotalOrd Num Ptr
4953
syn keyword rustTrait Drop Add Sub Mul Quot Rem Neg BitAnd BitOr
5054
syn keyword rustTrait BitXor Shl Shr Index
5155

@@ -72,19 +76,21 @@ syn keyword rustConstant STDIN_FILENO STDOUT_FILENO STDERR_FILENO
7276
" If foo::bar changes to foo.bar, change this ("::" to "\.").
7377
" If foo::bar changes to Foo::bar, change this (first "\w" to "\u").
7478
syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3
79+
syn match rustModPath "\w\(\w\)*" contained " only for 'use path;'
7580
syn match rustModPathSep "::"
7681

7782
syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1
7883
syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>();
7984

80-
syn match rustMacro '\w\(\w\)*!'
81-
syn match rustMacro '#\w\(\w\)*'
85+
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail
86+
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
8287

8388
syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained
8489
syn match rustFormat display "%%" contained
8590
syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat
8691

87-
syn region rustAttribute start="#\[" end="\]" contains=rustString
92+
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
93+
syn region rustDeriving start="deriving(" end=")" contains=rustTrait
8894

8995
" Number literals
9096
syn match rustNumber display "\<[0-9][0-9_]*\>"
@@ -143,11 +149,17 @@ hi def link rustMacro Macro
143149
hi def link rustType Type
144150
hi def link rustTodo Todo
145151
hi def link rustAttribute PreProc
152+
hi def link rustDeriving PreProc
146153
hi def link rustStorage StorageClass
147154
hi def link rustLifetime Special
148155

149156
" Other Suggestions:
157+
" hi rustAttribute ctermfg=cyan
158+
" hi rustDeriving ctermfg=cyan
159+
" hi rustAssert ctermfg=yellow
160+
" hi rustFail ctermfg=red
150161
" hi rustMacro ctermfg=magenta
162+
" hi rustModPathSep ctermfg=grey
151163

152164
syn sync minlines=200
153165
syn sync maxlines=500

trunk/src/libextra/time.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,9 @@ mod tests {
11421142
assert!(result::unwrap(strptime("-0800", "%z")).tm_gmtoff ==
11431143
0);
11441144
assert!(test("%", "%%"));
1145+
1146+
// Test for #7256
1147+
assert_eq!(strptime("360", "%Y-%m-%d"), Err(~"Invalid year"))
11451148
}
11461149
11471150
fn test_ctime() {

trunk/src/librustc/back/abi.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,11 @@ pub static slice_elt_len: uint = 1u;
7474
pub static worst_case_glue_call_args: uint = 7u;
7575

7676
pub static abi_version: uint = 1u;
77+
78+
pub fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; }
79+
80+
pub fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; }
81+
82+
pub fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; }
83+
84+
pub fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; }

trunk/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,8 @@ fn encode_info_for_item(ecx: &EncodeContext,
954954
encode_name(ecx, ebml_w, item.ident);
955955
encode_attributes(ebml_w, item.attrs);
956956
match ty.node {
957-
ast::ty_path(path, _) if path.idents.len() == 1 => {
957+
ast::ty_path(path, bounds, _) if path.idents.len() == 1 => {
958+
assert!(bounds.is_empty());
958959
encode_impl_type_basename(ecx, ebml_w,
959960
ast_util::path_to_ident(path));
960961
}

trunk/src/librustc/metadata/tydecode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,9 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
311311
let substs = parse_substs(st, conv);
312312
let store = parse_trait_store(st);
313313
let mt = parse_mutability(st);
314+
let bounds = parse_bounds(st, conv);
314315
assert_eq!(next(st), ']');
315-
return ty::mk_trait(st.tcx, def, substs, store, mt);
316+
return ty::mk_trait(st.tcx, def, substs, store, mt, bounds.builtin_bounds);
316317
}
317318
'p' => {
318319
let did = parse_def(st, TypeParameter, conv);

trunk/src/librustc/metadata/tyencode.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,16 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, st: ty::sty) {
261261
enc_substs(w, cx, substs);
262262
w.write_char(']');
263263
}
264-
ty::ty_trait(def, ref substs, store, mt) => {
264+
ty::ty_trait(def, ref substs, store, mt, bounds) => {
265265
w.write_str(&"x[");
266266
w.write_str((cx.ds)(def));
267267
w.write_char('|');
268268
enc_substs(w, cx, substs);
269269
enc_trait_store(w, cx, store);
270270
enc_mutability(w, mt);
271+
let bounds = ty::ParamBounds {builtin_bounds: bounds,
272+
trait_bounds: ~[]};
273+
enc_bounds(w, cx, &bounds);
271274
w.write_char(']');
272275
}
273276
ty::ty_tup(ts) => {

trunk/src/librustc/middle/kind.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ fn check_item(item: @item, (cx, visitor): (Context, visit::vt<Context>)) {
129129
if cx.tcx.lang_items.drop_trait() == trait_def_id {
130130
// Yes, it's a destructor.
131131
match self_type.node {
132-
ty_path(_, path_node_id) => {
132+
ty_path(_, bounds, path_node_id) => {
133+
assert!(bounds.is_empty());
133134
let struct_def = cx.tcx.def_map.get_copy(
134135
&path_node_id);
135136
let struct_did =
@@ -307,7 +308,7 @@ pub fn check_expr(e: @expr, (cx, v): (Context, visit::vt<Context>)) {
307308

308309
fn check_ty(aty: @Ty, (cx, v): (Context, visit::vt<Context>)) {
309310
match aty.node {
310-
ty_path(_, id) => {
311+
ty_path(_, _, id) => {
311312
let r = cx.tcx.node_type_substs.find(&id);
312313
for r.iter().advance |ts| {
313314
let did = ast_util::def_id_of_def(cx.tcx.def_map.get_copy(&id));
@@ -533,7 +534,8 @@ pub fn check_cast_for_escaping_regions(
533534
pub fn check_kind_bounds_of_cast(cx: Context, source: @expr, target: @expr) {
534535
let target_ty = ty::expr_ty(cx.tcx, target);
535536
match ty::get(target_ty).sty {
536-
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
537+
// FIXME(#3569) kind check bounds here
538+
ty::ty_trait(_, _, ty::UniqTraitStore, _, _bounds) => {
537539
let source_ty = ty::expr_ty(cx.tcx, source);
538540
if !ty::type_is_owned(cx.tcx, source_ty) {
539541
cx.tcx.sess.span_err(

trunk/src/librustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ fn check_item_ctypes(cx: &Context, it: @ast::item) {
714714
let tys = vec::map(decl.inputs, |a| a.ty );
715715
for vec::each(vec::append_one(tys, decl.output)) |ty| {
716716
match ty.node {
717-
ast::ty_path(_, id) => {
717+
ast::ty_path(_, _, id) => {
718718
match cx.tcx.def_map.get_copy(&id) {
719719
ast::def_prim_ty(ast::ty_int(ast::ty_i)) => {
720720
cx.span_lint(ctypes, ty.span,

trunk/src/librustc/middle/region.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ pub fn determine_rp_in_ty(ty: @ast::Ty,
804804
// then check whether it is region-parameterized and consider
805805
// that as a direct dependency.
806806
match ty.node {
807-
ast::ty_path(path, id) => {
807+
ast::ty_path(path, _bounds, id) => {
808808
match cx.def_map.find(&id) {
809809
Some(&ast::def_ty(did)) |
810810
Some(&ast::def_trait(did)) |
@@ -840,7 +840,7 @@ pub fn determine_rp_in_ty(ty: @ast::Ty,
840840
visit_mt(mt, (cx, visitor));
841841
}
842842

843-
ast::ty_path(path, _) => {
843+
ast::ty_path(path, _bounds, _) => {
844844
// type parameters are---for now, anyway---always invariant
845845
do cx.with_ambient_variance(rv_invariant) {
846846
for path.types.iter().advance |tp| {

trunk/src/librustc/middle/resolve.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ impl Resolver {
12501250
// If there are static methods, then create the module
12511251
// and add them.
12521252
match (trait_ref_opt, ty) {
1253-
(None, @Ty { node: ty_path(path, _), _ }) if
1253+
(None, @Ty { node: ty_path(path, _, _), _ }) if
12541254
has_static_methods && path.idents.len() == 1 => {
12551255
let name = path_to_ident(path);
12561256

@@ -1415,24 +1415,26 @@ impl Resolver {
14151415
(ReducedGraphParent,
14161416
vt<ReducedGraphParent>)) {
14171417
let ident = variant.node.name;
1418-
let (child, _) = self.add_child(ident, parent, ForbidDuplicateValues,
1419-
variant.span);
1420-
1421-
let privacy;
1422-
match variant.node.vis {
1423-
public => privacy = Public,
1424-
private => privacy = Private,
1425-
inherited => privacy = parent_privacy
1426-
}
1418+
1419+
let privacy =
1420+
match variant.node.vis {
1421+
public => Public,
1422+
private => Private,
1423+
inherited => parent_privacy
1424+
};
14271425

14281426
match variant.node.kind {
14291427
tuple_variant_kind(_) => {
1428+
let (child, _) = self.add_child(ident, parent, ForbidDuplicateValues,
1429+
variant.span);
14301430
child.define_value(privacy,
14311431
def_variant(item_id,
14321432
local_def(variant.node.id)),
14331433
variant.span);
14341434
}
14351435
struct_variant_kind(_) => {
1436+
let (child, _) = self.add_child(ident, parent, ForbidDuplicateTypesAndValues,
1437+
variant.span);
14361438
child.define_type(privacy,
14371439
def_variant(item_id,
14381440
local_def(variant.node.id)),
@@ -4118,7 +4120,7 @@ impl Resolver {
41184120
// Like path expressions, the interpretation of path types depends
41194121
// on whether the path has multiple elements in it or not.
41204122

4121-
ty_path(path, path_id) => {
4123+
ty_path(path, bounds, path_id) => {
41224124
// This is a path in the type namespace. Walk through scopes
41234125
// scopes looking for it.
41244126
let mut result_def = None;
@@ -4177,6 +4179,10 @@ impl Resolver {
41774179
self.idents_to_str(path.idents)));
41784180
}
41794181
}
4182+
4183+
for bounds.each |bound| {
4184+
self.resolve_type_parameter_bound(bound, visitor);
4185+
}
41804186
}
41814187

41824188
ty_closure(c) => {

trunk/src/librustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ fn create_ty(cx: @mut CrateContext, t: ty::t, span: span) -> DIType {
561561
cx.sess.span_note(span, "debuginfo for closure NYI");
562562
create_unimpl_ty(cx, t)
563563
},
564-
ty::ty_trait(_did, ref _substs, ref _vstore, _) => {
564+
ty::ty_trait(_did, ref _substs, ref _vstore, _, _bounds) => {
565565
cx.sess.span_note(span, "debuginfo for trait NYI");
566566
create_unimpl_ty(cx, t)
567567
},

trunk/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
683683
}
684684
ast::expr_cast(val, _) => {
685685
match ty::get(node_id_type(bcx, expr.id)).sty {
686-
ty::ty_trait(_, _, store, _) => {
686+
ty::ty_trait(_, _, store, _, _) => {
687687
return meth::trans_trait_cast(bcx, val, expr.id, dest,
688688
store);
689689
}

trunk/src/librustc/middle/trans/glue.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,13 @@ pub fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) {
486486
ty::ty_closure(_) => {
487487
closure::make_closure_glue(bcx, v0, t, drop_ty)
488488
}
489-
ty::ty_trait(_, _, ty::BoxTraitStore, _) => {
489+
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
490490
let llbox_ptr = GEPi(bcx, v0, [0u, abi::trt_field_box]);
491491
let llbox = Load(bcx, llbox_ptr);
492492
decr_refcnt_maybe_free(bcx, llbox, Some(llbox_ptr),
493493
ty::mk_opaque_box(ccx.tcx))
494494
}
495-
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
495+
ty::ty_trait(_, _, ty::UniqTraitStore, _, _) => {
496496
let lluniquevalue = GEPi(bcx, v0, [0, abi::trt_field_box]);
497497
// Only drop the value when it is non-null
498498
do with_cond(bcx, IsNotNull(bcx, Load(bcx, lluniquevalue))) |bcx| {
@@ -571,12 +571,12 @@ pub fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) {
571571
ty::ty_closure(_) => {
572572
closure::make_closure_glue(bcx, v, t, take_ty)
573573
}
574-
ty::ty_trait(_, _, ty::BoxTraitStore, _) => {
574+
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
575575
let llbox = Load(bcx, GEPi(bcx, v, [0u, abi::trt_field_box]));
576576
incr_refcnt_of_boxed(bcx, llbox);
577577
bcx
578578
}
579-
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
579+
ty::ty_trait(_, _, ty::UniqTraitStore, _, _) => {
580580
let lluniquevalue = GEPi(bcx, v, [0, abi::trt_field_box]);
581581
let llvtable = Load(bcx, GEPi(bcx, v, [0, abi::trt_field_vtable]));
582582

trunk/src/librustc/middle/trans/monomorphize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ pub fn normalize_for_monomorphization(tcx: ty::ctxt,
293293
ty::ty_closure(ref fty) => {
294294
Some(normalized_closure_ty(tcx, fty.sigil))
295295
}
296-
ty::ty_trait(_, _, ref store, _) => {
296+
ty::ty_trait(_, _, ref store, _, _) => {
297297
let sigil = match *store {
298298
ty::UniqTraitStore => ast::OwnedSigil,
299299
ty::BoxTraitStore => ast::ManagedSigil,

trunk/src/librustc/middle/trans/reachable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn traverse_ty<'a>(ty: @Ty, (cx, v): (@mut ctx<'a>, visit::vt<@mut ctx<'a>>)) {
160160
}
161161

162162
match ty.node {
163-
ty_path(p, p_id) => {
163+
ty_path(p, _bounds, p_id) => {
164164
match cx.tcx.def_map.find(&p_id) {
165165
// Kind of a hack to check this here, but I'm not sure what else
166166
// to do

trunk/src/librustc/middle/trans/reflect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ impl Reflector {
335335
}
336336

337337
// Miscallaneous extra types
338-
ty::ty_trait(_, _, _, _) => self.leaf(~"trait"),
338+
ty::ty_trait(_, _, _, _, _) => self.leaf(~"trait"),
339339
ty::ty_infer(_) => self.leaf(~"infer"),
340340
ty::ty_err => self.leaf(~"err"),
341341
ty::ty_param(ref p) => {

trunk/src/librustc/middle/trans/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
140140

141141
ty::ty_bare_fn(*) => Type::i8p(),
142142
ty::ty_closure(*) => Type::struct_([Type::i8p(), Type::i8p()], false),
143-
ty::ty_trait(_, _, store, _) => Type::opaque_trait(cx, store),
143+
ty::ty_trait(_, _, store, _, _) => Type::opaque_trait(cx, store),
144144

145145
ty::ty_estr(ty::vstore_fixed(size)) => Type::array(&Type::i8(), size as u64),
146146
ty::ty_evec(mt, ty::vstore_fixed(size)) => {
@@ -271,7 +271,7 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
271271
let ty = type_of_fn_from_ty(cx, t);
272272
Type::func_pair(cx, &ty)
273273
}
274-
ty::ty_trait(_, _, store, _) => Type::opaque_trait(cx, store),
274+
ty::ty_trait(_, _, store, _, _) => Type::opaque_trait(cx, store),
275275
ty::ty_type => cx.tydesc_type.ptr_to(),
276276
ty::ty_tup(*) => {
277277
let repr = adt::represent_type(cx, t);

trunk/src/librustc/middle/trans/type_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub fn type_needs_inner(cx: Context,
208208
ty::ty_bare_fn(*) |
209209
ty::ty_ptr(_) |
210210
ty::ty_rptr(_, _) |
211-
ty::ty_trait(_, _, _, _) => false,
211+
ty::ty_trait(*) => false,
212212

213213
ty::ty_enum(did, ref substs) => {
214214
if list::find(enums_seen, |id| *id == did).is_none() {

0 commit comments

Comments
 (0)