Skip to content

Commit 15b135c

Browse files
committed
---
yaml --- r: 227287 b: refs/heads/auto c: 82b8964 h: refs/heads/master i: 227285: ca14308 227283: 0d59a8b 227279: 4ffb4e6 v: v3
1 parent 31affcb commit 15b135c

File tree

46 files changed

+4254
-135
lines changed

Some content is hidden

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

46 files changed

+4254
-135
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 8d90d3f36871a00023cc1f313f91e351c287ca15
11+
refs/heads/auto: 82b89645fb6ec31138d5788b588ddd7e44c434fa
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/mk/docs.mk

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
#
1414
# The DOCS variable is their names (with no file extension).
1515
#
16-
# PDF_DOCS lists the targets for which PDF documentation should be
17-
# build.
18-
#
1916
# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the
2017
# rustdoc invocation for xyz.
2118
#
@@ -35,8 +32,6 @@ DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
3532
guide-testing
3633

3734

38-
PDF_DOCS := reference
39-
4035
RUSTDOC_DEPS_reference := doc/full-toc.inc
4136
RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc
4237

@@ -52,13 +47,6 @@ RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \
5247

5348
RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css
5449

55-
PANDOC_BASE_OPTS := --standalone --toc --number-sections
56-
PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS) --from=markdown --to=latex \
57-
--include-before-body=doc/version.tex \
58-
--include-before-body=doc/footer.tex \
59-
--include-in-header=doc/uptack.tex
60-
PANDOC_EPUB_OPTS = $(PANDOC_BASE_OPTS) --to=epub
61-
6250
# The rustdoc executable...
6351
RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD))/rustdoc$(X_$(CFG_BUILD))
6452
# ...with rpath included in case --disable-rpath was provided to
@@ -89,30 +77,10 @@ else
8977
HTML_DEPS :=
9078
endif
9179

92-
# Check for xelatex
93-
94-
ifneq ($(CFG_XELATEX),)
95-
CFG_LATEX := $(CFG_XELATEX)
96-
XELATEX = 1
97-
else
98-
$(info cfg: no xelatex found, disabling LaTeX docs)
99-
NO_PDF_DOCS = 1
100-
endif
101-
102-
ifeq ($(CFG_PANDOC),)
103-
$(info cfg: no pandoc found, omitting PDF and EPUB docs)
104-
ONLY_HTML_DOCS = 1
105-
endif
106-
107-
10880
######################################################################
10981
# Rust version
11082
######################################################################
11183

