Skip to content

Commit e63674d

Browse files
committed
---
yaml --- r: 146351 b: refs/heads/try2 c: 96589e7 h: refs/heads/master i: 146349: 2d7ce5b 146347: 0d553eb 146343: 2c2839d 146335: ac3e32a v: v3
1 parent 7341b80 commit e63674d

30 files changed

+410
-620
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: 04c58c9f81c5d9b6b1847573a41c8b819893a12a
8+
refs/heads/try2: 96589e7264fae59a04ef47d3e5dc04fdabc9441f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/configure

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -670,13 +670,6 @@ do
670670
fi
671671
;;
672672

673-
arm-apple-darwin)
674-
if [ $CFG_OSTYPE != apple-darwin ]
675-
then
676-
err "The iOS target is only supported on Mac OS X"
677-
fi
678-
;;
679-
680673
*)
681674
;;
682675
esac

branches/try2/doc/rust.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ This requirement most often affects name-designator pairs when they occur at the
568568
* `log_syntax!` : print out the arguments at compile time
569569
* `trace_macros!` : supply `true` or `false` to enable or disable macro expansion logging
570570
* `stringify!` : turn the identifier argument into a string literal
571-
* `concat!` : concatenates a comma-separated list of literals
572571
* `concat_idents!` : create a new identifier by concatenating the arguments
573572

574573
# Crates and source files

branches/try2/mk/platform.mk

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -193,35 +193,6 @@ CFG_LDPATH_i686-unknown-linux-gnu :=
193193
CFG_RUN_i686-unknown-linux-gnu=$(2)
194194
CFG_RUN_TARG_i686-unknown-linux-gnu=$(call CFG_RUN_i686-unknown-linux-gnu,,$(2))
195195

196-
# arm-apple-darwin configuration
197-
ifeq ($(CFG_OSTYPE),apple-darwin)
198-
CFG_IOS_SDK = $(shell xcrun --show-sdk-path -sdk iphoneos)
199-
CFG_IOS_FLAGS = -target arm-apple-darwin -isysroot $(CFG_IOS_SDK) -I $(CFG_IOS_SDK)/usr/include -I $(CFG_IOS_SDK)/usr/include/c++/4.2.1 -I /usr/include
200-
CC_arm-apple-darwin = $(shell xcrun -find -sdk iphoneos clang)
201-
CXX_arm-apple-darwin = $(shell xcrun -find -sdk iphoneos clang++)
202-
CPP_arm-apple-darwin = $(shell xcrun -find -sdk iphoneos clang++)
203-
AR_arm-apple-darwin = $(shell xcrun -find -sdk iphoneos ar)
204-
CFG_LIB_NAME_arm-apple-darwin = lib$(1).dylib
205-
CFG_LIB_GLOB_arm-apple-darwin = lib$(1)-*.dylib
206-
CFG_LIB_DSYM_GLOB_arm-apple-darwin = lib$(1)-*.dylib.dSYM
207-
CFG_GCCISH_CFLAGS_arm-apple-darwin := -Wall -Werror -g -fPIC $(CFG_IOS_FLAGS)
208-
CFG_GCCISH_CXXFLAGS_arm-apple-darwin := -fno-rtti $(CFG_IOS_FLAGS)
209-
CFG_GCCISH_LINK_FLAGS_arm-apple-darwin := -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind
210-
CFG_GCCISH_DEF_FLAG_arm-apple-darwin := -Wl,-exported_symbols_list,
211-
CFG_GCCISH_PRE_LIB_FLAGS_arm-apple-darwin :=
212-
CFG_GCCISH_POST_LIB_FLAGS_arm-apple-darwin :=
213-
CFG_DEF_SUFFIX_arm-apple-darwin := .darwin.def
214-
CFG_INSTALL_NAME_arm-apple-darwin = -Wl,-install_name,@rpath/$(1)
215-
CFG_LIBUV_LINK_FLAGS_arm-apple-darwin =
216-
CFG_EXE_SUFFIX_arm-apple-darwin :=
217-
CFG_WINDOWSY_arm-apple-darwin :=
218-
CFG_UNIXY_arm-apple-darwin := 1
219-
CFG_PATH_MUNGE_arm-apple-darwin := true
220-
CFG_LDPATH_arm-apple-darwin :=
221-
CFG_RUN_arm-apple-darwin = $(2)
222-
CFG_RUN_TARG_arm-apple-darwin = $(call CFG_RUN_arm-apple-darwin,,$(2))
223-
endif
224-
225196
# x86_64-apple-darwin configuration
226197
CC_x86_64-apple-darwin=$(CC)
227198
CXX_x86_64-apple-darwin=$(CXX)

