Skip to content

Commit 3d8e2b2

Browse files
committed
---
yaml --- r: 158707 b: refs/heads/snap-stage3 c: 4af52ee h: refs/heads/master i: 158705: c4f7d0a 158703: ddfd100 v: v3
1 parent a845d83 commit 3d8e2b2

File tree

33 files changed

+673
-445
lines changed

33 files changed

+673
-445
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: 5c1fd5f8b7351085765217b198c6d5a8c0026b74
4+
refs/heads/snap-stage3: 4af52eee59ff25a7f636798bdbc3f1bec985828f
55
refs/heads/try: f58aad6dce273570fb130b4df008ef9acd5a5be2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
444444
//waiting 1 second for gdbserver start
445445
timer::sleep(Duration::milliseconds(1000));
446446
let result = task::try(proc() {
447-
tcp::TcpStream::connect("127.0.0.1:5039").unwrap();
447+
tcp::TcpStream::connect("127.0.0.1", 5039).unwrap();
448448
});
449449
if result.is_err() {
450450
continue;

branches/snap-stage3/src/libarena/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl Drop for Arena {
132132

133133
#[inline]
134134
fn round_up(base: uint, align: uint) -> uint {
135-
(base.checked_add(&(align - 1))).unwrap() & !(&(align - 1))
135+
(base.checked_add(&(align - 1))).unwrap() & !(align - 1)
136136
}
137137

138138
// Walk down a chunk, running the destructors for any objects stored

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ impl<T> Vec<T> {
919919
///
920920
/// ```
921921
/// let mut vec = vec![1i, 2, 3, 4];
922-
/// vec.retain(|x| x%2 == 0);
922+
/// vec.retain(|&x| x%2 == 0);
923923
/// assert_eq!(vec, vec![2, 4]);
924924
/// ```
925925
#[unstable = "the closure argument may become an unboxed closure"]

branches/snap-stage3/src/libcore/fmt/mod.rs

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,37 @@ pub trait UpperExp for Sized? {
250250
fn fmt(&self, &mut Formatter) -> Result;
251251
}
252252

253+
// NOTE(stage0): Remove macro after next snapshot
254+
#[cfg(stage0)]
255+
macro_rules! uniform_fn_call_workaround {
256+
($( $name: ident, $trait_: ident; )*) => {
257+
$(
258+
#[doc(hidden)]
259+
pub fn $name<Sized? T: $trait_>(x: &T, fmt: &mut Formatter) -> Result {
260+
x.fmt(fmt)
261+
}
262+
)*
263+
}
264+
}
265+
// NOTE(stage0): Remove macro after next snapshot
266+
#[cfg(stage0)]
267+
uniform_fn_call_workaround! {
268+
secret_show, Show;
269+
secret_bool, Bool;
270+
secret_char, Char;
271+
secret_signed, Signed;
272+
secret_unsigned, Unsigned;
273+
secret_octal, Octal;
274+
secret_binary, Binary;
275+
secret_lower_hex, LowerHex;
276+
secret_upper_hex, UpperHex;
277+
secret_string, String;
278+
secret_pointer, Pointer;
279+
secret_float, Float;
280+
secret_lower_exp, LowerExp;
281+
secret_upper_exp, UpperExp;
282+
}
283+
253284
static DEFAULT_ARGUMENT: rt::Argument<'static> = rt::Argument {
254285
position: rt::ArgumentNext,
255286
format: rt::FormatSpec {
@@ -539,13 +570,33 @@ pub fn argument<'a, T>(f: extern "Rust" fn(&T, &mut Formatter) -> Result,
539570

540571
/// When the compiler determines that the type of an argument *must* be a string
541572
/// (such as for select), then it invokes this method.
573+
// NOTE(stage0): remove function after a snapshot
574+
#[cfg(stage0)]
575+
#[doc(hidden)] #[inline]
576+
pub fn argumentstr<'a>(s: &'a &str) -> Argument<'a> {
577+
argument(secret_string, s)
578+
}
579+
580+
/// When the compiler determines that the type of an argument *must* be a string
581+
/// (such as for select), then it invokes this method.
582+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
542583
#[doc(hidden)] #[inline]
543584
pub fn argumentstr<'a>(s: &'a &str) -> Argument<'a> {
544585
argument(String::fmt, s)
545586
}
546587

