Skip to content

Commit e5787ed

Browse files
committed
---
yaml --- r: 219116 b: refs/heads/snap-stage3 c: 96c7a6b h: refs/heads/master v: v3
1 parent 225d3bb commit e5787ed

File tree

33 files changed

+826
-2353
lines changed

33 files changed

+826
-2353
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 172cd83490cc66065e72861aed53e3efec29b34f
3+
refs/heads/snap-stage3: 96c7a6b8fe283ad4f3e58bfc7b1c9ae6fa7cce00
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/mk/cfg/x86_64-pc-windows-msvc.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ CFG_STATIC_LIB_NAME_x86_64-pc-windows-msvc=$(1).lib
99
CFG_LIB_GLOB_x86_64-pc-windows-msvc=$(1)-*.dll
1010
CFG_LIB_DSYM_GLOB_x86_64-pc-windows-msvc=$(1)-*.dylib.dSYM
1111
CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-msvc :=
12-
CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc := -MD
13-
CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc := -MD
12+
CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc :=
13+
CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc :=
1414
CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-msvc :=
1515
CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-msvc :=
1616
CFG_LLC_FLAGS_x86_64-pc-windows-msvc :=

branches/snap-stage3/mk/docs.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ DOC_TARGETS += doc/not_found.html
169169
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
170170
@$(call E, rustdoc: $@)
171171
$(Q)$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) \
172-
--markdown-no-toc \
173172
--markdown-css http://doc.rust-lang.org/rust.css $<
174173

175174
define DEF_DOC

branches/snap-stage3/src/doc/not_found.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ Looks like you've taken a wrong turn.
1111

1212
Some things that might be helpful to you though:
1313

14-
# Search
14+
## Search
1515

1616
* <form action="https://duckduckgo.com/">
1717
<input type="text" id="site-search" name="q" size="80"></input>
1818
<input type="submit" value="Search DuckDuckGo">
1919
</form>
2020
* Rust doc search: <span id="core-search"></span>
2121

22-
# Reference
22+
## Reference
2323