branches/try2/src/etc/ziggurat_tables.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import random
2020

2121
# The order should match the return value of `tables`
22-
TABLE_NAMES = ['X', 'F']
22+
TABLE_NAMES = ['X', 'F', 'F_DIFF']
2323

2424
# The actual length of the table is 1 more, to stop
2525
# index-out-of-bounds errors. This should match the bitwise operation
@@ -43,10 +43,13 @@ def tables(r, v, f, f_inv):
4343

4444
# cache the f's
4545
fvec = [0]*(TABLE_LEN+1)
46+
fdiff = [0]*(TABLE_LEN+1)
4647
for i in range(TABLE_LEN+1):
4748
fvec[i] = f(xvec[i])
49+
if i > 0:
50+
fdiff[i] = fvec[i] - fvec[i-1]
4851

49-
return xvec, fvec
52+
return xvec, fvec, fdiff
5053

5154
# Distributions
5255
# N(0, 1)

branches/try2/src/librustc/front/feature_gate.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ impl Visitor<()> for Context {
140140

141141
},
142142
ast::ty_box(_) => {
143-
self.gate_feature("managed_boxes", t.span,
144-
"The managed box syntax will be replaced \
145-
by a library type, and a garbage \
146-
collector is not yet implemented. \
147-
Consider using the `std::rc::Rc` type \
148-
for reference counted pointers.");
143+
self.gate_feature("managed_boxes", t.span, "The managed box syntax may be replaced \
144+
by a library type, and a garbage \
145+
collector is not yet implemented. \
146+
Consider using the `std::rc` module \
147+
as it performs much better as a \
148+
reference counting implementation.");
149149
}
150150
_ => {}
151151
}

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ pub fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv, ty: Type)
182182
};
183183

184184
lib::llvm::SetFunctionCallConv(llfn, cc);
185-
// Function addresses in Rust are never significant, allowing functions to be merged.
186-
lib::llvm::SetUnnamedAddr(llfn, true);
187185
return llfn;
188186
}
189187

