Skip to content

Commit 3ffda15

Browse files
committed
---
yaml --- r: 105327 b: refs/heads/master c: b4d3243 h: refs/heads/master i: 105325: 808ba14 105323: ae7d04d 105319: ac494f4 105311: 74d5015 v: v3
1 parent 6e0ccab commit 3ffda15

File tree

134 files changed

+43700
-2708
lines changed

Some content is hidden

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

134 files changed

+43700
-2708
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 78580651131c9daacd7e5e4669af819cdd719f09
2+
refs/heads/master: b4d324334cb48198c27d782002d75eba14a6abde
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b8601a3d8b91ad3b653d143307611f2f5c75617e
55
refs/heads/try: db814977d07bd798feb24f6b74c00800ef458a13

trunk/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ HOST_CRATES := syntax rustc rustdoc fourcc hexfloat
5555
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5656
TOOLS := compiletest rustdoc rustc
5757

58-
DEPS_std := native:rustrt native:compiler-rt
58+
DEPS_std := native:rustrt native:compiler-rt native:backtrace
5959
DEPS_extra := std term sync serialize getopts collections time rand
6060
DEPS_green := std rand native:context_switch
6161
DEPS_rustuv := std native:uv native:uv_support

trunk/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ CFG_PATH_MUNGE_arm-unknown-linux-gnueabihf := true
330330
CFG_LDPATH_arm-unknown-linux-gnueabihf :=
331331
CFG_RUN_arm-unknown-linux-gnueabihf=$(2)
332332
CFG_RUN_TARG_arm-unknown-linux-gnueabihf=$(call CFG_RUN_arm-unknown-linux-gnueabihf,,$(2))
333-
RUSTC_FLAGS_arm-unknown-linux-gnueabihf :=
333+
RUSTC_FLAGS_arm-unknown-linux-gnueabihf := -C target-feature=+v7,+vfp3
334334
RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabihf :=
335335

336336
# arm-unknown-linux-gnueabi configuration

trunk/mk/rt.mk

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,73 @@ $$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS)
249249
triple-runtime
250250
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/triple/runtime/libcompiler_rt.a $$(COMPRT_LIB_$(1))
251251

