Skip to content

Commit 1564904

Browse files
committed
---
yaml --- r: 232499 b: refs/heads/try c: 1ddee80 h: refs/heads/master i: 232497: b399909 232495: 3633441 v: v3
1 parent 8e3feac commit 1564904

File tree

499 files changed

+19985
-13287
lines changed

Some content is hidden

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

499 files changed

+19985
-13287
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: de67d62c6b7e76ca53b66b3796258238348b3c96
4+
refs/heads/try: 1ddee8070d3cb83609b1f71c29e3deda3d30fd51
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: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,37 @@
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 \
56-
alloc_system
55+
rustc_unicode rustc_bitflags
5756
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
5857
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
59-
rustc_data_structures rustc_platform_intrinsics
58+
rustc_data_structures
6059
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 alloc_system
66+
DEPS_alloc := core libc native:jemalloc
6767
DEPS_std := core libc rand alloc collections rustc_unicode \
6868
native:rust_builtin native:backtrace \
69-
alloc_system
69+
rustc_bitflags
7070
DEPS_graphviz := std
71-
DEPS_syntax := std term serialize log fmt_macros arena libc rustc_bitflags
71+
DEPS_syntax := std term serialize log fmt_macros arena libc
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
7575

7676
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
77-
log syntax serialize rustc_llvm rustc_platform_intrinsics
78-
DEPS_rustc_typeck := rustc syntax rustc_platform_intrinsics
77+
log syntax serialize rustc_llvm
78+
DEPS_rustc_typeck := rustc syntax
7979
DEPS_rustc_borrowck := rustc log graphviz syntax
8080
DEPS_rustc_resolve := rustc log syntax
8181
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 rustc_bitflags
86-
DEPS_rustc_platform_intrinsics := rustc rustc_llvm
85+
DEPS_rustc_llvm := native:rustllvm libc std
8786
DEPS_rustc_back := std syntax rustc_llvm flate log libc
8887
DEPS_rustc_data_structures := std log serialize
8988
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
@@ -103,7 +102,6 @@ DEPS_test := std getopts serialize rbml term native:rust_test_helpers
103102
DEPS_rand := core
104103
DEPS_log := std
105104
DEPS_fmt_macros = std
106-
DEPS_alloc_system := core libc
107105

108106
TOOL_DEPS_compiletest := test getopts
109107
TOOL_DEPS_rustdoc := rustdoc
@@ -123,26 +121,14 @@ ONLY_RLIB_rand := 1
123121
ONLY_RLIB_collections := 1
124122
ONLY_RLIB_rustc_unicode := 1
125123
ONLY_RLIB_rustc_bitflags := 1
126-
ONLY_RLIB_alloc_system := 1
127124

128125
# Documented-by-default crates
129126
DOC_CRATES := std alloc collections core libc rustc_unicode
130127

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

144-
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
145-
146132
# This macro creates some simple definitions for each crate being built, just
147133
# some munging of all of the parameters above.
148134
#

branches/try/mk/rt.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ $$(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
187189
ifeq ($(1),$$(CFG_BUILD))
188190
ifneq ($$(CFG_JEMALLOC_ROOT),)
189191
$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a
@@ -197,6 +199,10 @@ else
197199
$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
198200
$$(Q)cp $$< $$@
199201
endif
202+
else
203+
$$(JEMALLOC_LIB_$(1)): $$(MKFILE_DEPS)
204+
$$(Q)touch $$@
205+
endif
200206

201207
################################################################################
202208
# compiler-rt

branches/try/mk/tests.mk

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

25-
TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system \
26-
alloc_jemalloc,$(TARGET_CRATES)) \
25+
TEST_TARGET_CRATES = $(filter-out core rustc_unicode,$(TARGET_CRATES)) \
2726
collectionstest coretest
2827
TEST_DOC_CRATES = $(DOC_CRATES)
2928
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \

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

554554
## Semantic impact
555555

