Skip to content

Commit 947d5a8

Browse files
committed
---
yaml --- r: 151515 b: refs/heads/try2 c: 3f5e3af h: refs/heads/master i: 151513: ccc835e 151511: 491f665 v: v3
1 parent d0aabcf commit 947d5a8

Some content is hidden

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

52 files changed

+636
-808
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: e850316408bbe6254305cf4aa7c65381dc475192
8+
refs/heads/try2: 3f5e3af8387deb68e116228562062384d4b9cf65
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/rust.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ This document does not serve as a tutorial introduction to the
1717
language. Background familiarity with the language is assumed. A separate
1818
[tutorial] document is available to help acquire such background familiarity.
1919

20-
This document also does not serve as a reference to the [standard]
21-
library included in the language distribution. Those libraries are
20+
This document also does not serve as a reference to the [standard] or [extra]
21+
libraries included in the language distribution. Those libraries are
2222
documented separately by extracting documentation attributes from their
2323
source code.
2424

2525
[tutorial]: tutorial.html
2626
[standard]: std/index.html
27+
[extra]: extra/index.html
2728

2829
## Disclaimer
2930

branches/try2/src/etc/vim/indent/rust.vim

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ setlocal cindent
1313
setlocal cinoptions=L0,(0,Ws,JN,j1
1414
setlocal cinkeys=0{,0},!^F,o,O,0[,0]
1515
" Don't think cinwords will actually do anything at all... never mind
16-
setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern
16+
setlocal cinwords=do,for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern
1717

1818
" Some preliminary settings
1919
setlocal nolisp " Make sure lisp indenting doesn't supersede us
@@ -40,12 +40,12 @@ function! s:get_line_trimmed(lnum)
4040
" If the last character in the line is a comment, do a binary search for
4141
" the start of the comment. synID() is slow, a linear search would take
4242
" too long on a long line.
43-
if synIDattr(synID(a:lnum, line_len, 1), "name") =~ 'Comment\|Todo'
43+
if synIDattr(synID(a:lnum, line_len, 1), "name") =~ "Comment\|Todo"
4444
let min = 1
4545
let max = line_len
4646
while min < max
4747
let col = (min + max) / 2
48-
if synIDattr(synID(a:lnum, col, 1), "name") =~ 'Comment\|Todo'
48+
if synIDattr(synID(a:lnum, col, 1), "name") =~ "Comment\|Todo"
4949
let max = col
5050
else
5151
let min = col + 1
@@ -87,10 +87,10 @@ function GetRustIndent(lnum)
8787
if synname == "rustString"
8888
" If the start of the line is in a string, don't change the indent
8989
return -1
90-
elseif synname =~ '\(Comment\|Todo\)'
91-
\ && line !~ '^\s*/\*' " not /* opening line
90+
elseif synname =~ "\\(Comment\\|Todo\\)"
91+
\ && line !~ "^\\s*/\\*" " not /* opening line
9292
if synname =~ "CommentML" " multi-line
93-
if line !~ '^\s*\*' && getline(a:lnum - 1) =~ '^\s*/\*'
93+
if line !~ "^\\s*\\*" && getline(a:lnum - 1) =~ "^\\s*/\\*"
9494
" This is (hopefully) the line after a /*, and it has no
9595
" leader, so the correct indentation is that of the
9696
" previous line.
@@ -115,16 +115,11 @@ function GetRustIndent(lnum)
115115
" };
116116

117117
" Search backwards for the previous non-empty line.
118-
let prevlinenum = prevnonblank(a:lnum - 1)
119-
let prevline = s:get_line_trimmed(prevlinenum)
120-
while prevlinenum > 1 && prevline !~ '[^[:blank:]]'
121-
let prevlinenum = prevnonblank(prevlinenum - 1)
122-
let prevline = s:get_line_trimmed(prevlinenum)
123-
endwhile
118+
let prevline = s:get_line_trimmed(prevnonblank(a:lnum - 1))
124119
if prevline[len(prevline) - 1] == ","
125-
\ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]'
126-
\ && prevline !~ '^\s*fn\s'
127-
\ && prevline !~ '([^()]\+,$'
120+
\ && s:get_line_trimmed(a:lnum) !~ "^\\s*[\\[\\]{}]"
121+
\ && prevline !~ "^\\s*fn\\s"
122+
\ && prevline !~ "([^()]\\+,$"
128123
" Oh ho! The previous line ended in a comma! I bet cindent will try to
129124
" take this too far... For now, let's normally use the previous line's
130125
" indent.
@@ -171,7 +166,7 @@ function GetRustIndent(lnum)
171166
" column zero)
172167