252+
################################################################################
253+
# libbacktrace
254+
#
255+
# We use libbacktrace on linux to get symbols in backtraces, but only on linux.
256+
# Elsewhere we use other system utilities, so this library is only built on
257+
# linux.
258+
################################################################################
259+
260+
BACKTRACE_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),backtrace)
261+
BACKTRACE_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(BACKTRACE_NAME_$(1))
262+
BACKTRACE_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/libbacktrace
263+
264+
ifeq ($$(findstring darwin,$$(OSTYPE_$(1))),darwin)
265+
266+
# We don't use this on platforms that aren't linux-based, so just make the file
267+
# available, the compilation of libstd won't actually build it.
268+
$$(BACKTRACE_LIB_$(1)):
269+
touch $$@
270+
271+
else
272+
ifeq ($$(CFG_WINDOWSY_$(1)),1)
273+
$$(BACKTRACE_LIB_$(1)):
274+
touch $$@
275+
else
276+
277+
ifdef CFG_ENABLE_FAST_MAKE
278+
BACKTRACE_DEPS := $(S)/.gitmodules
279+
else
280+
BACKTRACE_DEPS := $(wildcard $(S)src/libbacktrace/*)
281+
endif
282+
283+
# We need to export CFLAGS because otherwise it doesn't pick up cross compile
284+
# builds. If libbacktrace doesn't realize this, it will attempt to read 64-bit
285+
# elf headers when compiled for a 32-bit system, yielding blank backtraces.
286+
#
287+
# This also removes the -Werror flag specifically to prevent errors during
288+
# configuration.
289+
#
290+
# Down below you'll also see echos into the config.h generated by the
291+
# ./configure script. This is done to force libbacktrace to *not* use the
292+
# atomic/sync functionality because it pulls in unnecessary dependencies and we
293+
# never use it anyway.
294+
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: \
295+
export CFLAGS:=$$(CFG_GCCISH_CFLAGS_$(1):-Werror=) \
296+
-fno-stack-protector
297+
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: export CC:=$$(CC_$(1))
298+
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: export AR:=$$(AR_$(1))
299+
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: export RANLIB:=$$(AR_$(1)) s
300+
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: $$(BACKTRACE_DEPS) $$(MKFILE_DEPS)
301+
$$(Q)rm -rf $$(BACKTRACE_BUILD_DIR_$(1))
302+
$$(Q)mkdir -p $$(BACKTRACE_BUILD_DIR_$(1))
303+
$$(Q)(cd $$(BACKTRACE_BUILD_DIR_$(1)) && \
304+
$(S)src/libbacktrace/configure --target=$(1) --host=$(CFG_BUILD))
305+
$$(Q)echo '#undef HAVE_ATOMIC_FUNCTIONS' >> \
306+
$$(BACKTRACE_BUILD_DIR_$(1))/config.h
307+
$$(Q)echo '#undef HAVE_SYNC_FUNCTIONS' >> \
308+
$$(BACKTRACE_BUILD_DIR_$(1))/config.h
309+
310+
$$(BACKTRACE_LIB_$(1)): $$(BACKTRACE_BUILD_DIR_$(1))/Makefile $$(MKFILE_DEPS)
311+
@$$(call E, make: libbacktrace)
312+
$$(Q)$$(MAKE) -C $$(BACKTRACE_BUILD_DIR_$(1)) \
313+
INCDIR=$(S)src/libbacktrace
314+
$$(Q)cp $$(BACKTRACE_BUILD_DIR_$(1))/.libs/libbacktrace.a $$@
315+
316+
endif # endif for windowsy
317+
endif # endif for darwin
318+
252319
endef
253320

254321
# Instantiate template for all stages/targets

trunk/mk/tests.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ tidy:
240240
| grep '^$(S)src/libuv' -v \
241241
| grep '^$(S)src/llvm' -v \
242242
| grep '^$(S)src/gyp' -v \
243+
| grep '^$(S)src/libbacktrace' -v \
243244
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
244245
$(Q)find $(S)src/etc -name '*.py' \
245246
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
@@ -266,6 +267,7 @@ tidy:
266267
| grep '^$(S)src/etc' -v \
267268
| grep '^$(S)src/doc' -v \
268269
| grep '^$(S)src/compiler-rt' -v \
270+
| grep '^$(S)src/libbacktrace' -v \
269271
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
270272

271273
endif

trunk/src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn load_errors(testfile: &Path) -> ~[ExpectedError] {
1919
let mut rdr = BufferedReader::new(File::open(testfile).unwrap());
2020
let mut line_num = 1u;
2121
for ln in rdr.lines() {
22-
error_patterns.push_all_move(parse_expected(line_num, ln));
22+
error_patterns.push_all_move(parse_expected(line_num, ln.unwrap()));
2323
line_num += 1u;
2424
}
2525
return error_patterns;

trunk/src/compiletest/header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool {
140140
// Assume that any directives will be found before the first
141141
// module or function. This doesn't seem to be an optimization
142142
// with a warm page cache. Maybe with a cold one.
143+
let ln = ln.unwrap();
143144
if ln.starts_with("fn") || ln.starts_with("mod") {
144145
return true;
145146
} else { if !(it(ln.trim())) { return false; } }

trunk/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ let x = Rc::new([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
16871687
let y = x.clone(); // a new owner
16881688
let z = x; // this moves `x` into `z`, rather than creating a new owner
16891689

1690-
assert!(*z.borrow() == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
1690+
assert!(*z == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
16911691

16921692
// the variable is mutable, but not the contents of the box
16931693
let mut a = Rc::new([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);

trunk/src/etc/unicode.py

Lines changed: 79 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# programs". It is not meant to be a complete implementation of unicode.
2020
# For that we recommend you use a proper binding to libicu.
2121

22-
import fileinput, re, os, sys
22+
import fileinput, re, os, sys, operator
2323

2424

2525
def fetch(f):
@@ -35,6 +35,8 @@ def fetch(f):
3535
def load_unicode_data(f):
3636
fetch(f)
3737
gencats = {}
38+
upperlower = {}
39+
lowerupper = {}
3840
combines = []
3941
canon_decomp = {}
4042
compat_decomp = {}
@@ -44,6 +46,7 @@ def load_unicode_data(f):
4446
c_hi = 0
4547
com_lo = 0
4648
com_hi = 0
49+
4750
for line in fileinput.input(f):
4851
fields = line.split(";")
4952
if len(fields) != 15:
@@ -52,7 +55,17 @@ def load_unicode_data(f):
5255
decomp, deci, digit, num, mirror,
5356
old, iso, upcase, lowcase, titlecase ] = fields
5457

55-
code = int(code, 16)
58+
code_org = code
59+
code = int(code, 16)
60+
61+
# generate char to char direct common and simple conversions
62+
# uppercase to lowercase
63+
if gencat == "Lu" and lowcase != "" and code_org != lowcase:
64+
upperlower[code] = int(lowcase, 16)
65+
66+
# lowercase to uppercase
67+
if gencat == "Ll" and upcase != "" and code_org != upcase:
68+
lowerupper[code] = int(upcase, 16)
5669

5770
if decomp != "":
5871
if decomp.startswith('<'):
@@ -96,7 +109,7 @@ def load_unicode_data(f):
96109
com_lo = code
97110
com_hi = code
98111

99-
return (canon_decomp, compat_decomp, gencats, combines)
112+
return (canon_decomp, compat_decomp, gencats, combines, lowerupper, upperlower)
100113

101114
def load_properties(f, interestingprops):
102115
fetch(f)
@@ -147,25 +160,28 @@ def ch_prefix(ix):
147160

148161
def emit_bsearch_range_table(f):
149162
f.write("""
150-
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
151-
use cmp::{Equal, Less, Greater};
152-
use vec::ImmutableVector;
153-
use option::None;
154-
r.bsearch(|&(lo,hi)| {
155-
if lo <= c && c <= hi { Equal }
156-
else if hi < c { Less }
157-
else { Greater }
158-
}) != None
159-
}\n\n
163+
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
164+
use cmp::{Equal, Less, Greater};
165+
use vec::ImmutableVector;
166+
use option::None;
167+
r.bsearch(|&(lo,hi)| {
168+
if lo <= c && c <= hi { Equal }
169+
else if hi < c { Less }
170+
else { Greater }
171+
}) != None
172+
}\n\n
160173
""");
161174

162175
def emit_property_module(f, mod, tbl):
163176
f.write("pub mod %s {\n" % mod)
164177
keys = tbl.keys()
165178
keys.sort()
166-
emit_bsearch_range_table(f);
179+
167180
for cat in keys:
168-
if cat == "Cs": continue
181+
if cat not in ["Nd", "Nl", "No", "Cc",
182+
"XID_Start", "XID_Continue", "Alphabetic",
183+
"Lowercase", "Uppercase", "White_Space"]:
184+
continue
169185
f.write(" static %s_table : &'static [(char,char)] = &[\n" % cat)
170186
ix = 0
171187
for pair in tbl[cat]:
@@ -175,35 +191,55 @@ def emit_property_module(f, mod, tbl):
175191
f.write("\n ];\n\n")
176192

177193
f.write(" pub fn %s(c: char) -> bool {\n" % cat)
178-
f.write(" bsearch_range_table(c, %s_table)\n" % cat)
194+
f.write(" super::bsearch_range_table(c, %s_table)\n" % cat)
179195
f.write(" }\n\n")
180196
f.write("}\n")
181197

182198

183-
def emit_property_module_old(f, mod, tbl):
184-
f.write("mod %s {\n" % mod)
185-
keys = tbl.keys()
186-
keys.sort()
187-
for cat in keys:
188-
f.write(" fn %s(c: char) -> bool {\n" % cat)
189-
f.write(" ret alt c {\n")
190-
prefix = ' '
191-
for pair in tbl[cat]:
192-
if pair[0] == pair[1]:
193-
f.write(" %c %s\n" %
194-
(prefix, escape_char(pair[0])))
195-
else:
196-
f.write(" %c %s to %s\n" %
197-
(prefix,
198-
escape_char(pair[0]),
199-
escape_char(pair[1])))
200-
prefix = '|'
201-
f.write(" { true }\n")
202-
f.write(" _ { false }\n")
203-
f.write(" };\n")
204-
f.write(" }\n\n")
199+
def emit_conversions_module(f, lowerupper, upperlower):
200+
f.write("pub mod conversions {\n")
201+
f.write("""
202+
use cmp::{Equal, Less, Greater};
203+
use vec::ImmutableVector;
204+
use tuple::Tuple2;
205+
use option::{Option, Some, None};
206+
207+
pub fn to_lower(c: char) -> char {
208+
match bsearch_case_table(c, LuLl_table) {
209+
None => c,
210+
Some(index) => LuLl_table[index].val1()
211+
}
212+
}
213+
214+
pub fn to_upper(c: char) -> char {
215+
match bsearch_case_table(c, LlLu_table) {
216+
None => c,
217+
Some(index) => LlLu_table[index].val1()
218+
}
219+
}
220+
221+
fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> {
222+
table.bsearch(|&(key, _)| {
223+
if c == key { Equal }
224+
else if key < c { Less }
225+
else { Greater }
226+
})
227+
}
228+
""");
229+
emit_caseconversion_table(f, "LuLl", upperlower)
230+
emit_caseconversion_table(f, "LlLu", lowerupper)
205231
f.write("}\n")
206232

233+
def emit_caseconversion_table(f, name, table):
234+
f.write(" static %s_table : &'static [(char, char)] = &[\n" % name)
235+
sorted_table = sorted(table.iteritems(), key=operator.itemgetter(0))
236+
ix = 0
237+
for key, value in sorted_table:
238+
f.write(ch_prefix(ix))
239+
f.write("(%s, %s)" % (escape_char(key), escape_char(value)))
240+
ix += 1
241+
f.write("\n ];\n\n")
242+
207243
def format_table_content(f, content, indent):
208244
line = " "*indent
209245
first = True
@@ -359,7 +395,8 @@ def emit_decomp_module(f, canon, compat, combine):
359395
os.remove(i);
360396
rf = open(r, "w")
361397

362-
(canon_decomp, compat_decomp, gencats, combines) = load_unicode_data("UnicodeData.txt")
398+
(canon_decomp, compat_decomp, gencats,
399+
combines, lowerupper, upperlower) = load_unicode_data("UnicodeData.txt")
363400

364401
# Preamble
365402
rf.write('''// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
@@ -379,13 +416,16 @@ def emit_decomp_module(f, canon, compat, combine):
379416
380417
''')
381418

419+
emit_bsearch_range_table(rf);
382420
emit_property_module(rf, "general_category", gencats)
383421

384422
emit_decomp_module(rf, canon_decomp, compat_decomp, combines)
385423

386424
derived = load_properties("DerivedCoreProperties.txt",
387425
["XID_Start", "XID_Continue", "Alphabetic", "Lowercase", "Uppercase"])
426+
388427
emit_property_module(rf, "derived_property", derived)
389428

390429
props = load_properties("PropList.txt", ["White_Space"])
391430
emit_property_module(rf, "property", props)
431+
emit_conversions_module(rf, lowerupper, upperlower)

trunk/src/libarena/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ struct Chunk {
5151
}
5252
impl Chunk {
5353
fn capacity(&self) -> uint {
54-
self.data.borrow().borrow().get().capacity()
54+
self.data.deref().borrow().get().capacity()
5555
}
5656

5757
unsafe fn as_ptr(&self) -> *u8 {
58-
self.data.borrow().borrow().get().as_ptr()
58+
self.data.deref().borrow().get().as_ptr()
5959
}
6060
}
6161

0 commit comments

Comments
 (0)