Skip to content

Commit 2eb6070

Browse files
committed
---
yaml --- r: 158835 b: refs/heads/snap-stage3 c: fa2983a h: refs/heads/master i: 158833: 27b944b 158831: 26d1ac1 v: v3
1 parent b98431b commit 2eb6070

Some content is hidden

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

49 files changed

+1440
-860
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0b48001c28329392b26961eaf1c3ed293a352d6f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 0741dd795a5cad8b7bb24d07200235f8fb7d84e6
4+
refs/heads/snap-stage3: fa2983a1b7fc77dad37d49dcebeda3c25aac1e3f
55
refs/heads/try: f58aad6dce273570fb130b4df008ef9acd5a5be2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/configure

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ putvar() {
7676
printf "%-20s := %s\n" $1 "$T" >>config.tmp
7777
}
7878

79+
putpathvar() {
80+
local T
81+
eval T=\$$1
82+
eval TLEN=\${#$1}
83+
if [ $TLEN -gt 35 ]
84+
then
85+
printf "configure: %-20s := %.35s ...\n" $1 "$T"
86+
else
87+
printf "configure: %-20s := %s %s\n" $1 "$T" "$2"
88+
fi
89+
if [ -z "$T" ]
90+
then
91+
printf "%-20s := \n" $1 >>config.tmp
92+
else
93+
printf "%-20s := \"%s\"\n" $1 "$T" >>config.tmp
94+
fi
95+
}
96+
7997
probe() {
8098
local V=$1
8199
shift
@@ -101,7 +119,7 @@ probe() {
101119
fi
102120
done
103121
eval $V=\$T
104-
putvar $V "$VER"
122+
putpathvar $V "$VER"
105123
}
106124

107125
probe_need() {
@@ -638,9 +656,9 @@ probe CFG_ADB adb
638656

639657
if [ ! -z "$CFG_PANDOC" ]
640658
then
641-
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc ' |
659+
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc\(.exe\)\? ' |
642660
# extract the first 2 version fields, ignore everything else
643-
sed 's/pandoc \([0-9]*\)\.\([0-9]*\).*/\1 \2/')
661+
sed 's/pandoc\(.exe\)\? \([0-9]*\)\.\([0-9]*\).*/\2 \3/')
644662

645663
MIN_PV_MAJOR="1"
646664
MIN_PV_MINOR="9"
@@ -1330,8 +1348,7 @@ do
13301348
done
13311349

13321350
# Munge any paths that appear in config.mk back to posix-y
1333-
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' \
1334-
-e 's@\\@/@go;' config.tmp
1351+
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' config.tmp
13351352
rm -f config.tmp.bak
13361353

13371354
msg

branches/snap-stage3/mk/docs.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
DOCS := index intro tutorial guide guide-ffi guide-macros guide-lifetimes \
2929
guide-tasks guide-container guide-pointers guide-testing \
3030
guide-plugin guide-crates complement-bugreport \
31-
complement-lang-faq complement-design-faq complement-project-faq rust \
31+
complement-lang-faq complement-design-faq complement-project-faq \
3232
rustdoc guide-unsafe guide-strings reference
3333

3434
PDF_DOCS := guide reference
3535

36-
RUSTDOC_DEPS_rust := doc/full-toc.inc
37-
RUSTDOC_FLAGS_rust := --html-in-header=doc/full-toc.inc
36+
RUSTDOC_DEPS_reference := doc/full-toc.inc
37+
RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc
3838

3939
L10N_LANGS := ja
4040

branches/snap-stage3/mk/reconfig.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ifndef CFG_DISABLE_MANAGE_SUBMODULES
1919
# (nothing checked out at all). `./configure --{llvm,jemalloc}-root`
2020
# will explicitly deinitialize the corresponding submodules, and we don't
2121
# want to force constant rebuilds in that case.
22-
NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && "$(CFG_GIT)" submodule status | grep -c '^+')
22+
NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && $(CFG_GIT) submodule status | grep -c '^+')
2323
else
2424
NEED_GIT_RECONFIG=0
2525
endif