547588
/// When the compiler determines that the type of an argument *must* be a uint
548589
/// (such as for plural), then it invokes this method.
590+
// NOTE(stage0): remove function after a snapshot
591+
#[cfg(stage0)]
592+
#[doc(hidden)] #[inline]
593+
pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
594+
argument(secret_unsigned, s)
595+
}
596+
597+
/// When the compiler determines that the type of an argument *must* be a uint
598+
/// (such as for plural), then it invokes this method.
599+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
549600
#[doc(hidden)] #[inline]
550601
pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
551602
argument(Unsigned::fmt, s)
@@ -563,6 +614,15 @@ impl<'a> Show for &'a Show+'a {
563614
fn fmt(&self, f: &mut Formatter) -> Result { (*self).fmt(f) }
564615
}
565616

617+
// NOTE(stage0): remove impl after a snapshot
618+
#[cfg(stage0)]
619+
impl Bool for bool {
620+
fn fmt(&self, f: &mut Formatter) -> Result {
621+
secret_string(&(if *self {"true"} else {"false"}), f)
622+
}
623+
}
624+
625+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
566626
impl Bool for bool {
567627
fn fmt(&self, f: &mut Formatter) -> Result {
568628
String::fmt(if *self { "true" } else { "false" }, f)
@@ -581,6 +641,20 @@ impl String for str {
581641
}
582642
}
583643

644+
// NOTE(stage0): remove impl after a snapshot
645+
#[cfg(stage0)]
646+
impl Char for char {
647+
fn fmt(&self, f: &mut Formatter) -> Result {
648+
use char::Char;
649+
650+
let mut utf8 = [0u8, ..4];
651+
let amt = self.encode_utf8(utf8).unwrap_or(0);
652+
let s: &str = unsafe { mem::transmute(utf8[..amt]) };
653+
secret_string(&s, f)
654+
}
655+
}
656+
657+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
584658
impl Char for char {
585659
fn fmt(&self, f: &mut Formatter) -> Result {
586660
use char::Char;
@@ -592,25 +666,62 @@ impl Char for char {
592666
}
593667
}
594668

669+
// NOTE(stage0): remove impl after a snapshot
670+
#[cfg(stage0)]
671+
impl<T> Pointer for *const T {
672+
fn fmt(&self, f: &mut Formatter) -> Result {
673+
f.flags |= 1 << (rt::FlagAlternate as uint);
674+
secret_lower_hex::<uint>(&(*self as uint), f)
675+
}
676+
}
677+
678+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
595679
impl<T> Pointer for *const T {
596680
fn fmt(&self, f: &mut Formatter) -> Result {
597681
f.flags |= 1 << (rt::FlagAlternate as uint);
598682
LowerHex::fmt(&(*self as uint), f)
599683
}
600684
}
601685

686+
// NOTE(stage0): remove impl after a snapshot
687+
#[cfg(stage0)]
688+
impl<T> Pointer for *mut T {
689+
fn fmt(&self, f: &mut Formatter) -> Result {
690+
secret_pointer::<*const T>(&(*self as *const T), f)
691+
}
692+
}
693+
694+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
602695
impl<T> Pointer for *mut T {
603696
fn fmt(&self, f: &mut Formatter) -> Result {
604697
Pointer::fmt(&(*self as *const T), f)
605698
}
606699
}
607700

701+
// NOTE(stage0): remove impl after a snapshot
702+
#[cfg(stage0)]
703+
impl<'a, T> Pointer for &'a T {
704+
fn fmt(&self, f: &mut Formatter) -> Result {
705+
secret_pointer::<*const T>(&(&**self as *const T), f)
706+
}
707+
}
708+
709+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
608710
impl<'a, T> Pointer for &'a T {
609711
fn fmt(&self, f: &mut Formatter) -> Result {
610712
Pointer::fmt(&(*self as *const T), f)
611713
}
612714
}
613715

716+
// NOTE(stage0): remove impl after a snapshot
717+
#[cfg(stage0)]
718+
impl<'a, T> Pointer for &'a mut T {
719+
fn fmt(&self, f: &mut Formatter) -> Result {
720+
secret_pointer::<*const T>(&(&**self as *const T), f)
721+
}
722+
}
723+
724+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
614725
impl<'a, T> Pointer for &'a mut T {
615726
fn fmt(&self, f: &mut Formatter) -> Result {
616727
Pointer::fmt(&(&**self as *const T), f)
@@ -686,23 +797,65 @@ floating!(f64)
686797

687798
// Implementation of Show for various core types
688799

800+
// NOTE(stage0): remove macro after a snapshot
801+
#[cfg(stage0)]
802+
macro_rules! delegate(($ty:ty to $other:ident) => {
803+
impl Show for $ty {
804+
fn fmt(&self, f: &mut Formatter) -> Result {
805+
(concat_idents!(secret_, $other)(self, f))
806+
}
807+
}
808+
})
809+
810+
// NOTE(stage0): remove these macros after a snapshot
811+
#[cfg(stage0)]
812+
delegate!(str to string)
813+
#[cfg(stage0)]
814+
delegate!(bool to bool)
815+
#[cfg(stage0)]
816+
delegate!(char to char)
817+
#[cfg(stage0)]
818+
delegate!(f32 to float)
819+
#[cfg(stage0)]
820+
delegate!(f64 to float)
821+
822+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
689823
macro_rules! delegate(($ty:ty to $other:ident) => {
690824
impl Show for $ty {
691825
fn fmt(&self, f: &mut Formatter) -> Result {
692826
$other::fmt(self, f)
693827
}
694828
}
695829
})
830+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
696831
delegate!(str to String)
832+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
697833
delegate!(bool to Bool)
834+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
698835
delegate!(char to Char)
836+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
699837
delegate!(f32 to Float)
838+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
700839
delegate!(f64 to Float)
701840

841+
// NOTE(stage0): remove impl after a snapshot
842+
#[cfg(stage0)]
843+
impl<T> Show for *const T {
844+
fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
845+
}
846+
847+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
702848
impl<T> Show for *const T {
703849
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
704850
}
705851

852+
// NOTE(stage0): remove impl after a snapshot
853+
#[cfg(stage0)]
854+
impl<T> Show for *mut T {
855+
fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
856+
}
857+
858+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
706859
impl<T> Show for *mut T {
707860
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
708861
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ extern "rust-intrinsic" {
171171
/// with optimization of surrounding code and reduce performance. It should
172172
/// not be used if the invariant can be discovered by the optimizer on its
173173
/// own, or if it does not enable any significant optimizations.
174+
#[cfg(not(stage0))]
174175
pub fn assume(b: bool);
175176

176177
/// Execute a breakpoint trap, for inspection by a debugger.

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,30 +849,34 @@ pub trait DerefMut<Sized? Result>: Deref<Result> {
849849
#[lang="fn"]
850850
pub trait Fn<Args,Result> {
851851
/// This is called when the call operator is used.
852-
extern "rust-call" fn call(&self, args: Args) -> Result;
852+
#[rust_call_abi_hack]
853+
fn call(&self, args: Args) -> Result;
853854
}
854855

855856
/// A version of the call operator that takes a mutable receiver.
856857
#[lang="fn_mut"]
857858
pub trait FnMut<Args,Result> {
858859
/// This is called when the call operator is used.
859-
extern "rust-call" fn call_mut(&mut self, args: Args) -> Result;
860+
#[rust_call_abi_hack]
861+
fn call_mut(&mut self, args: Args) -> Result;
860862
}
861863

862864
/// A version of the call operator that takes a by-value receiver.
863865
#[lang="fn_once"]
864866
pub trait FnOnce<Args,Result> {
865867
/// This is called when the call operator is used.
866-
extern "rust-call" fn call_once(self, args: Args) -> Result;
868+
#[rust_call_abi_hack]
869+
fn call_once(self, args: Args) -> Result;
867870
}
868871

869872
macro_rules! def_fn_mut(
870873
($($args:ident)*) => (
871874
impl<Result$(,$args)*>
872875
FnMut<($($args,)*),Result>
873876
for extern "Rust" fn($($args: $args,)*) -> Result {
877+
#[rust_call_abi_hack]
874878
#[allow(non_snake_case)]
875-
extern "rust-call" fn call_mut(&mut self, args: ($($args,)*)) -> Result {
879+
fn call_mut(&mut self, args: ($($args,)*)) -> Result {
876880
let ($($args,)*) = args;
877881
(*self)($($args,)*)
878882
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,8 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
787787
/// use std::uint;
788788
///
789789
/// let v = vec!(1u, 2u);
790-
/// let res: Option<Vec<uint>> = v.iter().map(|x: &uint|
791-
/// if *x == uint::MAX { None }
790+
/// let res: Option<Vec<uint>> = v.iter().map(|&x: &uint|
791+
/// if x == uint::MAX { None }
792792
/// else { Some(x + 1) }
793793
/// ).collect();
794794
/// assert!(res == Some(vec!(2u, 3u)));

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,49 @@
3333
use fmt;
3434
use intrinsics;
3535

36+
// NOTE(stage0): remove after a snapshot
37+
#[cfg(stage0)]
38+
#[cold] #[inline(never)] // this is the slow path, always
39+
#[lang="fail"]
40+
pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
41+
let (expr, file, line) = *expr_file_line;
42+
let ref file_line = (file, line);
43+
format_args!(|args| -> () {
44+
panic_fmt(args, file_line);
45+
}, "{}", expr);
46+
47+
unsafe { intrinsics::abort() }
48+
}
49+
50+
// NOTE(stage0): remove after a snapshot
51+
#[cfg(stage0)]
52+
#[cold] #[inline(never)]
53+
#[lang="fail_bounds_check"]
54+
fn panic_bounds_check(file_line: &(&'static str, uint),
55+
index: uint, len: uint) -> ! {
56+
format_args!(|args| -> () {
57+
panic_fmt(args, file_line);
58+
}, "index out of bounds: the len is {} but the index is {}", len, index);
59+
unsafe { intrinsics::abort() }
60+
}
61+
62+
// NOTE(stage0): remove after a snapshot
63+
#[cfg(stage0)]
64+
#[cold] #[inline(never)]
65+
pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
66+
#[allow(improper_ctypes)]
67+
extern {
68+
#[lang = "fail_fmt"]
69+
fn panic_impl(fmt: &fmt::Arguments, file: &'static str,
70+
line: uint) -> !;
71+
72+
}
73+
let (file, line) = *file_line;
74+
unsafe { panic_impl(fmt, file, line) }
75+
}
76+
77+
// NOTE(stage0): remove cfg after a snapshot
78+
#[cfg(not(stage0))]
3679
#[cold] #[inline(never)] // this is the slow path, always
3780
#[lang="panic"]
3881
pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
@@ -45,6 +88,8 @@ pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
4588
unsafe { intrinsics::abort() }
4689
}
4790

91+
// NOTE(stage0): remove cfg after a snapshot
92+
#[cfg(not(stage0))]
4893
#[cold] #[inline(never)]
4994
#[lang="panic_bounds_check"]
5095
fn panic_bounds_check(file_line: &(&'static str, uint),
@@ -55,6 +100,8 @@ fn panic_bounds_check(file_line: &(&'static str, uint),
55100
unsafe { intrinsics::abort() }
56101
}
57102

103+
// NOTE(stage0): remove cfg after a snapshot
104+
#[cfg(not(stage0))]
58105
#[cold] #[inline(never)]
59106
pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
60107
#[allow(improper_ctypes)]

0 commit comments

Comments
 (0)