Skip to content

Commit 8bd3e18

Browse files
committed
---
yaml --- r: 232412 b: refs/heads/try c: 2945555 h: refs/heads/master v: v3
1 parent 34d18b0 commit 8bd3e18

File tree

358 files changed

+11627
-16785
lines changed

Some content is hidden

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

358 files changed

+11627
-16785
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: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: ae68e90af49c4cf9c75778e570d436fe36011b23
4+
refs/heads/try: 29455557aa48d1047f274e60703edf7813fe5b6b
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/mk/crates.mk

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@
5252
TARGET_CRATES := libc std flate arena term \
5353
serialize getopts collections test rand \
5454
log graphviz core rbml alloc \
55-
rustc_unicode rustc_bitflags
55+
rustc_unicode rustc_bitflags \
56+
alloc_system
5657
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
5758
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
5859
rustc_data_structures
5960
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
60-
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
6161
TOOLS := compiletest rustdoc rustc rustbook error-index-generator
6262

6363
DEPS_core :=
6464
DEPS_libc := core
6565
DEPS_rustc_unicode := core
66-
DEPS_alloc := core libc native:jemalloc
66+
DEPS_alloc := core libc alloc_system
6767
DEPS_std := core libc rand alloc collections rustc_unicode \
6868
native:rust_builtin native:backtrace \
69-
rustc_bitflags
69+
alloc_system
7070
DEPS_graphviz := std
71-
DEPS_syntax := std term serialize log fmt_macros arena libc
71+
DEPS_syntax := std term serialize log fmt_macros arena libc rustc_bitflags
7272
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
7373
rustc_typeck rustc_resolve log syntax serialize rustc_llvm \
7474
rustc_trans rustc_privacy rustc_lint
@@ -82,7 +82,7 @@ DEPS_rustc_privacy := rustc log syntax
8282
DEPS_rustc_lint := rustc log syntax
8383
DEPS_rustc := syntax flate arena serialize getopts rbml \
8484
log graphviz rustc_llvm rustc_back rustc_data_structures
85-
DEPS_rustc_llvm := native:rustllvm libc std
85+
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
8686
DEPS_rustc_back := std syntax rustc_llvm flate log libc
8787
DEPS_rustc_data_structures := std log serialize
8888
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
@@ -102,6 +102,7 @@ DEPS_test := std getopts serialize rbml term native:rust_test_helpers
102102
DEPS_rand := core
103103
DEPS_log := std
104104
DEPS_fmt_macros = std
105+
DEPS_alloc_system := core libc
105106

106107
TOOL_DEPS_compiletest := test getopts
107108
TOOL_DEPS_rustdoc := rustdoc
@@ -121,14 +122,26 @@ ONLY_RLIB_rand := 1
121122
ONLY_RLIB_collections := 1
122123
ONLY_RLIB_rustc_unicode := 1
123124
ONLY_RLIB_rustc_bitflags := 1
125+
ONLY_RLIB_alloc_system := 1
124126

125127
# Documented-by-default crates
126128
DOC_CRATES := std alloc collections core libc rustc_unicode
127129

130+
ifeq ($(CFG_DISABLE_JEMALLOC),)
131+
TARGET_CRATES += alloc_jemalloc
132+
DEPS_std += alloc_jemalloc
133+
DEPS_alloc_jemalloc := core libc native:jemalloc
134+
ONLY_RLIB_alloc_jemalloc := 1
135+
else
136+
RUSTFLAGS_rustc_back := --cfg disable_jemalloc
137+
endif
138+
128139
################################################################################
129140
# You should not need to edit below this line
130141
################################################################################
131142

143+
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
144+
132145
# This macro creates some simple definitions for each crate being built, just
133146
# some munging of all of the parameters above.
134147
#

branches/try/mk/rt.mk

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ $$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
184184
EXTRA_CFLAGS="-g1 -ffunction-sections -fdata-sections"
185185
$$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
186186

187-
ifeq ($$(CFG_DISABLE_JEMALLOC),)
188-
RUSTFLAGS_alloc := --cfg jemalloc
189187
ifeq ($(1),$$(CFG_BUILD))
190188
ifneq ($$(CFG_JEMALLOC_ROOT),)
191189
$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a
@@ -199,10 +197,6 @@ else
199197
$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
200198
$$(Q)cp $$< $$@
201199
endif
202-
else
203-
$$(JEMALLOC_LIB_$(1)): $$(MKFILE_DEPS)
204-
$$(Q)touch $$@
205-
endif
206200

