Skip to content

Commit d3f66cb

Browse files
committed
---
yaml --- r: 69371 b: refs/heads/auto c: 09e49a8 h: refs/heads/master i: 69369: 01a71ad 69367: cad11ad v: v3
1 parent 237b539 commit d3f66cb

Some content is hidden

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

80 files changed

+1458
-1398
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 037bf3757cf54e38544c494657ac88bc002b945c
17+
refs/heads/auto: 09e49a8e6c11e57142a0f628745142d94fc87444
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/doc/tutorial-container.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ impl Iterator<int> for ZeroStream {
108108
## Container iterators
109109
110110
Containers implement iteration over the contained elements by returning an
111-
iterator object. For example, vector slices have four iterators available:
111+
iterator object. For example, vector slices several iterators available:
112112
113-
* `vector.iter()`, for immutable references to the elements
114-
* `vector.mut_iter()`, for mutable references to the elements
115-
* `vector.rev_iter()`, for immutable references to the elements in reverse order
116-
* `vector.mut_rev_iter()`, for mutable references to the elements in reverse order
113+
* `iter()` and `rev_iter()`, for immutable references to the elements
114+
* `mut_iter()` and `mut_rev_iter()`, for mutable references to the elements
115+
* `consume_iter()` and `consume_rev_iter`, to move the elements out by-value
116+
117+
A typical mutable container will implement at least `iter()`, `mut_iter()` and
118+
`consume_iter()` along with the reverse variants if it maintains an order.
117119
118120
### Freezing
119121

branches/auto/mk/tests.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
537537

538538
# Rules for the cfail/rfail/rpass/bench/perf test runner
539539

540+
# The tests select when to use debug configuration on their own;
541+
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
542+
CTEST_RUSTC_FLAGS = $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
543+
540544
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
541545
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
542546
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
@@ -548,7 +552,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
548552
--target $(2) \
549553
--adb-path=$(CFG_ADB) \
550554
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
551-
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
555+
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) --target=$(2)" \
552556
$$(CTEST_TESTARGS)
553557

554558
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)

branches/auto/src/libextra/num/bigint.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,11 @@ impl Ord for Sign {
732732
}
733733
}
734734