branches/try2/src/librustc/util/ppaux.rs

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,10 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
308308
ident: Option<ast::Ident>,
309309
sig: &ty::FnSig)
310310
-> ~str {
311-
let mut s = if abis.is_rust() {
312-
~""
313-
} else {
314-
format!("extern {} ", abis.to_str())
315-
};
311+
let mut s = ~"extern ";
312+
313+
s.push_str(abis.to_str());
314+
s.push_char(' ');
316315
317316
match purity {
318317
ast::impure_fn => {}
@@ -332,16 +331,16 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
332331
_ => { }
333332
}
334333

335-
push_sig_to_str(cx, &mut s, '(', ')', sig);
334+
push_sig_to_str(cx, &mut s, sig);
336335

337336
return s;
338337
}
339-
fn closure_to_str(cx: ctxt, cty: &ty::ClosureTy) -> ~str {
338+
fn closure_to_str(cx: ctxt, cty: &ty::ClosureTy) -> ~str
339+
{
340340
let is_proc =
341341
(cty.sigil, cty.onceness) == (ast::OwnedSigil, ast::Once);
342-
let is_borrowed_closure = cty.sigil == ast::BorrowedSigil;
343342

344-
let mut s = if is_proc || is_borrowed_closure {
343+
let mut s = if is_proc {
345344
~""
346345
} else {
347346
cty.sigil.to_str()
@@ -375,42 +374,23 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
375374
}
376375
};
377376

378-
if !is_borrowed_closure {
379-
s.push_str("fn");
380-
}
377+
s.push_str("fn");
381378
}
382379

383-
if !is_borrowed_closure {
384-
// Print bounds before `fn` if this is not a borrowed closure.
385-
if !cty.bounds.is_empty() {
386-
s.push_str(":");
387-
s.push_str(cty.bounds.repr(cx));
388-
}
389-
390-
push_sig_to_str(cx, &mut s, '(', ')', &cty.sig);
391-
} else {
392-
// Print bounds after the signature if this is a borrowed closure.
393-
push_sig_to_str(cx, &mut s, '|', '|', &cty.sig);
394-
395-
if is_borrowed_closure {
396-
if !cty.bounds.is_empty() {
397-
s.push_str(":");
398-
s.push_str(cty.bounds.repr(cx));
399-
}
400-
}
380+
if !cty.bounds.is_empty() {
381+
s.push_str(":");
401382
}
383+
s.push_str(cty.bounds.repr(cx));
384+
385+
push_sig_to_str(cx, &mut s, &cty.sig);
402386

403387
return s;
404388
}
405-
fn push_sig_to_str(cx: ctxt,
406-
s: &mut ~str,
407-
bra: char,
408-
ket: char,
409-
sig: &ty::FnSig) {
410-
s.push_char(bra);
389+
fn push_sig_to_str(cx: ctxt, s: &mut ~str, sig: &ty::FnSig) {
390+
s.push_char('(');
411391
let strs = sig.inputs.map(|a| fn_input_to_str(cx, *a));
412392
s.push_str(strs.connect(", "));
413-
s.push_char(ket);
393+
s.push_char(')');
414394
if ty::get(sig.output).sty != ty_nil {
415395
s.push_str(" -> ");
416396
if ty::type_is_bot(sig.output) {

branches/try2/src/libstd/rand/distributions.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ fn ziggurat<R:Rng>(rng: &mut R,
207207
symmetric: bool,
208208
X: ziggurat_tables::ZigTable,
209209
F: ziggurat_tables::ZigTable,
210+
F_DIFF: ziggurat_tables::ZigTable,
210211
pdf: &'static fn(f64) -> f64,
211212
zero_case: &'static fn(&mut R, f64) -> f64) -> f64 {
212213
static SCALE: f64 = (1u64 << 53) as f64;
@@ -236,7 +237,7 @@ fn ziggurat<R:Rng>(rng: &mut R,
236237
return zero_case(rng, u);
237238
}
238239
// algebraically equivalent to f1 + DRanU()*(f0 - f1) < 1
239-
if F[i + 1] + (F[i] - F[i + 1]) * rng.gen() < pdf(x) {
240+
if F[i + 1] + F_DIFF[i + 1] * rng.gen() < pdf(x) {
240241
return x;
241242
}
242243
}
@@ -287,7 +288,7 @@ impl Rand for StandardNormal {
287288
rng,
288289
true, // this is symmetric
289290
&ziggurat_tables::ZIG_NORM_X,
290-
&ziggurat_tables::ZIG_NORM_F,
291+
&ziggurat_tables::ZIG_NORM_F, &ziggurat_tables::ZIG_NORM_F_DIFF,
291292
pdf, zero_case))
292293
}
293294
}
@@ -365,7 +366,7 @@ impl Rand for Exp1 {
365366

366367
Exp1(ziggurat(rng, false,
367368
&ziggurat_tables::ZIG_EXP_X,
368-
&ziggurat_tables::ZIG_EXP_F,
369+
&ziggurat_tables::ZIG_EXP_F, &ziggurat_tables::ZIG_EXP_F_DIFF,
369370
pdf, zero_case))
370371
}
371372
}

branches/try2/src/libstd/rand/reseeding.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<R: Rng, Rsdr: Reseeder<R>> Rng for ReseedingRng<R, Rsdr> {
7272
fn fill_bytes(&mut self, dest: &mut [u8]) {
7373
self.reseed_if_necessary();
7474
self.bytes_generated += dest.len();
75-
self.fill_bytes(dest)
75+
self.rng.fill_bytes(dest)
7676
}
7777
}
7878

@@ -201,4 +201,24 @@ mod test {
201201
let string2 = r.gen_ascii_str(100);
202202
assert_eq!(string1, string2);
203203
}
204+
205+
static fill_bytes_v_len: uint = 13579;
206+
#[test]
207+
fn test_rng_fill_bytes() {
208+
use rand::task_rng;
209+
let mut v = ~[0u8, .. fill_bytes_v_len];
210+
task_rng().fill_bytes(v);
211+
212+
// Sanity test: if we've gotten here, `fill_bytes` has not infinitely
213+
// recursed.
214+
assert_eq!(v.len(), fill_bytes_v_len);
215+
216+
// To test that `fill_bytes` actually did something, check that the
217+
// average of `v` is not 0.
218+
let mut sum = 0.0;
219+
for &x in v.iter() {
220+
sum += x as f64;
221+
}
222+
assert!(sum / v.len() as f64 != 0.0);
223+
}
204224
}

0 commit comments

Comments
 (0)