207201
################################################################################
208202
# compiler-rt

branches/try/mk/tests.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ $(eval $(call RUST_CRATE,coretest))
2222
DEPS_collectionstest :=
2323
$(eval $(call RUST_CRATE,collectionstest))
2424

25-
TEST_TARGET_CRATES = $(filter-out core rustc_unicode,$(TARGET_CRATES)) \
25+
TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system \
26+
alloc_jemalloc,$(TARGET_CRATES)) \
2627
collectionstest coretest
2728
TEST_DOC_CRATES = $(DOC_CRATES)
2829
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
@@ -268,9 +269,10 @@ tidy-basic:
268269
.PHONY: tidy-binaries
269270
tidy-binaries:
270271
@$(call E, check: binaries)
271-
$(Q)find $(S)src -type f -perm +a+x \
272+
$(Q)find $(S)src -type f \
273+
\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
272274
-not -name '*.rs' -and -not -name '*.py' \
273-
-and -not -name '*.sh' \
275+
-and -not -name '*.sh' -and -not -name '*.pp' \
274276
| grep '^$(S)src/jemalloc' -v \
275277
| grep '^$(S)src/libuv' -v \
276278
| grep '^$(S)src/llvm' -v \

branches/try/src/doc/trpl/the-stack-and-the-heap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ reuse.
549549
If you’d like to dive into this topic in greater detail, [this paper][wilson]
550550
is a great introduction.
551551

552-
[wilson]: http://www.cs.northwestern.edu/~pdinda/icsclass/doc/dsa.pdf
552+
[wilson]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.143.4688
553553

554554
## Semantic impact
555555