branches/try/src/etc/unicode.py

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,46 @@ def emit_conversions_module(f, to_upper, to_lower, to_title):
395395
is_pub=False, t_type = t_type, pfun=pfun)
396396
f.write("}\n\n")
397397

398+
def emit_grapheme_module(f, grapheme_table, grapheme_cats):
399+
f.write("""pub mod grapheme {
400+
use core::slice::SliceExt;
401+
pub use self::GraphemeCat::*;
402+
use core::result::Result::{Ok, Err};
403+
404+
#[allow(non_camel_case_types)]
405+
#[derive(Clone, Copy)]
406+
pub enum GraphemeCat {
407+
""")
408+
for cat in grapheme_cats + ["Any"]:
409+
f.write(" GC_" + cat + ",\n")
410+
f.write(""" }
411+
412+
fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
413+
use core::cmp::Ordering::{Equal, Less, Greater};
414+
match r.binary_search_by(|&(lo, hi, _)| {
415+
if lo <= c && c <= hi { Equal }
416+
else if hi < c { Less }
417+
else { Greater }
418+
}) {
419+
Ok(idx) => {
420+
let (_, _, cat) = r[idx];
421+
cat
422+
}
423+
Err(_) => GC_Any
424+
}
425+
}
426+
427+
pub fn grapheme_category(c: char) -> GraphemeCat {
428+
bsearch_range_value_table(c, grapheme_cat_table)
429+
}
430+
431+
""")
432+
433+
emit_table(f, "grapheme_cat_table", grapheme_table, "&'static [(char, char, GraphemeCat)]",
434+
pfun=lambda x: "(%s,%s,GC_%s)" % (escape_char(x[0]), escape_char(x[1]), x[2]),
435+
is_pub=False)
436+
f.write("}\n")
437+
398438
def emit_charwidth_module(f, width_table):
399439
f.write("pub mod charwidth {\n")
400440
f.write(" use core::option::Option;\n")
@@ -457,6 +497,79 @@ def emit_norm_module(f, canon, compat, combine, norm_props):
457497
canon_comp_keys = canon_comp.keys()
458498
canon_comp_keys.sort()
459499