173168
call cursor(a:lnum, 1)
174-
if searchpair('{\|(', '', '}\|)', 'nbW',
169+
if searchpair('{\|(', '', '}\|)', 'nbW'
175170
\ 's:is_string_comment(line("."), col("."))') == 0
176171
if searchpair('\[', '', '\]', 'nbW',
177172
\ 's:is_string_comment(line("."), col("."))') == 0

branches/try2/src/libcore/intrinsics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub trait TyVisitor {
137137
sz: uint, align: uint) -> bool;
138138

139139
fn visit_enter_enum(&mut self, n_variants: uint,
140-
get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
140+
get_disr: unsafe extern fn(ptr: *Opaque) -> Disr,
141141
sz: uint, align: uint) -> bool;
142142
fn visit_enter_enum_variant(&mut self, variant: uint,
143143
disr_val: Disr,
@@ -149,7 +149,7 @@ pub trait TyVisitor {
149149
n_fields: uint,
150150
name: &str) -> bool;
151151
fn visit_leave_enum(&mut self, n_variants: uint,
152-
get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
152+
get_disr: unsafe extern fn(ptr: *Opaque) -> Disr,
153153
sz: uint, align: uint) -> bool;
154154

155155
fn visit_enter_fn(&mut self, purity: uint, proto: uint,

branches/try2/src/libcore/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
//!
2525
//! Functions return `Result` whenever errors are expected and
2626
//! recoverable. In the `std` crate `Result` is most prominently used
27-
//! for [I/O](../../std/io/index.html).
27+
//! for [I/O](../io/index.html).
2828
//!
2929
//! A simple function returning `Result` might be
3030
//! defined and used like so:

branches/try2/src/libnative/io/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn last_error() -> io::IoError {
149149
#[cfg(unix)] unsafe fn close(sock: sock_t) { let _ = libc::close(sock); }
150150

151151
fn sockname(fd: sock_t,
152-
f: extern "system" unsafe fn(sock_t, *mut libc::sockaddr,
152+
f: unsafe extern "system" fn(sock_t, *mut libc::sockaddr,
153153
*mut libc::socklen_t) -> libc::c_int)
154154
-> IoResult<ip::SocketAddr>
155155
{

branches/try2/src/librustc/metadata/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
128128
tag_table_val = 0x45,
129129
tag_table_def = 0x46,
130130
tag_table_node_type = 0x47,
131-
tag_table_item_subst = 0x48,
131+
tag_table_node_type_subst = 0x48,
132132
tag_table_freevars = 0x49,
133133
tag_table_tcache = 0x4a,
134134
tag_table_param_defs = 0x4b,

branches/try2/src/librustc/middle/astencode.rs

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -657,13 +657,13 @@ pub fn encode_vtable_origin(ecx: &e::EncodeContext,
657657
vtable_origin: &typeck::vtable_origin) {
658658
ebml_w.emit_enum("vtable_origin", |ebml_w| {
659659
match *vtable_origin {
660-
typeck::vtable_static(def_id, ref substs, ref vtable_res) => {
660+
typeck::vtable_static(def_id, ref tys, ref vtable_res) => {
661661
ebml_w.emit_enum_variant("vtable_static", 0u, 3u, |ebml_w| {
662662
ebml_w.emit_enum_variant_arg(0u, |ebml_w| {
663663
Ok(ebml_w.emit_def_id(def_id))
664664
});
665665
ebml_w.emit_enum_variant_arg(1u, |ebml_w| {
666-
Ok(ebml_w.emit_substs(ecx, substs))
666+
Ok(ebml_w.emit_tys(ecx, tys.as_slice()))
667667
});
668668
ebml_w.emit_enum_variant_arg(2u, |ebml_w| {
669669
Ok(encode_vtable_res(ecx, ebml_w, vtable_res))
@@ -744,7 +744,7 @@ impl<'a> vtable_decoder_helpers for reader::Decoder<'a> {
744744
Ok(this.read_def_id_noxcx(cdata))
745745
}).unwrap(),
746746
this.read_enum_variant_arg(1u, |this| {
747-
Ok(this.read_substs_noxcx(tcx, cdata))
747+
Ok(this.read_tys_noxcx(tcx, cdata))
748748
}).unwrap(),
749749
this.read_enum_variant_arg(2u, |this| {
750750
Ok(this.read_vtable_res(tcx, cdata))
@@ -962,11 +962,11 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
962962
})
963963
}
964964

965-
for &item_substs in tcx.item_substs.borrow().find(&id).iter() {
966-
ebml_w.tag(c::tag_table_item_subst, |ebml_w| {
965+
for tys in tcx.node_type_substs.borrow().find(&id).iter() {
966+
ebml_w.tag(c::tag_table_node_type_subst, |ebml_w| {
967967
ebml_w.id(id);
968968
ebml_w.tag(c::tag_table_val, |ebml_w| {
969-
ebml_w.emit_substs(ecx, &item_substs.substs);
969+
ebml_w.emit_tys(ecx, tys.as_slice())
970970
})
971971
})
972972
}
@@ -1091,9 +1091,6 @@ trait ebml_decoder_decoder_helpers {
10911091
fn read_tys_noxcx(&mut self,
10921092
tcx: &ty::ctxt,
10931093
cdata: &cstore::crate_metadata) -> Vec<ty::t>;
1094-
fn read_substs_noxcx(&mut self, tcx: &ty::ctxt,
1095-
cdata: &cstore::crate_metadata)
1096-
-> ty::substs;
10971094
}
10981095

10991096
impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
@@ -1118,21 +1115,6 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
11181115
.collect()
11191116
}
11201117

1121-
fn read_substs_noxcx(&mut self,
1122-
tcx: &ty::ctxt,
1123-
cdata: &cstore::crate_metadata)
1124-
-> ty::substs
1125-
{
1126-
self.read_opaque(|_, doc| {
1127-
Ok(tydecode::parse_substs_data(
1128-
doc.data,
1129-
cdata.cnum,
1130-
doc.start,
1131-
tcx,
1132-
|_, id| decoder::translate_def_id(cdata, id)))
1133-
}).unwrap()
1134-
}
1135-
11361118
fn read_ty(&mut self, xcx: &ExtendedDecodeContext) -> ty::t {
11371119
// Note: regions types embed local node ids. In principle, we
11381120
// should translate these node ids into the new decode
@@ -1330,12 +1312,9 @@ fn decode_side_tables(xcx: &ExtendedDecodeContext,
13301312
id, ty_to_str(dcx.tcx, ty));
13311313
dcx.tcx.node_types.borrow_mut().insert(id as uint, ty);
13321314
}
1333-
c::tag_table_item_subst => {
1334-
let item_substs = ty::ItemSubsts {
1335-
substs: val_dsr.read_substs(xcx)
1336-
};
1337-
dcx.tcx.item_substs.borrow_mut().insert(
1338-
id, item_substs);
1315+
c::tag_table_node_type_subst => {
1316+
let tys = val_dsr.read_tys(xcx);
1317+
dcx.tcx.node_type_substs.borrow_mut().insert(id, tys);
13391318
}
13401319
c::tag_table_freevars => {
13411320
let fv_info = val_dsr.read_to_vec(|val_dsr| {

branches/try2/src/librustc/middle/kind.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ pub fn check_expr(cx: &mut Context, e: &Expr) {
245245
{
246246
let method_map = cx.tcx.method_map.borrow();
247247
let method = method_map.find(&typeck::MethodCall::expr(e.id));
248-
let item_substs = cx.tcx.item_substs.borrow();
248+
let node_type_substs = cx.tcx.node_type_substs.borrow();
249249
let r = match method {
250250
Some(method) => Some(&method.substs.tps),
251-
None => item_substs.find(&e.id).map(|s| &s.substs.tps)
251+
None => node_type_substs.find(&e.id)
252252
};
253253
for ts in r.iter() {
254254
let def_map = cx.tcx.def_map.borrow();
@@ -341,19 +341,15 @@ fn check_trait_cast(cx: &mut Context, source_ty: ty::t, target_ty: ty::t, span:
341341
fn check_ty(cx: &mut Context, aty: &Ty) {
342342
match aty.node {
343343
TyPath(_, _, id) => {
344-
match cx.tcx.item_substs.borrow().find(&id) {
345-
None => { }
346-
Some(ref item_substs) => {
347-
let def_map = cx.tcx.def_map.borrow();
348-
let did = ast_util::def_id_of_def(def_map.get_copy(&id));
349-
let generics = ty::lookup_item_type(cx.tcx, did).generics;
350-
let type_param_defs = generics.type_param_defs();
351-
for (&ty, type_param_def) in
352-
item_substs.substs.tps.iter().zip(
353-
type_param_defs.iter())
354-
{
355-
check_typaram_bounds(cx, aty.span, ty, type_param_def)
356-
}
344+
let node_type_substs = cx.tcx.node_type_substs.borrow();
345+
let r = node_type_substs.find(&id);
346+
for ts in r.iter() {
347+
let def_map = cx.tcx.def_map.borrow();
348+
let did = ast_util::def_id_of_def(def_map.get_copy(&id));
349+
let generics = ty::lookup_item_type(cx.tcx, did).generics;
350+
let type_param_defs = generics.type_param_defs();
351+
for (&ty, type_param_def) in ts.iter().zip(type_param_defs.iter()) {
352+
check_typaram_bounds(cx, aty.span, ty, type_param_def)
357353
}
358354
}
359355
}

branches/try2/src/librustc/middle/subst.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,6 @@ impl Subst for ty::substs {
195195
}
196196
}
197197

198-
impl Subst for ty::ItemSubsts {
199-
fn subst_spanned(&self, tcx: &ty::ctxt,
200-
substs: &ty::substs,
201-
span: Option<Span>)
202-
-> ty::ItemSubsts {
203-
ty::ItemSubsts {
204-
substs: self.substs.subst_spanned(tcx, substs, span)
205-
}
206-
}
207-
}
208-
209198
impl Subst for ty::RegionSubsts {
210199
fn subst_spanned(&self, tcx: &ty::ctxt,
211200
substs: &ty::substs,

0 commit comments

Comments
 (0)