branches/try/src/etc/dec2flt_table.py

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#!/usr/bin/env python2.7
2+
#
3+
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
4+
# file at the top-level directory of this distribution and at
5+
# http://rust-lang.org/COPYRIGHT.
6+
#
7+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
# option. This file may not be copied, modified, or distributed
11+
# except according to those terms.
12+
13+
"""
14+
Generate powers of ten using William Clinger's ``AlgorithmM`` for use in
15+
decimal to floating point conversions.
16+
17+
Specifically, computes and outputs (as Rust code) a table of 10^e for some
18+
range of exponents e. The output is one array of 64 bit significands and
19+
another array of corresponding base two exponents. The approximations are
20+
normalized and rounded perfectly, i.e., within 0.5 ULP of the true value.
21+
22+
The representation ([u64], [i16]) instead of the more natural [(u64, i16)]
23+
is used because (u64, i16) has a ton of padding which would make the table
24+
even larger, and it's already uncomfortably large (6 KiB).
25+
"""
26+
from __future__ import print_function
27+
import sys
28+
from fractions import Fraction
29+
from collections import namedtuple
30+
31+
32+
N = 64 # Size of the significand field in bits
33+
MIN_SIG = 2 ** (N - 1)
34+
MAX_SIG = (2 ** N) - 1
35+
36+
37+
# Hand-rolled fp representation without arithmetic or any other operations.
38+
# The significand is normalized and always N bit, but the exponent is
39+
# unrestricted in range.
40+
Fp = namedtuple('Fp', 'sig exp')
41+
42+
43+
def algorithm_m(f, e):
44+
assert f > 0
45+
if e < 0:
46+
u = f
47+
v = 10 ** abs(e)
48+
else:
49+
u = f * 10 ** e
50+
v = 1
51+
k = 0
52+
x = u // v
53+
while True:
54+
if x < MIN_SIG:
55+
u <<= 1
56+
k -= 1
57+
elif x >= MAX_SIG:
58+
v <<= 1
59+
k += 1
60+
else:
61+
break
62+
x = u // v
63+
return ratio_to_float(u, v, k)
64+
65+
66+
def ratio_to_float(u, v, k):
67+
q, r = divmod(u, v)
68+
v_r = v - r
69+
z = Fp(q, k)
70+
if r < v_r:
71+
return z
72+
elif r > v_r:
73+
return next_float(z)
74+
elif q % 2 == 0:
75+
return z
76+
else:
77+
return next_float(z)
78+
79+
80+
def next_float(z):
81+
if z.sig == MAX_SIG:
82+
return Fp(MIN_SIG, z.exp + 1)
83+
else:
84+
return Fp(z.sig + 1, z.exp)
85+
86+
87+
def error(f, e, z):
88+
decimal = f * Fraction(10) ** e
89+
binary = z.sig * Fraction(2) ** z.exp
90+
abs_err = abs(decimal - binary)
91+
# The unit in the last place has value z.exp
92+
ulp_err = abs_err / Fraction(2) ** z.exp
93+
return float(ulp_err)
94+
95+
LICENSE = """
96+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
97+
// file at the top-level directory of this distribution and at
98+
// http://rust-lang.org/COPYRIGHT.
99+
//
100+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
101+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
102+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
103+
// option. This file may not be copied, modified, or distributed
104+
// except according to those terms.
105+
"""
106+
107+
def main():
108+
MIN_E = -305
109+
MAX_E = 305
110+
e_range = range(MIN_E, MAX_E+1)
111+
powers = []
112+
for e in e_range:
113+
z = algorithm_m(1, e)
114+
err = error(1, e, z)
115+
assert err < 0.5
116+
powers.append(z)
117+
typ = "([u64; {0}], [i16; {0}])".format(len(e_range))
118+
print(LICENSE.strip())
119+
print("// Table of approximations of powers of ten.")
120+
print("// DO NOT MODIFY: Generated by a src/etc/dec2flt_table.py")
121+
print("pub const MIN_E: i16 = {};".format(MIN_E))
122+
print("pub const MAX_E: i16 = {};".format(MAX_E))
123+
print()
124+
print("pub const POWERS: ", typ, " = ([", sep='')
125+
for z in powers:
126+
print(" 0x{:x},".format(z.sig))
127+
print("], [")
128+
for z in powers:
129+
print(" {},".format(z.exp))
130+
print("]);")
131+
132+
133+
if __name__ == '__main__':
134+
main()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::io;
12+
use std::io::prelude::*;
13+
use std::mem::transmute;
14+
15+
// Nothing up my sleeve: Just (PI - 3) in base 16.
16+
#[allow(dead_code)]
17+
pub const SEED: [u32; 3] = [0x243f_6a88, 0x85a3_08d3, 0x1319_8a2e];
18+
19+
pub fn validate(text: String) {
20+
let mut out = io::stdout();
21+
let x: f64 = text.parse().unwrap();
22+
let f64_bytes: u64 = unsafe { transmute(x) };
23+
let x: f32 = text.parse().unwrap();
24+
let f32_bytes: u32 = unsafe { transmute(x) };
25+
writeln!(&mut out, "{:016x} {:08x} {}", f64_bytes, f32_bytes, text).unwrap();
26+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,16 +8,20 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:whatever
11+
mod _common;
1212

13-
#![feature(rustc_private, exit_status)]
14-
15-
#[macro_use] extern crate log;
16-
use std::env;
13+
use _common::validate;
1714

1815
fn main() {
19-
error!("whatever");
20-
// 101 is the code the runtime uses on thread panic and the value
21-
// compiletest expects run-fail tests to return.
22-
env::set_exit_status(101);
16+
let mut pow = vec![];
17+
for i in 0..63 {
18+
pow.push(1u64 << i);
19+
}
20+
for a in &pow {
21+
for b in &pow {
22+
for c in &pow {
23+
validate((a | b | c).to_string());
24+
}
25+
}
26+
}
2327
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
mod _common;
12+
13+
use _common::validate;
14+
15+
fn main() {
16+
for e in 300..310 {
17+
for i in 0..100000 {
18+
validate(format!("{}e{}", i, e));
19+
}
20+
}
21+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(rand)]
12+
13+
extern crate rand;
14+
15+
mod _common;
16+
17+
use std::char;
18+
use rand::{IsaacRng, Rng, SeedableRng};
19+
use rand::distributions::{Range, Sample};
20+
use _common::{validate, SEED};
21+
22+
fn main() {
23+
let mut rnd = IsaacRng::from_seed(&SEED);
24+
let mut range = Range::new(0, 10);
25+
for _ in 0..5_000_000u64 {
26+
let num_digits = rnd.gen_range(100, 300);
27+
let digits = gen_digits(num_digits, &mut range, &mut rnd);
28+
validate(digits);
29+
}
30+
}
31+
32+
fn gen_digits<R: Rng>(n: u32, range: &mut Range<u32>, rnd: &mut R) -> String {
33+
let mut s = String::new();
34+
for _ in 0..n {
35+
let digit = char::from_digit(range.sample(rnd), 10).unwrap();
36+
s.push(digit);
37+
}
38+
s
39+
}

0 commit comments

Comments
 (0)