500+
f.write("pub mod normalization {\n")
501+
502+
def mkdata_fun(table):
503+
def f(char):
504+
data = "(%s,&[" % escape_char(char)
505+
first = True
506+
for d in table[char]:
507+
if not first:
508+
data += ","
509+
first = False
510+
data += escape_char(d)
511+
data += "])"
512+
return data
513+
return f
514+
515+
f.write(" // Canonical decompositions\n")
516+
emit_table(f, "canonical_table", canon_keys, "&'static [(char, &'static [char])]",
517+
pfun=mkdata_fun(canon))
518+
519+
f.write(" // Compatibility decompositions\n")
520+
emit_table(f, "compatibility_table", compat_keys, "&'static [(char, &'static [char])]",
521+
pfun=mkdata_fun(compat))
522+
523+
def comp_pfun(char):
524+
data = "(%s,&[" % escape_char(char)
525+
canon_comp[char].sort(lambda x, y: x[0] - y[0])
526+
first = True
527+
for pair in canon_comp[char]:
528+
if not first:
529+
data += ","
530+
first = False
531+
data += "(%s,%s)" % (escape_char(pair[0]), escape_char(pair[1]))
532+
data += "])"
533+
return data
534+
535+
f.write(" // Canonical compositions\n")
536+
emit_table(f, "composition_table", canon_comp_keys,
537+
"&'static [(char, &'static [(char, char)])]", pfun=comp_pfun)
538+
539+
f.write("""
540+
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
541+
use core::cmp::Ordering::{Equal, Less, Greater};
542+
use core::slice::SliceExt;
543+
use core::result::Result::{Ok, Err};
544+
match r.binary_search_by(|&(lo, hi, _)| {
545+
if lo <= c && c <= hi { Equal }
546+
else if hi < c { Less }
547+
else { Greater }
548+
}) {
549+
Ok(idx) => {
550+
let (_, _, result) = r[idx];
551+
result
552+
}
553+
Err(_) => 0
554+
}
555+
}\n
556+
""")
557+
558+
emit_table(f, "combining_class_table", combine, "&'static [(char, char, u8)]", is_pub=False,
559+
pfun=lambda x: "(%s,%s,%s)" % (escape_char(x[0]), escape_char(x[1]), x[2]))
560+
561+
f.write(""" #[deprecated(reason = "use the crates.io `unicode-normalization` lib instead",
562+
since = "1.0.0")]
563+
#[unstable(feature = "unicode",
564+
reason = "this functionality will be moved to crates.io")]
565+
pub fn canonical_combining_class(c: char) -> u8 {
566+
bsearch_range_value_table(c, combining_class_table)
567+
}
568+
569+
}
570+
571+
""")
572+
460573
def remove_from_wtable(wtable, val):
461574
wtable_out = []
462575
while wtable:
@@ -536,3 +649,53 @@ def optimize_width_table(wtable):
536649
# normalizations and conversions module
537650
emit_norm_module(rf, canon_decomp, compat_decomp, combines, norm_props)
538651
emit_conversions_module(rf, to_upper, to_lower, to_title)
652+
653+
### character width module
654+
width_table = []
655+
for zwcat in ["Me", "Mn", "Cf"]:
656+
width_table.extend(map(lambda (lo, hi): (lo, hi, 0, 0), gencats[zwcat]))
657+
width_table.append((4448, 4607, 0, 0))
658+
659+
# get widths, except those that are explicitly marked zero-width above
660+
ea_widths = load_east_asian_width(["W", "F", "A"], ["Me", "Mn", "Cf"])
661+
# these are doublewidth
662+
for dwcat in ["W", "F"]:
663+
width_table.extend(map(lambda (lo, hi): (lo, hi, 2, 2), ea_widths[dwcat]))
664+
width_table.extend(map(lambda (lo, hi): (lo, hi, 1, 2), ea_widths["A"]))
665+
666+
width_table.sort(key=lambda w: w[0])
667+
668+
# soft hyphen is not zero width in preformatted text; it's used to indicate
669+
# a hyphen inserted to facilitate a linebreak.
670+
width_table = remove_from_wtable(width_table, 173)
671+
672+
# optimize the width table by collapsing adjacent entities when possible
673+
width_table = optimize_width_table(width_table)
674+
emit_charwidth_module(rf, width_table)
675+
676+
### grapheme cluster module
677+
# from http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Break_Property_Values
678+
grapheme_cats = load_properties("auxiliary/GraphemeBreakProperty.txt", [])
679+
680+
# Control
681+
# Note 1:
682+
# This category also includes Cs (surrogate codepoints), but Rust's `char`s are
683+
# Unicode Scalar Values only, and surrogates are thus invalid `char`s.
684+
# Thus, we have to remove Cs from the Control category
685+
# Note 2:
686+
# 0x0a and 0x0d (CR and LF) are not in the Control category for Graphemes.
687+
# However, the Graphemes iterator treats these as a special case, so they
688+
# should be included in grapheme_cats["Control"] for our implementation.
689+
grapheme_cats["Control"] = group_cat(list(
690+
(set(ungroup_cat(grapheme_cats["Control"]))
691+
| set(ungroup_cat(grapheme_cats["CR"]))
692+
| set(ungroup_cat(grapheme_cats["LF"])))
693+
- set(ungroup_cat([surrogate_codepoints]))))
694+
del(grapheme_cats["CR"])
695+
del(grapheme_cats["LF"])
696+
697+
grapheme_table = []
698+
for cat in grapheme_cats:
699+
grapheme_table.extend([(x, y, cat) for (x, y) in grapheme_cats[cat]])
700+
grapheme_table.sort(key=lambda w: w[0])
701+
emit_grapheme_module(rf, grapheme_table, grapheme_cats.keys())

0 commit comments

Comments
 (0)