branches/snap-stage3/src/liballoc/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
166166
// additional reference of either kind.
167167
if self.inner().strong.load(atomic::SeqCst) != 1 ||
168168
self.inner().weak.load(atomic::SeqCst) != 1 {
169-
*self = Arc::new(self.deref().clone())
169+
*self = Arc::new((**self).clone())
170170
}
171171
// This unsafety is ok because we're guaranteed that the pointer
172172
// returned is the *only* pointer that will ever be returned to T. Our

branches/snap-stage3/src/libcollections/enum_set.rs

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,27 @@ impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
4343
}
4444
}
4545

46-
/// An interface for casting C-like enum to uint and back.
46+
/**
47+
An interface for casting C-like enum to uint and back.
48+
A typically implementation is as below.
49+
50+
```{rust,ignore}
51+
#[repr(uint)]
52+
enum Foo {
53+
A, B, C
54+
}
55+
56+
impl CLike for Foo {
57+
fn to_uint(&self) -> uint {
58+
*self as uint
59+
}
60+
61+
fn from_uint(v: uint) -> Foo {
62+
unsafe { mem::transmute(v) }
63+
}
64+
}
65+
```
66+
*/
4767
pub trait CLike {
4868
/// Converts a C-like enum to a `uint`.
4969
fn to_uint(&self) -> uint;
@@ -52,7 +72,11 @@ pub trait CLike {
5272
}
5373

5474
fn bit<E:CLike>(e: &E) -> uint {
55-
1 << e.to_uint()
75+
use core::uint;
76+
let value = e.to_uint();
77+
assert!(value < uint::BITS,
78+
"EnumSet only supports up to {} variants.", uint::BITS - 1);
79+
1 << value
5680
}
5781

5882
impl<E:CLike> EnumSet<E> {
@@ -378,4 +402,31 @@ mod test {
378402
let elems = e_subtract.iter().collect();
379403
assert_eq!(vec![A], elems)
380404
}
405+
406+
#[test]
407+
#[should_fail]
408+
fn test_overflow() {
409+
#[allow(dead_code)]
410+
#[repr(uint)]
411+
enum Bar {
412+
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,
413+
V10, V11, V12, V13, V14, V15, V16, V17, V18, V19,
414+
V20, V21, V22, V23, V24, V25, V26, V27, V28, V29,
415+
V30, V31, V32, V33, V34, V35, V36, V37, V38, V39,
416+
V40, V41, V42, V43, V44, V45, V46, V47, V48, V49,
417+
V50, V51, V52, V53, V54, V55, V56, V57, V58, V59,
418+
V60, V61, V62, V63, V64, V65, V66, V67, V68, V69,
419+
}
420+
impl CLike for Bar {
421+
fn to_uint(&self) -> uint {
422+
*self as uint
423+
}
424+
425+
fn from_uint(v: uint) -> Bar {
426+
unsafe { mem::transmute(v) }
427+
}
428+
}
429+
let mut set = EnumSet::empty();
430+
set.add(V64);
431+
}
381432
}

branches/snap-stage3/src/libcore/atomic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,15 +717,15 @@ unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
717717
/// A fence 'A' which has `Release` ordering semantics, synchronizes with a
718718
/// fence 'B' with (at least) `Acquire` semantics, if and only if there exists
719719
/// atomic operations X and Y, both operating on some atomic object 'M' such
720-
/// that A is sequenced before X, Y is synchronized before B and Y observers
720+
/// that A is sequenced before X, Y is synchronized before B and Y observes
721721
/// the change to M. This provides a happens-before dependence between A and B.
722722
///
723723
/// Atomic operations with `Release` or `Acquire` semantics can also synchronize
724724
/// with a fence.
725725
///
726-
/// A fence with has `SeqCst` ordering, in addition to having both `Acquire` and
727-
/// `Release` semantics, participates in the global program order of the other
728-
/// `SeqCst` operations and/or fences.
726+
/// A fence which has `SeqCst` ordering, in addition to having both `Acquire`
727+
/// and `Release` semantics, participates in the global program order of the
728+
/// other `SeqCst` operations and/or fences.
729729
///
730730
/// Accepts `Acquire`, `Release`, `AcqRel` and `SeqCst` orderings.
731731
///

branches/snap-stage3/src/libcore/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ extern "rust-intrinsic" {
536536
/// `TypeId` represents a globally unique identifier for a type
537537
#[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
538538
// middle/lang_items.rs
539-
#[deriving(PartialEq, Eq, Show)]
539+
#[deriving(Clone, PartialEq, Eq, Show)]
540540
pub struct TypeId {
541541
t: u64,
542542
}

branches/snap-stage3/src/libcore/ops.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ shr_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
638638
* ```
639639
*/
640640
#[lang="index"]
641-
pub trait Index<Index, Sized? Result> {
641+
pub trait Index<Index, Sized? Result> for Sized? {
642642
/// The method for the indexing (`Foo[Bar]`) operation
643643
fn index<'a>(&'a self, index: &Index) -> &'a Result;
644644
}
@@ -669,7 +669,7 @@ pub trait Index<Index, Sized? Result> {
669669
* ```
670670
*/
671671
#[lang="index_mut"]
672-
pub trait IndexMut<Index, Result> {
672+
pub trait IndexMut<Index, Result> for Sized? {
673673
/// The method for the indexing (`Foo[Bar]`) operation
674674
fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
675675
}
@@ -805,6 +805,16 @@ pub trait Deref<Sized? Result> {
805805
fn deref<'a>(&'a self) -> &'a Result;
806806
}
807807

808+
#[cfg(not(stage0))]
809+
impl<'a, Sized? T> Deref<T> for &'a T {
810+
fn deref(&self) -> &T { *self }
811+
}
812+
813+
#[cfg(not(stage0))]
814+
impl<'a, Sized? T> Deref<T> for &'a mut T {
815+
fn deref(&self) -> &T { *self }
816+
}
817+
808818
/**
809819
*
810820
* The `DerefMut` trait is used to specify the functionality of dereferencing
@@ -845,6 +855,11 @@ pub trait DerefMut<Sized? Result>: Deref<Result> {
845855
fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
846856
}
847857

858+
#[cfg(not(stage0))]
859+
impl<'a, Sized? T> DerefMut<T> for &'a mut T {
860+
fn deref_mut(&mut self) -> &mut T { *self }
861+
}
862+
848863
/// A version of the call operator that takes an immutable receiver.
849864
#[lang="fn"]
850865
pub trait Fn<Args,Result> {

branches/snap-stage3/src/libcore/slice.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ pub trait SlicePrelude<T> for Sized? {
256256
#[inline]
257257
#[experimental = "not triaged yet"]
258258
fn is_empty(&self) -> bool { self.len() == 0 }
259-
260259
/// Returns a mutable reference to the element at the given index,
261260
/// or `None` if the index is out of bounds
262261
#[unstable = "waiting on final error conventions"]
@@ -698,6 +697,22 @@ impl<T> SlicePrelude<T> for [T] {
698697
}
699698
}
700699

700+
impl<T> ops::Index<uint, T> for [T] {
701+
fn index(&self, &index: &uint) -> &T {
702+
assert!(index < self.len());
703+
704+
unsafe { mem::transmute(self.repr().data.offset(index as int)) }
705+
}
706+
}
707+
708+
impl<T> ops::IndexMut<uint, T> for [T] {
709+
fn index_mut(&mut self, &index: &uint) -> &mut T {
710+
assert!(index < self.len());
711+
712+
unsafe { mem::transmute(self.repr().data.offset(index as int)) }
713+
}
714+
}
715+
701716
impl<T> ops::Slice<uint, [T]> for [T] {
702717
#[inline]
703718
fn as_slice_<'a>(&'a self) -> &'a [T] {

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
212212
*ty == config::CrateTypeExecutable
213213
});
214214

215-
krate = time(time_passes, "crate injection", krate, |krate|
216-
syntax::std_inject::maybe_inject_crates_ref(krate,
217-
sess.opts.alt_std_name.clone(),
218-
any_exe));
219-
220215
// strip before expansion to allow macros to depend on
221216
// configuration variables e.g/ in
222217
//
@@ -228,6 +223,11 @@ pub fn phase_2_configure_and_expand(sess: &Session,
228223
krate = time(time_passes, "configuration 1", krate, |krate|
229224
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate));
230225

226+
krate = time(time_passes, "crate injection", krate, |krate|
227+
syntax::std_inject::maybe_inject_crates_ref(krate,
228+
sess.opts.alt_std_name.clone(),
229+
any_exe));
230+
231231
let mut addl_plugins = Some(addl_plugins);
232232
let Plugins { macros, registrars }
233233
= time(time_passes, "plugin loading", (), |_|

branches/snap-stage3/src/librustc/middle/traits/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub enum Vtable<N> {
176176
/// ID is the ID of the closure expression. This is a `VtableImpl`
177177
/// in spirit, but the impl is generated by the compiler and does
178178
/// not appear in the source.
179-
VtableUnboxedClosure(ast::DefId),
179+
VtableUnboxedClosure(ast::DefId, subst::Substs),
180180

181181
/// Successful resolution to an obligation provided by the caller
182182
/// for some type parameter.
@@ -338,7 +338,7 @@ impl<N> Vtable<N> {
338338
pub fn iter_nested(&self) -> Items<N> {
339339
match *self {
340340
VtableImpl(ref i) => i.iter_nested(),
341-
VtableUnboxedClosure(_) => (&[]).iter(),
341+
VtableUnboxedClosure(..) => (&[]).iter(),
342342
VtableParam(_) => (&[]).iter(),
343343
VtableBuiltin(ref i) => i.iter_nested(),
344344
}
@@ -347,7 +347,7 @@ impl<N> Vtable<N> {
347347
pub fn map_nested<M>(&self, op: |&N| -> M) -> Vtable<M> {
348348
match *self {
349349
VtableImpl(ref i) => VtableImpl(i.map_nested(op)),
350-
VtableUnboxedClosure(d) => VtableUnboxedClosure(d),
350+
VtableUnboxedClosure(d, ref s) => VtableUnboxedClosure(d, s.clone()),
351351
VtableParam(ref p) => VtableParam((*p).clone()),
352352
VtableBuiltin(ref i) => VtableBuiltin(i.map_nested(op)),
353353
}
@@ -356,7 +356,7 @@ impl<N> Vtable<N> {
356356
pub fn map_move_nested<M>(self, op: |N| -> M) -> Vtable<M> {
357357
match self {
358358
VtableImpl(i) => VtableImpl(i.map_move_nested(op)),
359-
VtableUnboxedClosure(d) => VtableUnboxedClosure(d),
359+
VtableUnboxedClosure(d, s) => VtableUnboxedClosure(d, s),
360360
VtableParam(p) => VtableParam(p),
361361
VtableBuiltin(i) => VtableBuiltin(i.map_move_nested(op)),
362362
}

branches/snap-stage3/src/librustc/middle/traits/select.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,9 +1582,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15821582
Ok(VtableImpl(vtable_impl))
15831583
}
15841584

1585-
UnboxedClosureCandidate(closure_def_id, ref substs) => {
1586-
try!(self.confirm_unboxed_closure_candidate(obligation, closure_def_id, substs));
1587-
Ok(VtableUnboxedClosure(closure_def_id))
1585+
UnboxedClosureCandidate(closure_def_id, substs) => {
1586+
try!(self.confirm_unboxed_closure_candidate(obligation, closure_def_id, &substs));
1587+
Ok(VtableUnboxedClosure(closure_def_id, substs))
15881588
}
15891589
}
15901590
}

branches/snap-stage3/src/librustc/middle/traits/util.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ impl<N:Repr> Repr for super::Vtable<N> {
311311
super::VtableImpl(ref v) =>
312312
v.repr(tcx),
313313

314-
super::VtableUnboxedClosure(ref d) =>
315-
format!("VtableUnboxedClosure({})",
316-
d.repr(tcx)),
314+
super::VtableUnboxedClosure(ref d, ref s) =>
315+
format!("VtableUnboxedClosure({},{})",
316+
d.repr(tcx),
317+
s.repr(tcx)),
317318

318319
super::VtableParam(ref v) =>
319320
format!("VtableParam({})", v.repr(tcx)),

branches/snap-stage3/src/librustc/middle/trans/callee.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,9 @@ pub fn trans_fn_ref_with_substs(
490490
};
491491

492492
// If this is an unboxed closure, redirect to it.
493-
match closure::get_or_create_declaration_if_unboxed_closure(bcx, def_id) {
493+
match closure::get_or_create_declaration_if_unboxed_closure(bcx,
494+
def_id,
495+
&substs) {
494496
None => {}
495497
Some(llfn) => return llfn,
496498
}

0 commit comments

Comments
 (0)