Skip to content

Commit 6b8eaf8

Browse files
committed
---
yaml --- r: 58723 b: refs/heads/try c: 4dd0fa6 h: refs/heads/master i: 58721: dacbe4f 58719: 4119b0a v: v3
1 parent a77bf28 commit 6b8eaf8

File tree

340 files changed

+8364
-10916
lines changed

Some content is hidden

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

340 files changed

+8364
-10916
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 213f7b24ccd9a6833af7e1a329c5e7ffc8f9e3d2
5-
refs/heads/try: e7d96934c16c915d18be391836fbf0ebca6c558b
5+
refs/heads/try: 4dd0fa68766e84499bd1680043b38a34a9fc7606
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rust.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,8 @@ A complete list of the built-in language items follows:
14671467
: Elements can be subtracted.
14681468
`mul`
14691469
: Elements can be multiplied.
1470-
`quot`
1471-
: Elements have a quotient operation.
1470+
`div`
1471+
: Elements have a division operation.
14721472
`rem`
14731473
: Elements have a remainder operation.
14741474
`neg`
@@ -1857,7 +1857,7 @@ The default meaning of the operators on standard types is given here.
18571857
Calls the `mul` method on the `core::ops::Mul` trait.
18581858
`/`
18591859
: Quotient.
1860-
Calls the `quot` method on the `core::ops::Quot` trait.
1860+
Calls the `div` method on the `core::ops::Div` trait.
18611861
`%`
18621862
: Remainder.
18631863
Calls the `rem` method on the `core::ops::Rem` trait.
@@ -2393,7 +2393,7 @@ variables in the arm's block, and control enters the block.
23932393
An example of an `match` expression:
23942394

23952395

2396-
~~~~ {.xfail-test}
2396+
~~~~
23972397
# fn process_pair(a: int, b: int) { }
23982398
# fn process_ten() { }
23992399

