Skip to content

Commit 1088a1a

Browse files
committed
---
yaml --- r: 274158 b: refs/heads/stable c: 2929376 h: refs/heads/master
1 parent 1a152c7 commit 1088a1a

File tree

43 files changed

+544
-403
lines changed

Some content is hidden

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

43 files changed

+544
-403
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 9e432bd454d9116cd640d1059ccec09ce31313d0
32+
refs/heads/stable: 292937607d2e78d543a8e9b1bd0db5419dd3db09
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/configure

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,16 +1361,22 @@ for h in $CFG_HOST
13611361
do
13621362
for t in $CFG_TARGET
13631363
do
1364+
# host bin dir stage0
1365+
make_dir $h/stage0/bin
1366+
13641367
# host lib dir stage0
13651368
make_dir $h/stage0/lib
13661369

1370+
# host test dir stage0
1371+
make_dir $h/stage0/test
1372+
13671373
# target bin dir stage0
13681374
make_dir $h/stage0/lib/rustlib/$t/bin
13691375

13701376
# target lib dir stage0
13711377
make_dir $h/stage0/lib/rustlib/$t/lib
13721378

1373-
for i in 0 1 2 3
1379+
for i in 1 2 3
13741380
do
13751381
# host bin dir
13761382
make_dir $h/stage$i/bin

branches/stable/src/libcore/cmp.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
use self::Ordering::*;
2121

22-
use mem;
2322
use marker::Sized;
2423
use option::Option::{self, Some};
2524

@@ -119,10 +118,6 @@ pub enum Ordering {
119118
}
120119

121120
impl Ordering {
122-
unsafe fn from_i8_unchecked(v: i8) -> Ordering {
123-
mem::transmute(v)
124-
}
125-
126121
/// Reverse the `Ordering`.
127122
///
128123
/// * `Less` becomes `Greater`.
@@ -155,14 +150,10 @@ impl Ordering {
155150
#[inline]
156151
#[stable(feature = "rust1", since = "1.0.0")]
157152
pub fn reverse(self) -> Ordering {
158-
unsafe {
159-
// this compiles really nicely (to a single instruction);
160-
// an explicit match has a pile of branches and
161-
// comparisons.
162-
//
163-
// NB. it is safe because of the explicit discriminants
164-
// given above.
165-
Ordering::from_i8_unchecked(-(self as i8))
153+
match self {
154+
Less => Greater,
155+
Equal => Equal,
156+
Greater => Less,
166157
}
167158
}
168159
}

branches/stable/src/libcore/slice.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -294,22 +294,23 @@ impl<T> SliceExt for [T] {
294294
fn binary_search_by<F>(&self, mut f: F) -> Result<usize, usize> where
295295
F: FnMut(&T) -> Ordering
296296
{
297-
let mut base : usize = 0;
298-
let mut lim : usize = self.len();
297+
let mut base = 0usize;
298+
let mut s = self;
299299

300-
while lim != 0 {
301-
let ix = base + (lim >> 1);
302-
match f(&self[ix]) {
303-
Equal => return Ok(ix),
300+
loop {
301+
let (head, tail) = s.split_at(s.len() >> 1);
302+
if tail.is_empty() {
303+
return Err(base)
304+
}
305+
match f(&tail[0]) {
304306
Less => {
305-
base = ix + 1;
306-
lim -= 1;
307+
base += head.len() + 1;
308+
s = &tail[1..];
307309
}
308-
Greater => ()
310+
Greater => s = head,
311+
Equal => return Ok(base + head.len()),
309312
}
310-
lim >>= 1;
311313
}
312-
Err(base)
313314
}
314315

315316
#[inline]

branches/stable/src/libcoretest/slice.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,20 @@
1111
use core::result::Result::{Ok, Err};
1212

1313
#[test]
14-
fn binary_search_not_found() {
14+
fn test_binary_search() {
1515
let b = [1, 2, 4, 6, 8, 9];
1616
assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3));
17-
let b = [1, 2, 4, 6, 8, 9];
1817
assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3));
1918
let b = [1, 2, 4, 6, 7, 8, 9];
2019
assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3));
21-
let b = [1, 2, 4, 6, 7, 8, 9];
2220
assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3));
2321
let b = [1, 2, 4, 6, 8, 9];
2422
assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(4));
25-
let b = [1, 2, 4, 6, 8, 9];
2623
assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(4));
2724
let b = [1, 2, 4, 6, 7, 8, 9];
2825
assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(5));
2926
let b = [1, 2, 4, 5, 6, 8, 9];
3027
assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(5));
31-
let b = [1, 2, 4, 5, 6, 8, 9];
3228
assert!(b.binary_search_by(|v| v.cmp(&0)) == Err(0));
3329
let b = [1, 2, 4, 5, 6, 8];
3430
assert!(b.binary_search_by(|v| v.cmp(&9)) == Err(6));

branches/stable/src/liblibc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 9aa6600bd8f4e4f370a7d2fb76c4b3efc669cadf
1+
Subproject commit af77843345ec6fc7e51113bfd692138d89024bc0