2424
* [The Rust official site](http://rust-lang.org)
2525
* [The Rust reference](http://doc.rust-lang.org/reference.html)
2626

27-
# Docs
27+
## Docs
2828

2929
* [The standard library](http://doc.rust-lang.org/std/)
3030

branches/snap-stage3/src/doc/reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,7 @@ Traits can include default implementations of methods, as in:
13671367
```
13681368
trait Foo {
13691369
fn bar(&self);
1370+
13701371
fn baz(&self) { println!("We called baz."); }
13711372
}
13721373
```

branches/snap-stage3/src/doc/trpl/const-and-static.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ unsafe {
6464

6565
[unsafe]: unsafe.html
6666

67-
Furthermore, any type stored in a `static` must be `Sync`, and may not have
68-
a [`Drop`][drop] implementation.
69-
70-
[drop]: drop.html
67+
Furthermore, any type stored in a `static` must be `Sync`.
7168

7269
# Initializing
7370

@@ -81,3 +78,7 @@ Almost always, if you can choose between the two, choose `const`. It’s pretty
8178
rare that you actually want a memory location associated with your constant,
8279
and using a const allows for optimizations like constant propagation not only
8380
in your crate but downstream crates.
81+
82+
A const can be thought of as a `#define` in C: it has metadata overhead but it
83+
has no runtime overhead. “Should I use a #define or a static in C,” is largely
84+
the same question as whether you should use a const or a static in Rust.

branches/snap-stage3/src/doc/trpl/dining-philosophers.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -674,13 +674,9 @@ let handles: Vec<_> = philosophers.into_iter().map(|p| {
674674

675675
Finally, inside of our `map()`/`collect()` loop, we call `table.clone()`. The
676676
`clone()` method on `Arc<T>` is what bumps up the reference count, and when it
677-
goes out of scope, it decrements the count. This is needed so that we know how
678-
many references to `table` exist across our threads. If we didn’t have a count,
679-
we wouldn’t know how to deallocate it.
680-
681-
You’ll notice we can introduce a new binding to `table` here, and it will
682-
shadow the old one. This is often used so that you don’t need to come up with
683-
two unique names.
677+
goes out of scope, it decrements the count. You’ll notice we can introduce a
678+
new binding to `table` here, and it will shadow the old one. This is often used
679+
so that you don’t need to come up with two unique names.
684680

685681
With this, our program works! Only two philosophers can eat at any one time,
686682
and so you’ll get some output like this:

branches/snap-stage3/src/doc/trpl/ffi.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,8 @@ Note that frameworks are only available on OSX targets.
342342
The different `kind` values are meant to differentiate how the native library
343343
participates in linkage. From a linkage perspective, the rust compiler creates
344344
two flavors of artifacts: partial (rlib/staticlib) and final (dylib/binary).
345-
Native dynamic library and framework dependencies are propagated to the final
346-
artifact boundary, while static library dependencies are not propagated at
347-
all, because the static libraries are integrated directly into the subsequent
348-
artifact.
345+
Native dynamic libraries and frameworks are propagated to the final artifact
346+
boundary, while static libraries are not propagated at all.
349347
350348
A few examples of how this model can be used are:
351349

branches/snap-stage3/src/doc/trpl/method-syntax.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ impl Circle {
8686
# Chaining method calls
8787

8888
So, now we know how to call a method, such as `foo.bar()`. But what about our
89-
original example, `foo.bar().baz()`? This is called ‘method chaining’. Let’s
90-
look at an example:
89+
original example, `foo.bar().baz()`? This is called ‘method chaining’, and we
90+
can do it by returning `self`.
9191

9292
```rust
9393
struct Circle {

branches/snap-stage3/src/doc/trpl/patterns.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -154,31 +154,6 @@ match x {
154154

155155
This prints `Got an int!`.
156156

157-
If you’re using `if` with multiple patterns, the `if` applies to both sides:
158-
159-
```rust
160-
let x = 4;
161-
let y = false;
162-
163-
match x {
164-
4 | 5 if y => println!("yes"),
165-
_ => println!("no"),
166-
}
167-
```
168-
169-
This prints `no`, because the `if` applies to the whole of `4 | 5`, and not to
170-
just the `5`, In other words, the the precedence of `if` behaves like this:
171-
172-
```text
173-
(4 | 5) if y => ...
174-
```
175-
176-
not this:
177-
178-
```text
179-
4 | (5 if y) => ...
180-
```
181-
182157
# ref and ref mut
183158

184159
If you want to get a [reference][ref], use the `ref` keyword:

branches/snap-stage3/src/doc/trpl/references-and-borrowing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ As it turns out, there are rules.
151151

152152
Here’s the rules about borrowing in Rust:
153153

154-
First, any borrow must last for a scope no greater than that of the owner.
155-
Second, you may have one or the other of these two kinds of borrows, but not
156-
both at the same time:
154+
First, any borrow must last for a smaller scope than the owner. Second, you may
155+
have one or the other of these two kinds of borrows, but not both at the same
156+
time:
157157

158158
* one or more references (`&T`) to a resource.
159159
* exactly one mutable reference (`&mut T`)

branches/snap-stage3/src/etc/unicode.py

Lines changed: 25 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ def is_surrogate(n):
7272
def load_unicode_data(f):
7373
fetch(f)
7474
gencats = {}
75-
to_lower = {}
76-
to_upper = {}
77-
to_title = {}
75+
upperlower = {}
76+
lowerupper = {}
7877
combines = {}
7978
canon_decomp = {}
8079
compat_decomp = {}
@@ -104,16 +103,12 @@ def load_unicode_data(f):
104103

105104
# generate char to char direct common and simple conversions
106105
# uppercase to lowercase
107-
if lowcase != "" and code_org != lowcase:
108-
to_lower[code] = (int(lowcase, 16), 0, 0)
106+
if gencat == "Lu" and lowcase != "" and code_org != lowcase:
107+
upperlower[code] = int(lowcase, 16)
109108

110109
# lowercase to uppercase
111-
if upcase != "" and code_org != upcase:
112-
to_upper[code] = (int(upcase, 16), 0, 0)
113-
114-
# title case
115-
if titlecase.strip() != "" and code_org != titlecase:
116-
to_title[code] = (int(titlecase, 16), 0, 0)
110+
if gencat == "Ll" and upcase != "" and code_org != upcase:
111+
lowerupper[code] = int(upcase, 16)
117112

118113
# store decomposition, if given
119114
if decomp != "":
@@ -149,32 +144,7 @@ def load_unicode_data(f):
149144
gencats = group_cats(gencats)
150145
combines = to_combines(group_cats(combines))
151146

152-
return (canon_decomp, compat_decomp, gencats, combines, to_upper, to_lower, to_title)
153-
154-
def load_special_casing(f, to_upper, to_lower, to_title):
155-
fetch(f)
156-
for line in fileinput.input(f):
157-
data = line.split('#')[0].split(';')
158-
if len(data) == 5:
159-
code, lower, title, upper, _comment = data
160-
elif len(data) == 6:
161-
code, lower, title, upper, condition, _comment = data
162-
if condition.strip(): # Only keep unconditional mappins
163-
continue
164-
else:
165-
continue
166-
code = code.strip()
167-
lower = lower.strip()
168-
title = title.strip()
169-
upper = upper.strip()
170-
key = int(code, 16)
171-
for (map_, values) in [(to_lower, lower), (to_upper, upper), (to_title, title)]:
172-
if values != code:
173-
values = [int(i, 16) for i in values.split()]
174-
for _ in range(len(values), 3):
175-
values.append(0)
176-
assert len(values) == 3
177-
map_[key] = values
147+
return (canon_decomp, compat_decomp, gencats, combines, lowerupper, upperlower)
178148

179149
def group_cats(cats):
180150
cats_out = {}
@@ -309,7 +279,7 @@ def load_east_asian_width(want_widths, except_cats):
309279
return widths
310280

311281
def escape_char(c):
312-
return "'\\u{%x}'" % c if c != 0 else "'\\0'"
282+
return "'\\u{%x}'" % c
313283

314284
def emit_bsearch_range_table(f):
315285
f.write("""
@@ -349,7 +319,7 @@ def emit_property_module(f, mod, tbl, emit):
349319
f.write(" }\n\n")
350320
f.write("}\n\n")
351321

352-
def emit_conversions_module(f, to_upper, to_lower, to_title):
322+
def emit_conversions_module(f, lowerupper, upperlower):
353323
f.write("pub mod conversions {")
354324
f.write("""
355325
use core::cmp::Ordering::{Equal, Less, Greater};
@@ -358,28 +328,21 @@ def emit_conversions_module(f, to_upper, to_lower, to_title):
358328
use core::option::Option::{Some, None};
359329
use core::result::Result::{Ok, Err};
360330
361-
pub fn to_lower(c: char) -> [char; 3] {
362-
match bsearch_case_table(c, to_lowercase_table) {
363-
None => [c, '\\0', '\\0'],
364-
Some(index) => to_lowercase_table[index].1
365-
}
366-
}
367-
368-
pub fn to_upper(c: char) -> [char; 3] {
369-
match bsearch_case_table(c, to_uppercase_table) {
370-
None => [c, '\\0', '\\0'],
371-
Some(index) => to_uppercase_table[index].1
331+
pub fn to_lower(c: char) -> char {
332+
match bsearch_case_table(c, LuLl_table) {
333+
None => c,
334+
Some(index) => LuLl_table[index].1
372335
}
373336
}
374337
375-
pub fn to_title(c: char) -> [char; 3] {
376-
match bsearch_case_table(c, to_titlecase_table) {
377-
None => [c, '\\0', '\\0'],
378-
Some(index) => to_titlecase_table[index].1
338+
pub fn to_upper(c: char) -> char {
339+
match bsearch_case_table(c, LlLu_table) {
340+
None => c,
341+
Some(index) => LlLu_table[index].1
379342
}
380343
}
381344
382-
fn bsearch_case_table(c: char, table: &'static [(char, [char; 3])]) -> Option<usize> {
345+
fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<usize> {
383346
match table.binary_search_by(|&(key, _)| {
384347
if c == key { Equal }
385348
else if key < c { Less }
@@ -391,18 +354,10 @@ def emit_conversions_module(f, to_upper, to_lower, to_title):
391354
}
392355
393356
""")
394-
t_type = "&'static [(char, [char; 3])]"
395-
pfun = lambda x: "(%s,[%s,%s,%s])" % (
396-
escape_char(x[0]), escape_char(x[1][0]), escape_char(x[1][1]), escape_char(x[1][2]))
397-
emit_table(f, "to_lowercase_table",
398-
sorted(to_lower.iteritems(), key=operator.itemgetter(0)),
399-
is_pub=False, t_type = t_type, pfun=pfun)
400-
emit_table(f, "to_uppercase_table",
401-
sorted(to_upper.iteritems(), key=operator.itemgetter(0)),
402-
is_pub=False, t_type = t_type, pfun=pfun)
403-
emit_table(f, "to_titlecase_table",
404-
sorted(to_title.iteritems(), key=operator.itemgetter(0)),
405-
is_pub=False, t_type = t_type, pfun=pfun)
357+
emit_table(f, "LuLl_table",
358+
sorted(upperlower.iteritems(), key=operator.itemgetter(0)), is_pub=False)
359+
emit_table(f, "LlLu_table",
360+
sorted(lowerupper.iteritems(), key=operator.itemgetter(0)), is_pub=False)
406361
f.write("}\n\n")
407362

408363
def emit_grapheme_module(f, grapheme_table, grapheme_cats):
@@ -636,10 +591,8 @@ def optimize_width_table(wtable):
636591
pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
637592
""" % unicode_version)
638593
(canon_decomp, compat_decomp, gencats, combines,
639-
to_upper, to_lower, to_title) = load_unicode_data("UnicodeData.txt")
640-
load_special_casing("SpecialCasing.txt", to_upper, to_lower, to_title)
641-
want_derived = ["XID_Start", "XID_Continue", "Alphabetic", "Lowercase", "Uppercase",
642-
"Cased", "Case_Ignorable"]
594+
lowerupper, upperlower) = load_unicode_data("UnicodeData.txt")
595+
want_derived = ["XID_Start", "XID_Continue", "Alphabetic", "Lowercase", "Uppercase"]
643596
derived = load_properties("DerivedCoreProperties.txt", want_derived)
644597
scripts = load_properties("Scripts.txt", [])
645598
props = load_properties("PropList.txt",
@@ -658,7 +611,7 @@ def optimize_width_table(wtable):
658611

659612
# normalizations and conversions module
660613
emit_norm_module(rf, canon_decomp, compat_decomp, combines, norm_props)
661-
emit_conversions_module(rf, to_upper, to_lower, to_title)
614+
emit_conversions_module(rf, lowerupper, upperlower)
662615

663616
### character width module
664617
width_table = []

0 commit comments

Comments
 (0)