Skip to content

Commit b3c91df

Browse files
committed
Merge branch 'master' into redox
2 parents ae2029f + 9fba8df commit b3c91df

File tree

268 files changed

+5041
-3095
lines changed

Some content is hidden

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

268 files changed

+5041
-3095
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ probe_need CFG_CMAKE cmake
856856
if [ -n "$CFG_ANTLR4" ]
857857
then
858858
CFG_ANTLR4_JAR="\"$(find /usr/ -name antlr-complete.jar 2>/dev/null | head -n 1)\""
859-
if [ "x" -eq "x$CFG_ANTLR4_JAR" ]
859+
if [ "x" = "x$CFG_ANTLR4_JAR" ]
860860
then
861861
CFG_ANTLR4_JAR="\"$(find ~ -name antlr-complete.jar 2>/dev/null | head -n 1)\""
862862
fi

src/doc/book/lifetimes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ to it.
352352
Rust supports powerful local type inference in the bodies of functions but not in their item signatures.
353353
It's forbidden to allow reasoning about types based on the item signature alone.
354354
However, for ergonomic reasons, a very restricted secondary inference algorithm called
355-
“lifetime elision” does apply when judging lifetimes. Lifetime elision is concerned solely to infer
355+
“lifetime elision” does apply when judging lifetimes. Lifetime elision is concerned solely with inferring
356356
lifetime parameters using three easily memorizable and unambiguous rules. This means lifetime elision
357357
acts as a shorthand for writing an item signature, while not hiding
358358
away the actual types involved as full local inference would if applied to it.

src/doc/reference.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,18 +2474,19 @@ The currently implemented features of the reference compiler are:
24742474
internally without imposing on callers
24752475
(i.e. making them behave like function calls in
24762476
terms of encapsulation).
2477-
* - `default_type_parameter_fallback` - Allows type parameter defaults to
2478-
influence type inference.
24792477

2480-
* - `stmt_expr_attributes` - Allows attributes on expressions.
2478+
* `default_type_parameter_fallback` - Allows type parameter defaults to
2479+
influence type inference.
24812480

2482-
* - `type_ascription` - Allows type ascription expressions `expr: Type`.
2481+
* `stmt_expr_attributes` - Allows attributes on expressions.
24832482

2484-
* - `abi_vectorcall` - Allows the usage of the vectorcall calling convention
2485-
(e.g. `extern "vectorcall" func fn_();`)
2483+
* `type_ascription` - Allows type ascription expressions `expr: Type`.
24862484

2487-
* - `abi_sysv64` - Allows the usage of the system V AMD64 calling convention
2488-
(e.g. `extern "sysv64" func fn_();`)
2485+
* `abi_vectorcall` - Allows the usage of the vectorcall calling convention
2486+
(e.g. `extern "vectorcall" func fn_();`)
2487+
2488+
* `abi_sysv64` - Allows the usage of the system V AMD64 calling convention
2489+
(e.g. `extern "sysv64" func fn_();`)
24892490

24902491
If a feature is promoted to a language feature, then all existing programs will
24912492
start to receive compilation warnings about `#![feature]` directives which enabled

src/etc/char_private.py

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@
1111
# except according to those terms.
1212

1313
# This script uses the following Unicode tables:
14-
# - Categories.txt
14+
# - UnicodeData.txt
1515

16+
17+
from collections import namedtuple
18+
import csv
1619
import os
1720
import subprocess
1821

22+
NUM_CODEPOINTS=0x110000
23+
1924
def to_ranges(iter):
2025
current = None
2126
for i in iter:
@@ -28,10 +33,10 @@ def to_ranges(iter):
2833
if current is not None:
2934
yield tuple(current)
3035

31-
def get_escaped(dictionary):
32-
for i in range(0x110000):
33-
if dictionary.get(i, "Cn") in "Cc Cf Cs Co Cn Zl Zp Zs".split() and i != ord(' '):
34-
yield i
36+
def get_escaped(codepoints):
37+
for c in codepoints:
38+
if (c.class_ or "Cn") in "Cc Cf Cs Co Cn Zl Zp Zs".split() and c.value != ord(' '):
39+
yield c.value
3540

3641
def get_file(f):
3742
try:
@@ -40,10 +45,41 @@ def get_file(f):
4045
subprocess.run(["curl", "-O", f], check=True)
4146
return open(os.path.basename(f))
4247

48+
Codepoint = namedtuple('Codepoint', 'value class_')
49+
50+
def get_codepoints(f):
51+
r = csv.reader(f, delimiter=";")
52+
prev_codepoint = 0
53+
class_first = None
54+
for row in r:
55+
codepoint = int(row[0], 16)
56+
name = row[1]
57+
class_ = row[2]
58+
59+
if class_first is not None:
60+
if not name.endswith("Last>"):
61+
raise ValueError("Missing Last after First")
62+
63+
for c in range(prev_codepoint + 1, codepoint):
64+
yield Codepoint(c, class_first)
65+
66+
class_first = None
67+
if name.endswith("First>"):
68+
class_first = class_
69+
70+
yield Codepoint(codepoint, class_)
71+
prev_codepoint = codepoint
72+
73+
if class_first != None:
74+
raise ValueError("Missing Last after First")
75+
76+
for c in range(prev_codepoint + 1, NUM_CODEPOINTS):
77+
yield Codepoint(c, None)
78+
4379
def main():
44-
file = get_file("http://www.unicode.org/notes/tn36/Categories.txt")
80+
file = get_file("http://www.unicode.org/Public/UNIDATA/UnicodeData.txt")
4581

46-
dictionary = {int(line.split()[0], 16): line.split()[1] for line in file}
82+
codepoints = get_codepoints(file)
4783

4884
CUTOFF=0x10000
4985
singletons0 = []
@@ -52,7 +88,7 @@ def main():
5288
normal1 = []
5389
extra = []
5490

55-
for a, b in to_ranges(get_escaped(dictionary)):
91+
for a, b in to_ranges(get_escaped(codepoints)):
5692
if a > 2 * CUTOFF:
5793
extra.append((a, b - a))
5894
elif a == b - 1:

src/libcollectionstest/str.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ fn test_iterator() {
767767
pos += 1;
768768
}
769769
assert_eq!(pos, v.len());
770+
assert_eq!(s.chars().count(), v.len());
770771
}
771772

772773
#[test]
@@ -814,6 +815,14 @@ fn test_iterator_clone() {
814815
assert!(it.clone().zip(it).all(|(x,y)| x == y));
815816
}
816817

818+
#[test]
819+
fn test_iterator_last() {
820+
let s = "ศไทย中华Việt Nam";
821+
let mut it = s.chars();
822+
it.next();
823+
assert_eq!(it.last(), Some('m'));
824+
}
825+
817826
#[test]
818827
fn test_bytesator() {
819828
let s = "ศไทย中华Việt Nam";
@@ -911,6 +920,14 @@ fn test_char_indices_revator() {
911920
assert_eq!(pos, p.len());
912921
}
913922

923+
#[test]
924+
fn test_char_indices_last() {
925+
let s = "ศไทย中华Việt Nam";
926+
let mut it = s.char_indices();
927+
it.next();
928+
assert_eq!(it.last(), Some((27, 'm')));
929+
}
930+
914931
#[test]
915932
fn test_splitn_char_iterator() {
916933
let data = "\nMäry häd ä little lämb\nLittle lämb\n";

0 commit comments

Comments
 (0)