112-
doc/version.tex: $(MKFILE_DEPS) $(wildcard $(D)/*.*) | doc/
113-
@$(call E, version-stamp: $@)
114-
$(Q)echo "$(CFG_VERSION)" >$@
115-
11684
HTML_DEPS += doc/version_info.html
11785
doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
11886
$(wildcard $(D)/*.*) | doc/
@@ -121,10 +89,10 @@ doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
12189
s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
12290
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
12391

124-
GENERATED += doc/version.tex doc/version_info.html
92+
GENERATED += doc/version_info.html
12593

12694
######################################################################
127-
# Docs, from rustdoc and sometimes pandoc
95+
# Docs from rustdoc
12896
######################################################################
12997

13098
doc/:
@@ -150,20 +118,6 @@ doc/footer.inc: $(D)/footer.inc | doc/
150118
$(Q)cp -PRp $< $@ 2> /dev/null
151119

152120
# The (english) documentation for each doc item.
153-
154-
define DEF_SHOULD_BUILD_PDF_DOC
155-
SHOULD_BUILD_PDF_DOC_$(1) = 1
156-
endef
157-
$(foreach docname,$(PDF_DOCS),$(eval $(call DEF_SHOULD_BUILD_PDF_DOC,$(docname))))
158-
159-
doc/footer.tex: $(D)/footer.inc | doc/
160-
@$(call E, pandoc: $@)
161-
$(CFG_PANDOC) --from=html --to=latex $< --output=$@
162-
163-
doc/uptack.tex: $(D)/uptack.tex | doc/
164-
$(Q)cp $< $@
165-
166-
# HTML (rustdoc)
167121
DOC_TARGETS += doc/not_found.html
168122
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
169123
@$(call E, rustdoc: $@)
@@ -179,47 +133,6 @@ doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
179133
@$$(call E, rustdoc: $$@)
180134
$$(Q)$$(RUSTDOC) $$(RUSTDOC_HTML_OPTS) $$(RUSTDOC_FLAGS_$(1)) $$<
181135

182-
ifneq ($(ONLY_HTML_DOCS),1)
183-
184-
# EPUB (pandoc directly)
185-
DOC_TARGETS += doc/$(1).epub
186-
doc/$(1).epub: $$(D)/$(1).md | doc/
187-
@$$(call E, pandoc: $$@)
188-
$$(CFG_PANDOC) $$(PANDOC_EPUB_OPTS) $$< --output=$$@
189-
190-
# PDF (md =(pandoc)=> tex =(pdflatex)=> pdf)
191-
DOC_TARGETS += doc/$(1).tex
192-
doc/$(1).tex: $$(D)/$(1).md doc/uptack.tex doc/footer.tex doc/version.tex | doc/
193-
@$$(call E, pandoc: $$@)
194-
$$(CFG_PANDOC) $$(PANDOC_TEX_OPTS) $$< --output=$$@
195-
196-
ifneq ($(NO_PDF_DOCS),1)
197-
ifeq ($$(SHOULD_BUILD_PDF_DOC_$(1)),1)
198-
DOC_TARGETS += doc/$(1).pdf
199-
ifneq ($(XELATEX),1)
200-
doc/$(1).pdf: doc/$(1).tex
201-
@$$(call E, latex compiler: $$@)
202-
$$(Q)$$(CFG_LATEX) \
203-
-interaction=batchmode \
204-
-output-directory=doc \
205-
$$<
206-
else
207-
# The version of xelatex on the snap bots seemingly ingores -output-directory
208-
# So we'll output to . and move to the doc directory manually.
209-
# This will leave some intermediate files in the build directory.
210-
doc/$(1).pdf: doc/$(1).tex
211-
@$$(call E, latex compiler: $$@)
212-
$$(Q)$$(CFG_LATEX) \
213-
-interaction=batchmode \
214-
-output-directory=. \
215-
$$<
216-
$$(Q)mv ./$(1).pdf $$@
217-
endif # XELATEX
218-
endif # SHOULD_BUILD_PDF_DOCS_$(1)
219-
endif # NO_PDF_DOCS
220-
221-
endif # ONLY_HTML_DOCS
222-
223136
endef
224137

225138
$(foreach docname,$(DOCS),$(eval $(call DEF_DOC,$(docname))))

branches/auto/mk/tests.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,10 @@ tidy-basic:
268268
.PHONY: tidy-binaries
269269
tidy-binaries:
270270
@$(call E, check: binaries)
271-
$(Q)find $(S)src -type f -perm +a+x \
271+
$(Q)find $(S)src -type f \
272+
\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
272273
-not -name '*.rs' -and -not -name '*.py' \
273-
-and -not -name '*.sh' \
274+
-and -not -name '*.sh' -and -not -name '*.pp' \
274275
| grep '^$(S)src/jemalloc' -v \
275276
| grep '^$(S)src/libuv' -v \
276277
| grep '^$(S)src/llvm' -v \

branches/auto/src/doc/README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# Rust documentations
22

3-
## Dependencies
4-
5-
[Pandoc](http://johnmacfarlane.net/pandoc/installing.html), a universal
6-
document converter, is required to generate docs as HTML from Rust's
7-
source code.
8-
93
## Building
104

115
To generate all the docs, just run `make docs` from the root of the repository.
@@ -26,15 +20,12 @@ To generate an HTML version of a doc from Markdown manually, you can do
2620
something like:
2721

2822
~~~~
29-
pandoc --from=markdown --to=html5 --number-sections -o reference.html reference.md
23+
rustdoc reference.md
3024
~~~~
3125

3226
(`reference.md` being the Rust Reference Manual.)
3327

34-
The syntax for pandoc flavored markdown can be found at:
35-
36-
- http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown
37-
38-
A nice quick reference (for non-pandoc markdown) is at:
28+
An overview of how to use the `rustdoc` command is available [in the docs][1].
29+
Further details are available from the command line by with `rustdoc --help`.
3930

40-
- http://kramdown.gettalong.org/quickref.html
31+
[1]: https://github.com/rust-lang/rust/blob/master/src/doc/trpl/documentation.md
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+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
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+
}
27+
}

0 commit comments

Comments
 (0)