branches/try/mk/clean.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ clean-misc:
4848
$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
4949
$(Q)rm -Rf $(DOCS)
5050
$(Q)rm -Rf $(GENERATED)
51-
$(Q)rm -f tmp/*.log tmp/*.rc tmp/*.rs tmp/*.ok
51+
$(Q)rm -f tmp/*
5252
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz dist
5353
$(Q)rm -Rf $(foreach ext, \
5454
html aux cp fn ky log pdf pg toc tp vr cps, \

branches/try/mk/host.mk

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ $$(HBIN$(2)_H_$(4))/rustc$$(X_$(4)): \
2929
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
3030
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
3131
$$(HCORELIB_DEFAULT$(2)_H_$(4)) \
32-
$$(HSTDLIB_DEFAULT$(2)_H_$(4))
32+
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
33+
| $$(HBIN$(2)_H_$(4))/
34+
3335
@$$(call E, cp: $$@)
3436
$$(Q)cp $$< $$@
3537

@@ -39,7 +41,9 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
3941
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
4042
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
4143
$$(HCORELIB_DEFAULT$(2)_H_$(4)) \
42-
$$(HSTDLIB_DEFAULT$(2)_H_$(4))
44+
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
45+
| $$(HBIN$(2)_H_$(4))/
46+
4347
@$$(call E, cp: $$@)
4448
$$(Q)cp $$< $$@
4549
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTC_GLOB_$(4)) \
@@ -51,21 +55,24 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \
5155
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
5256
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
5357
$$(HCORELIB_DEFAULT$(2)_H_$(4)) \
54-
$$(HSTDLIB_DEFAULT$(2)_H_$(4))
58+
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
59+
| $$(HBIN$(2)_H_$(4))/
5560
@$$(call E, cp: $$@)
5661
$$(Q)cp $$< $$@
5762
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_GLOB_$(4)) \
5863
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_DSYM_GLOB_$(4))) \
5964
$$(HLIB$(2)_H_$(4))
6065

6166
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)): \
62-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUNTIME_$(4))
67+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUNTIME_$(4)) \
68+
| $$(HBIN$(2)_H_$(4))/
6369
@$$(call E, cp: $$@)
6470
$$(Q)cp $$< $$@
6571

6672
$$(HLIB$(2)_H_$(4))/$(CFG_CORELIB_$(4)): \
6773
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
68-
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4))
74+
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
75+
| $$(HBIN$(2)_H_$(4))/
6976
@$$(call E, cp: $$@)
7077
$$(Q)cp $$< $$@
7178
# Subtle: We do not let the shell expand $(CORELIB_DSYM_GLOB) directly rather
@@ -82,7 +89,8 @@ $$(HLIB$(2)_H_$(4))/$(CFG_CORELIB_$(4)): \
8289
$$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)): \
8390
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
8491
$$(HLIB$(2)_H_$(4))/$(CFG_CORELIB_$(4)) \
85-
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4))
92+
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
93+
| $$(HBIN$(2)_H_$(4))/
8694
@$$(call E, cp: $$@)
8795
$$(Q)cp $$< $$@
8896
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_GLOB_$(4)) \
@@ -91,30 +99,37 @@ $$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)): \
9199

92100
$$(HLIB$(2)_H_$(4))/libcore.rlib: \
93101
$$(TLIB$(1)_T_$(4)_H_$(3))/libcore.rlib \
94-
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
102+
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
103+
| $$(HBIN$(2)_H_$(4))/
95104
@$$(call E, cp: $$@)
96105
$$(Q)cp $$< $$@
97106

98107
$$(HLIB$(2)_H_$(4))/libstd.rlib: \
99108
$$(TLIB$(1)_T_$(4)_H_$(3))/libstd.rlib \
100109
$$(HLIB$(2)_H_$(4))/libcore.rlib \
101-
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
110+
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
111+
| $$(HBIN$(2)_H_$(4))/
102112
@$$(call E, cp: $$@)
103113
$$(Q)cp $$< $$@
104114

105115
$$(HLIB$(2)_H_$(4))/librustc.rlib: \
106116
$$(TLIB$(1)_T_$(4)_H_$(3))/librustc.rlib \
107117
$$(HLIB$(2)_H_$(4))/libcore.rlib \
108118
$$(HLIB$(2)_H_$(4))/libstd.rlib \
109-
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
119+
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
120+
| $$(HBIN$(2)_H_$(4))/
110121
@$$(call E, cp: $$@)
111122
$$(Q)cp $$< $$@
112123

113124
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
114-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4))
125+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4)) \
126+
| $$(HBIN$(2)_H_$(4))/
115127
@$$(call E, cp: $$@)
116128
$$(Q)cp $$< $$@
117129

130+
$$(HBIN$(2)_H_$(4))/:
131+
mkdir -p $@
132+
118133
endef
119134

120135
$(foreach t,$(CFG_HOST_TRIPLES), \

branches/try/mk/target.mk

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,62 @@
1818
define TARGET_STAGE_N
1919

2020
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
21-
rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a
21+
rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a \
22+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
2223
@$$(call E, cp: $$@)
2324
$$(Q)cp $$< $$@
2425

2526
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
26-
rt/$(2)/$(CFG_RUNTIME_$(2))
27+
rt/$(2)/$(CFG_RUNTIME_$(2)) \
28+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
2729
@$$(call E, cp: $$@)
2830
$$(Q)cp $$< $$@
2931

3032
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB_$(2)): \
3133
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
32-
$$(TSREQ$(1)_T_$(2)_H_$(3))
34+
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
35+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
3336
@$$(call E, compile_and_link: $$@)
3437
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
3538

3639
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
3740
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
3841
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB_$(2)) \
39-
$$(TSREQ$(1)_T_$(2)_H_$(3))
42+
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
43+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
4044
@$$(call E, compile_and_link: $$@)
4145
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
4246

4347
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
4448
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
4549
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
4650
$$(TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
47-
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
51+
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
52+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
4853
@$$(call E, compile_and_link: $$@)
4954
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
5055

5156
# Only build the compiler for host triples
5257
ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),)
5358

5459
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
55-
rustllvm/$(2)/$(CFG_RUSTLLVM_$(3))
60+
rustllvm/$(2)/$(CFG_RUSTLLVM_$(3)) \
61+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
5662
@$$(call E, cp: $$@)
5763
$$(Q)cp $$< $$@
5864

5965
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
6066
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
6167
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
62-
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3))
68+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
69+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
6370
@$$(call E, compile_and_link: $$@)
6471
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
6572

6673
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
67-
$$(DRIVER_CRATE) \
68-
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3))
74+
$$(DRIVER_CRATE) \
75+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)) \
76+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
6977
@$$(call E, compile_and_link: $$@)
7078
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
7179
ifdef CFG_ENABLE_PAX_FLAGS
@@ -75,6 +83,9 @@ endif
7583

7684
endif
7785

86+
$$(TLIB$(1)_T_$(2)_H_$(3))/:
87+
mkdir -p $@
88+
7889
endef
7990

8091
# In principle, each host can build each target:

branches/try/src/compiletest/compiletest.rc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,3 @@ pub fn make_test_closure(config: config, testfile: &Path) -> test::TestFn {
223223
let testfile = testfile.to_str();
224224
test::DynTestFn(|| runtest::run(config, testfile))
225225
}
226-
227-
// Local Variables:
228-
// fill-column: 78;
229-
// indent-tabs-mode: nil
230-
// c-basic-offset: 4
231-
// buffer-file-coding-system: utf-8-unix
232-
// End:
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/usr/bin/env python
2+
# xfail-license
3+
4+
# This creates the tables used for distributions implemented using the
5+
# ziggurat algorithm in `core::rand::distributions;`. They are
6+
# (basically) the tables as used in the ZIGNOR variant (Doornik 2005).
7+
# They are changed rarely, so the generated file should be checked in
8+
# to git.
9+
#
10+
# It creates 3 tables: X as in the paper, F which is f(x_i), and
11+
# F_DIFF which is f(x_i) - f(x_{i-1}). The latter two are just cached
12+
# values which is not done in that paper (but is done in other
13+
# variants). Note that the adZigR table is unnecessary because of
14+
# algebra.
15+
#
16+
# It is designed to be compatible with Python 2 and 3.
17+
18+
from math import exp, sqrt, log, floor
19+
import random
20+
21+
# The order should match the return value of `tables`
22+
TABLE_NAMES = ['X', 'F', 'F_DIFF']
23+
24+
# The actual length of the table is 1 more, to stop
25+
# index-out-of-bounds errors. This should match the bitwise operation
26+
# to find `i` in `zigurrat` in `libstd/rand/mod.rs`. Also the *_R and
27+
# *_V constants below depend on this value.
28+
TABLE_LEN = 256
29+
30+
# equivalent to `zigNorInit` in Doornik2005, but generalised to any
31+
# distribution. r = dR, v = dV, f = probability density function,
32+
# f_inv = inverse of f
33+
def tables(r, v, f, f_inv):
34+
# compute the x_i
35+
xvec = [0]*(TABLE_LEN+1)
36+
37+
xvec[0] = v / f(r)
38+
xvec[1] = r
39+
40+
for i in range(2, TABLE_LEN):
41+
last = xvec[i-1]
42+
xvec[i] = f_inv(v / last + f(last))
43+
44+
# cache the f's
45+
fvec = [0]*(TABLE_LEN+1)
46+
fdiff = [0]*(TABLE_LEN+1)
47+
for i in range(TABLE_LEN+1):
48+
fvec[i] = f(xvec[i])
49+
if i > 0:
50+
fdiff[i] = fvec[i] - fvec[i-1]
51+
52+
return xvec, fvec, fdiff
53+
54+
# Distributions
55+
# N(0, 1)
56+
def norm_f(x):
57+
return exp(-x*x/2.0)
58+
def norm_f_inv(y):
59+
return sqrt(-2.0*log(y))
60+
61+
NORM_R = 3.6541528853610088
62+
NORM_V = 0.00492867323399
63+
64+
NORM = tables(NORM_R, NORM_V,
65+
norm_f, norm_f_inv)
66+
67+
# Exp(1)
68+
def exp_f(x):
69+
return exp(-x)
70+
def exp_f_inv(y):
71+
return -log(y)
72+
73+
EXP_R = 7.69711747013104972
74+
EXP_V = 0.0039496598225815571993
75+
76+
EXP = tables(EXP_R, EXP_V,
77+
exp_f, exp_f_inv)
78+
79+
80+
# Output the tables/constants/types
81+
82+
def render_static(name, type, value):
83+
# no space or
84+
return 'pub static %s: %s =%s;\n' % (name, type, value)
85+
86+
# static `name`: [`type`, .. `len(values)`] =
87+
# [values[0], ..., values[3],
88+
# values[4], ..., values[7],
89+
# ... ];
90+
def render_table(name, values):
91+
rows = []
92+
# 4 values on each row
93+
for i in range(0, len(values), 4):
94+
row = values[i:i+4]
95+
rows.append(', '.join('%.18f' % f for f in row))
96+
97+
rendered = '\n [%s]' % ',\n '.join(rows)
98+
return render_static(name, '[f64, .. %d]' % len(values), rendered)
99+
100+
101+
with open('ziggurat_tables.rs', 'w') as f:
102+
f.write('''// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
103+
// file at the top-level directory of this distribution and at
104+
// http://rust-lang.org/COPYRIGHT.
105+
//
106+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
107+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
108+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
109+
// option. This file may not be copied, modified, or distributed
110+
// except according to those terms.
111+
112+
// Tables for distributions which are sampled using the ziggurat
113+
// algorithm. Autogenerated by `ziggurat_tables.py`.
114+
115+
pub type ZigTable = &\'static [f64, .. %d];
116+
''' % (TABLE_LEN + 1))
117+
for name, tables, r in [('NORM', NORM, NORM_R),
118+
('EXP', EXP, EXP_R)]:
119+
f.write(render_static('ZIG_%s_R' % name, 'f64', ' %.18f' % r))
120+
for (tabname, table) in zip(TABLE_NAMES, tables):
121+
f.write(render_table('ZIG_%s_%s' % (name, tabname), table))

branches/try/src/libcore/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn empty_cell<T>() -> Cell<T> {
4242
pub impl<T> Cell<T> {
4343
/// Yields the value, failing if the cell is empty.
4444
fn take(&self) -> T {
45-
let self = unsafe { transmute_mut(self) };
45+
let mut self = unsafe { transmute_mut(self) };
4646
if self.is_empty() {
4747
fail!(~"attempt to take an empty cell");
4848
}
@@ -54,7 +54,7 @@ pub impl<T> Cell<T> {
5454
5555
/// Returns the value, failing if the cell is full.
5656
fn put_back(&self, value: T) {
57-
let self = unsafe { transmute_mut(self) };
57+
let mut self = unsafe { transmute_mut(self) };
5858
if !self.is_empty() {
5959
fail!(~"attempt to put a value back into a full cell");
6060
}

branches/try/src/libcore/char.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
//! Utilities for manipulating the char type
1212
13+
#[cfg(notest)]
1314
use cmp::Ord;
1415
use option::{None, Option, Some};
1516
use str;

0 commit comments

Comments
 (0)