735+
impl TotalEq for Sign {
736+
fn equals(&self, other: &Sign) -> bool {
737+
*self == *other
738+
}
739+
}
735740
impl TotalOrd for Sign {
736741

737742
fn cmp(&self, other: &Sign) -> Ordering {

branches/auto/src/libextra/num/rational.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,25 @@ cmp_impl!(impl TotalEq, equals)
110110
cmp_impl!(impl Ord, lt, gt, le, ge)
111111
cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering)
112112

113+
impl<T: Clone + Integer + Ord> Orderable for Ratio<T> {
114+
#[inline]
115+
fn min(&self, other: &Ratio<T>) -> Ratio<T> {
116+
if *self < *other { self.clone() } else { other.clone() }
117+
}
118+
119+
#[inline]
120+
fn max(&self, other: &Ratio<T>) -> Ratio<T> {
121+
if *self > *other { self.clone() } else { other.clone() }
122+
}
123+
124+
#[inline]
125+
fn clamp(&self, mn: &Ratio<T>, mx: &Ratio<T>) -> Ratio<T> {
126+
if *self > *mx { mx.clone()} else
127+
if *self < *mn { mn.clone() } else { self.clone() }
128+
}
129+
}
130+
131+
113132
/* Arithmetic */
114133
// a/b * c/d = (a*c)/(b*d)
115134
impl<T: Clone + Integer + Ord>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ pub static tag_misc_info: uint = 0x7f;
180180
pub static tag_misc_info_crate_items: uint = 0x80;
181181

182182
pub static tag_item_method_provided_source: uint = 0x81;
183+
pub static tag_item_impl_vtables: uint = 0x82;
183184

184185
pub struct LinkMeta {
185186
name: @str,

branches/auto/src/librustc/metadata/csearch.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use metadata::cstore;
1616
use metadata::decoder;
1717
use metadata;
1818
use middle::ty;
19+
use middle::typeck;
1920

2021
use std::vec;
2122
use reader = extra::ebml::reader;
@@ -216,6 +217,14 @@ pub fn get_impl_trait(tcx: ty::ctxt,
216217
decoder::get_impl_trait(cdata, def.node, tcx)
217218
}
218219

220+
// Given a def_id for an impl, return information about its vtables
221+
pub fn get_impl_vtables(tcx: ty::ctxt,
222+
def: ast::def_id) -> typeck::impl_res {
223+
let cstore = tcx.cstore;
224+
let cdata = cstore::get_crate_data(cstore, def.crate);
225+
decoder::get_impl_vtables(cdata, def.node, tcx)
226+
}
227+
219228
pub fn get_impl_method(cstore: @mut cstore::CStore,
220229
def: ast::def_id,
221230
mname: ast::ident)

branches/auto/src/librustc/metadata/decoder.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ use metadata::tydecode::{parse_ty_data, parse_def_id,
2121
parse_type_param_def_data,
2222
parse_bare_fn_ty_data, parse_trait_ref_data};
2323
use middle::ty;
24+
use middle::typeck;
25+
use middle::astencode::vtable_decoder_helpers;
26+
2427

2528
use std::hash::HashUtil;
26-
use std::int;
29+
use std::uint;
2730
use std::io::WriterUtil;
2831
use std::io;
2932
use std::option;
@@ -200,9 +203,9 @@ fn each_reexport(d: ebml::Doc, f: &fn(ebml::Doc) -> bool) -> bool {
200203
return true;
201204
}
202205

203-
fn variant_disr_val(d: ebml::Doc) -> Option<int> {
206+
fn variant_disr_val(d: ebml::Doc) -> Option<uint> {
204207
do reader::maybe_get_doc(d, tag_disr_val).chain |val_doc| {
205-
do reader::with_doc_data(val_doc) |data| { int::parse_bytes(data, 10u) }
208+
do reader::with_doc_data(val_doc) |data| { uint::parse_bytes(data, 10u) }
206209
}
207210
}
208211

@@ -410,6 +413,21 @@ pub fn get_impl_trait(cdata: cmd,
410413
}
411414
}
412415

416+
pub fn get_impl_vtables(cdata: cmd,
417+
id: ast::node_id,
418+
tcx: ty::ctxt) -> typeck::impl_res
419+
{
420+
let item_doc = lookup_item(id, cdata.data);
421+
let vtables_doc = reader::get_doc(item_doc, tag_item_impl_vtables);
422+
let mut decoder = reader::Decoder(vtables_doc);
423+
424+
typeck::impl_res {
425+
trait_vtables: decoder.read_vtable_res(tcx, cdata),
426+
self_vtables: decoder.read_vtable_param_res(tcx, cdata)
427+
}
428+
}
429+
430+
413431
pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
414432
name: ast::ident) -> Option<ast::def_id> {
415433
let items = reader::get_doc(reader::Doc(cdata.data), tag_items);

branches/auto/src/librustc/metadata/encoder.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ use metadata::decoder;
1717
use metadata::tyencode;
1818
use middle::ty::{node_id_to_type, lookup_item_type};
1919
use middle::ty;
20+
use middle::typeck;
21+
use middle::astencode;
2022
use middle;
2123

2224
use std::hash::HashUtil;
2325
use std::hashmap::{HashMap, HashSet};
24-
use std::int;
2526
use std::io;
2627
use std::str;
2728
use std::uint;
@@ -162,6 +163,15 @@ fn encode_trait_ref(ebml_w: &mut writer::Encoder,
162163
ebml_w.end_tag();
163164
}
164165

166+
fn encode_impl_vtables(ebml_w: &mut writer::Encoder,
167+
ecx: &EncodeContext,
168+
vtables: &typeck::impl_res) {
169+
ebml_w.start_tag(tag_item_impl_vtables);
170+
astencode::encode_vtable_res(ecx, ebml_w, vtables.trait_vtables);
171+
astencode::encode_vtable_param_res(ecx, ebml_w, vtables.self_vtables);
172+
ebml_w.end_tag();
173+
}
174+
165175
// Item info table encoding
166176
fn encode_family(ebml_w: &mut writer::Encoder, c: char) {
167177
ebml_w.start_tag(tag_items_data_item_family);
@@ -290,9 +300,9 @@ fn encode_discriminant(ecx: &EncodeContext,
290300

291301
fn encode_disr_val(_: &EncodeContext,
292302
ebml_w: &mut writer::Encoder,
293-
disr_val: int) {
303+
disr_val: uint) {
294304
ebml_w.start_tag(tag_disr_val);
295-
let s = int::to_str(disr_val);
305+
let s = uint::to_str(disr_val);
296306
ebml_w.writer.write(s.as_bytes());
297307
ebml_w.end_tag();
298308
}
@@ -1009,6 +1019,8 @@ fn encode_info_for_item(ecx: &EncodeContext,
10091019
let trait_ref = ty::node_id_to_trait_ref(
10101020
tcx, ast_trait_ref.ref_id);
10111021
encode_trait_ref(ebml_w, ecx, trait_ref, tag_item_trait_ref);
1022+
let impl_vtables = ty::lookup_impl_vtables(tcx, def_id);
1023+
encode_impl_vtables(ebml_w, ecx, &impl_vtables);
10121024
}
10131025
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
10141026
ebml_w.end_tag();
@@ -1443,6 +1455,9 @@ fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
14431455
ebml_w.start_tag(tag_lang_items);
14441456

14451457
for ecx.tcx.lang_items.each_item |def_id, i| {
1458+
let def_id = match def_id {
1459+
Some(id) => id, None => { loop }
1460+
};
14461461
if def_id.crate != local_crate {
14471462
loop;
14481463
}

branches/auto/src/librustc/metadata/tydecode.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn parse_trait_store(st: &mut PState) -> ty::TraitStore {
186186
}
187187

188188
fn parse_substs(st: &mut PState, conv: conv_did) -> ty::substs {
189-
let self_r = parse_opt(st, |st| parse_region(st) );
189+
let regions = parse_region_substs(st, |x,y| conv(x,y));
190190

191191
let self_ty = parse_opt(st, |st| parse_ty(st, |x,y| conv(x,y)) );
192192

@@ -196,12 +196,28 @@ fn parse_substs(st: &mut PState, conv: conv_did) -> ty::substs {
196196
st.pos = st.pos + 1u;
197197

198198
return ty::substs {
199-
self_r: self_r,
199+
regions: regions,
200200
self_ty: self_ty,
201201
tps: params
202202
};
203203
}
204204

205+
fn parse_region_substs(st: &mut PState, conv: conv_did) -> ty::RegionSubsts {
206+
match next(st) {
207+
'e' => ty::ErasedRegions,
208+
'n' => {
209+
let mut regions = opt_vec::Empty;
210+
while peek(st) != '.' {
211+
let r = parse_region(st);
212+
regions.push(r);
213+
}
214+
assert_eq!(next(st), '.');
215+
ty::NonerasedRegions(regions)
216+
}
217+
_ => fail!("parse_bound_region: bad input")
218+
}
219+
}
220+
205221
fn parse_bound_region(st: &mut PState) -> ty::bound_region {
206222
match next(st) {
207223
's' => ty::br_self,

branches/auto/src/librustc/metadata/tyencode.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,28 @@ fn enc_opt<T>(w: @io::Writer, t: Option<T>, enc_f: &fn(T)) {
120120
}
121121

122122
fn enc_substs(w: @io::Writer, cx: @ctxt, substs: &ty::substs) {
123-
do enc_opt(w, substs.self_r) |r| { enc_region(w, cx, r) }
123+
enc_region_substs(w, cx, &substs.regions);
124124
do enc_opt(w, substs.self_ty) |t| { enc_ty(w, cx, t) }
125125
w.write_char('[');
126126
for substs.tps.iter().advance |t| { enc_ty(w, cx, *t); }
127127
w.write_char(']');
128128
}
129129

130+
fn enc_region_substs(w: @io::Writer, cx: @ctxt, substs: &ty::RegionSubsts) {
131+
match *substs {
132+
ty::ErasedRegions => {
133+
w.write_char('e');
134+
}
135+
ty::NonerasedRegions(ref regions) => {
136+
w.write_char('n');
137+
for regions.iter().advance |&r| {
138+
enc_region(w, cx, r);
139+
}
140+
w.write_char('.');
141+
}
142+
}
143+
}
144+
130145
fn enc_region(w: @io::Writer, cx: @ctxt, r: ty::Region) {
131146
match r {
132147
ty::re_bound(br) => {

0 commit comments

Comments
 (0)