branches/stable/src/librustc/dep_graph/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use self::thread::{DepGraphThreadData, DepMessage};
1212
use middle::def_id::DefId;
1313
use middle::ty;
14-
use middle::ty::fast_reject::SimplifiedType;
1514
use rustc_front::hir;
1615
use rustc_front::intravisit::Visitor;
1716
use std::rc::Rc;
@@ -102,7 +101,7 @@ pub enum DepNode {
102101
// which would yield an overly conservative dep-graph.
103102
TraitItems(DefId),
104103
ReprHints(DefId),
105-
TraitSelect(DefId, Option<SimplifiedType>),
104+
TraitSelect(DefId),
106105
}
107106

108107
#[derive(Clone)]

branches/stable/src/librustc/middle/const_eval.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,20 +1233,11 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
12331233
rcvr_substs: subst::Substs<'tcx>)
12341234
-> Option<&'tcx Expr>
12351235
{
1236-
let subst::SeparateVecsPerParamSpace {
1237-
types: rcvr_type,
1238-
selfs: rcvr_self,
1239-
fns: _,
1240-
} = rcvr_substs.types.split();
1241-
let trait_substs =
1242-
subst::Substs::erased(subst::VecPerParamSpace::new(rcvr_type,
1243-
rcvr_self,
1244-
Vec::new()));
1245-
let trait_substs = tcx.mk_substs(trait_substs);
1246-
debug!("resolve_trait_associated_const: trait_substs={:?}",
1247-
trait_substs);
1248-
let trait_ref = ty::Binder(ty::TraitRef { def_id: trait_id,
1249-
substs: trait_substs });
1236+
let trait_ref = ty::Binder(
1237+
rcvr_substs.erase_regions().to_trait_ref(tcx, trait_id)
1238+
);
1239+
debug!("resolve_trait_associated_const: trait_ref={:?}",
1240+
trait_ref);
12501241

12511242
tcx.populate_implementations_for_trait_if_necessary(trait_ref.def_id());
12521243
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None);

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

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub use self::ParamSpace::*;
1414
pub use self::RegionSubsts::*;
1515

1616
use middle::cstore;
17+
use middle::def_id::DefId;
1718
use middle::ty::{self, Ty};
1819
use middle::ty::fold::{TypeFoldable, TypeFolder};
1920

@@ -142,16 +143,34 @@ impl<'tcx> Substs<'tcx> {
142143
-> Substs<'tcx>
143144
{
144145
let Substs { types, regions } = self;
145-
let types = types.with_vec(FnSpace, m_types);
146-
let regions = regions.map(|r| r.with_vec(FnSpace, m_regions));
146+
let types = types.with_slice(FnSpace, &m_types);
147+
let regions = regions.map(|r| r.with_slice(FnSpace, &m_regions));
147148
Substs { types: types, regions: regions }
148149
}
149150

150-
pub fn method_to_trait(self) -> Substs<'tcx> {
151-
let Substs { mut types, regions } = self;
151+
pub fn with_method_from(self,
152+
meth_substs: &Substs<'tcx>)
153+
-> Substs<'tcx>
154+
{
155+
let Substs { types, regions } = self;
156+
let types = types.with_slice(FnSpace, meth_substs.types.get_slice(FnSpace));
157+
let regions = regions.map(|r| {
158+
r.with_slice(FnSpace, meth_substs.regions().get_slice(FnSpace))
159+
});
160+
Substs { types: types, regions: regions }
161+
}
162+
163+
/// Creates a trait-ref out of this substs, ignoring the FnSpace substs
164+
pub fn to_trait_ref(&self, tcx: &ty::ctxt<'tcx>, trait_id: DefId)
165+
-> ty::TraitRef<'tcx> {
166+
let Substs { mut types, regions } = self.clone();
152167
types.truncate(FnSpace, 0);
153168
let regions = regions.map(|mut r| { r.truncate(FnSpace, 0); r });
154-
Substs { types: types, regions: regions }
169+
170+
ty::TraitRef {
171+
def_id: trait_id,
172+
substs: tcx.mk_substs(Substs { types: types, regions: regions })
173+
}
155174
}
156175
}
157176

@@ -290,10 +309,6 @@ impl<T> VecPerParamSpace<T> {
290309
}
291310
}
292311

293-
pub fn params_from_type(types: Vec<T>) -> VecPerParamSpace<T> {
294-
VecPerParamSpace::empty().with_vec(TypeSpace, types)
295-
}
296-
297312
/// `t` is the type space.
298313
/// `s` is the self space.
299314
/// `f` is the fn space.
@@ -483,11 +498,15 @@ impl<T> VecPerParamSpace<T> {
483498
}
484499
}
485500

486-
pub fn with_vec(mut self, space: ParamSpace, vec: Vec<T>)
501+
pub fn with_slice(mut self, space: ParamSpace, slice: &[T])
487502
-> VecPerParamSpace<T>
503+
where T: Clone
488504
{
489505
assert!(self.is_empty_in(space));
490-
self.replace(space, vec);
506+
for t in slice {
507+
self.push(space, t.clone());
508+
}
509+
491510
self
492511
}
493512
}

0 commit comments

Comments
 (0)