Skip to content

Register new snapshots #19672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions src/etc/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,7 @@ def load_east_asian_width(want_widths, except_cats):
return widths

def escape_char(c):
if c <= 0x7f:
return "'\\x%2.2x'" % c
if c <= 0xffff:
return "'\\u%4.4x'" % c
return "'\\U%8.8x'" % c
return "'\\u{%x}'" % c

def emit_bsearch_range_table(f):
f.write("""
Expand Down Expand Up @@ -377,8 +373,8 @@ def emit_conversions_module(f, lowerupper, upperlower):
else if key < c { Less }
else { Greater }
}) {
slice::Found(i) => Some(i),
slice::NotFound(_) => None,
slice::BinarySearchResult::Found(i) => Some(i),
slice::BinarySearchResult::NotFound(_) => None,
}
}

Expand All @@ -392,6 +388,7 @@ def emit_conversions_module(f, lowerupper, upperlower):
def emit_grapheme_module(f, grapheme_table, grapheme_cats):
f.write("""pub mod grapheme {
use core::slice::SlicePrelude;
use core::kinds::Copy;
pub use self::GraphemeCat::*;
use core::slice;

Expand All @@ -403,18 +400,20 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
f.write(" GC_" + cat + ",\n")
f.write(""" }

impl Copy for GraphemeCat {}

fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
use core::cmp::Ordering::{Equal, Less, Greater};
match r.binary_search(|&(lo, hi, _)| {
if lo <= c && c <= hi { Equal }
else if hi < c { Less }
else { Greater }
}) {
slice::Found(idx) => {
slice::BinarySearchResult::Found(idx) => {
let (_, _, cat) = r[idx];
cat
}
slice::NotFound(_) => GC_Any
slice::BinarySearchResult::NotFound(_) => GC_Any
}
}

Expand Down Expand Up @@ -443,11 +442,11 @@ def emit_charwidth_module(f, width_table):
else if hi < c { Less }
else { Greater }
}) {
slice::Found(idx) => {
slice::BinarySearchResult::Found(idx) => {
let (_, _, r_ncjk, r_cjk) = r[idx];
if is_cjk { r_cjk } else { r_ncjk }
}
slice::NotFound(_) => 1
slice::BinarySearchResult::NotFound(_) => 1
}
}
""")
Expand Down Expand Up @@ -540,11 +539,11 @@ def comp_pfun(char):
else if hi < c { Less }
else { Greater }
}) {
slice::Found(idx) => {
slice::BinarySearchResult::Found(idx) => {
let (_, _, result) = r[idx];
result
}
slice::NotFound(_) => 0
slice::BinarySearchResult::NotFound(_) => 0
}
}\n
""")
Expand Down Expand Up @@ -613,7 +612,7 @@ def optimize_width_table(wtable):
unicode_version = re.search(pattern, readme.read()).groups()
rf.write("""
/// The version of [Unicode](http://www.unicode.org/)
/// that the `UnicodeChar` and `UnicodeStrSlice` traits are based on.
/// that the `UnicodeChar` and `UnicodeStrPrelude` traits are based on.
pub const UNICODE_VERSION: (uint, uint, uint) = (%s, %s, %s);
""" % unicode_version)
(canon_decomp, compat_decomp, gencats, combines,
Expand Down
705 changes: 414 additions & 291 deletions src/libcollections/str.rs

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl String {
/// ```rust
/// let input = b"Hello \xF0\x90\x80World";
/// let output = String::from_utf8_lossy(input);
/// assert_eq!(output.as_slice(), "Hello \uFFFDWorld");
/// assert_eq!(output.as_slice(), "Hello \u{FFFD}World");
/// ```
#[unstable = "return type may change"]
pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> CowString<'a> {
Expand Down Expand Up @@ -275,7 +275,7 @@ impl String {
/// 0xD834];
///
/// assert_eq!(String::from_utf16_lossy(v),
/// "𝄞mus\uFFFDic\uFFFD".to_string());
/// "𝄞mus\u{FFFD}ic\u{FFFD}".to_string());
/// ```
#[stable]
pub fn from_utf16_lossy(v: &[u16]) -> String {
Expand Down Expand Up @@ -1043,32 +1043,32 @@ mod tests {

let xs = b"Hello\xC2 There\xFF Goodbye";
assert_eq!(String::from_utf8_lossy(xs),
String::from_str("Hello\uFFFD There\uFFFD Goodbye").into_cow());
String::from_str("Hello\u{FFFD} There\u{FFFD} Goodbye").into_cow());

let xs = b"Hello\xC0\x80 There\xE6\x83 Goodbye";
assert_eq!(String::from_utf8_lossy(xs),
String::from_str("Hello\uFFFD\uFFFD There\uFFFD Goodbye").into_cow());
String::from_str("Hello\u{FFFD}\u{FFFD} There\u{FFFD} Goodbye").into_cow());

let xs = b"\xF5foo\xF5\x80bar";
assert_eq!(String::from_utf8_lossy(xs),
String::from_str("\uFFFDfoo\uFFFD\uFFFDbar").into_cow());
String::from_str("\u{FFFD}foo\u{FFFD}\u{FFFD}bar").into_cow());

let xs = b"\xF1foo\xF1\x80bar\xF1\x80\x80baz";
assert_eq!(String::from_utf8_lossy(xs),
String::from_str("\uFFFDfoo\uFFFDbar\uFFFDbaz").into_cow());
String::from_str("\u{FFFD}foo\u{FFFD}bar\u{FFFD}baz").into_cow());

let xs = b"\xF4foo\xF4\x80bar\xF4\xBFbaz";
assert_eq!(String::from_utf8_lossy(xs),
String::from_str("\uFFFDfoo\uFFFDbar\uFFFD\uFFFDbaz").into_cow());
String::from_str("\u{FFFD}foo\u{FFFD}bar\u{FFFD}\u{FFFD}baz").into_cow());

let xs = b"\xF0\x80\x80\x80foo\xF0\x90\x80\x80bar";
assert_eq!(String::from_utf8_lossy(xs), String::from_str("\uFFFD\uFFFD\uFFFD\uFFFD\
foo\U00010000bar").into_cow());
assert_eq!(String::from_utf8_lossy(xs), String::from_str("\u{FFFD}\u{FFFD}\u{FFFD}\u{FFFD}\
foo\u{10000}bar").into_cow());

// surrogates
let xs = b"\xED\xA0\x80foo\xED\xBF\xBFbar";
assert_eq!(String::from_utf8_lossy(xs), String::from_str("\uFFFD\uFFFD\uFFFDfoo\
\uFFFD\uFFFD\uFFFDbar").into_cow());
assert_eq!(String::from_utf8_lossy(xs), String::from_str("\u{FFFD}\u{FFFD}\u{FFFD}foo\
\u{FFFD}\u{FFFD}\u{FFFD}bar").into_cow());
}

#[test]
Expand Down Expand Up @@ -1110,7 +1110,7 @@ mod tests {
0xd801_u16, 0xdc95_u16, 0xd801_u16, 0xdc86_u16,
0x000a_u16 ]),
// Issue #12318, even-numbered non-BMP planes
(String::from_str("\U00020000"),
(String::from_str("\u{20000}"),
vec![0xD840, 0xDC00])];

for p in pairs.iter() {
Expand Down Expand Up @@ -1148,16 +1148,17 @@ mod tests {
fn test_from_utf16_lossy() {
// completely positive cases tested above.
// lead + eof
assert_eq!(String::from_utf16_lossy(&[0xD800]), String::from_str("\uFFFD"));
assert_eq!(String::from_utf16_lossy(&[0xD800]), String::from_str("\u{FFFD}"));
// lead + lead
assert_eq!(String::from_utf16_lossy(&[0xD800, 0xD800]), String::from_str("\uFFFD\uFFFD"));
assert_eq!(String::from_utf16_lossy(&[0xD800, 0xD800]),
String::from_str("\u{FFFD}\u{FFFD}"));

// isolated trail
assert_eq!(String::from_utf16_lossy(&[0x0061, 0xDC00]), String::from_str("a\uFFFD"));
assert_eq!(String::from_utf16_lossy(&[0x0061, 0xDC00]), String::from_str("a\u{FFFD}"));

// general
assert_eq!(String::from_utf16_lossy(&[0xD800, 0xd801, 0xdc8b, 0xD800]),
String::from_str("\uFFFD𐒋\uFFFD"));
String::from_str("\u{FFFD}𐒋\u{FFFD}"));
}

#[test]
Expand Down Expand Up @@ -1249,7 +1250,7 @@ mod tests {
#[test]
#[should_fail]
fn test_str_truncate_split_codepoint() {
let mut s = String::from_str("\u00FC"); // ü
let mut s = String::from_str("\u{FC}"); // ü
s.truncate(1);
}

Expand Down
12 changes: 6 additions & 6 deletions src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static MAX_THREE_B: u32 = 0x10000u32;

/// The highest valid code point
#[stable]
pub const MAX: char = '\U0010ffff';
pub const MAX: char = '\u{10ffff}';

/// Converts from `u32` to a `char`
#[inline]
Expand Down Expand Up @@ -161,8 +161,8 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
/// The rules are as follows:
///
/// - chars in [0,0xff] get 2-digit escapes: `\\xNN`
/// - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
/// - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
/// - chars in [0x100,0xffff] get 4-digit escapes: `\\u{NNNN}`
/// - chars above 0x10000 get 8-digit escapes: `\\u{{NNN}NNNNN}`
///
#[deprecated = "use the Char::escape_unicode method"]
pub fn escape_unicode(c: char, f: |char|) {
Expand Down Expand Up @@ -269,8 +269,8 @@ pub trait Char {
/// The rules are as follows:
///
/// * Characters in [0,0xff] get 2-digit escapes: `\\xNN`
/// * Characters in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`.
/// * Characters above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`.
/// * Characters in [0x100,0xffff] get 4-digit escapes: `\\u{NNNN}`.
/// * Characters above 0x10000 get 8-digit escapes: `\\u{{NNN}NNNNN}`.
#[unstable = "pending error conventions, trait organization"]
fn escape_unicode(self) -> UnicodeEscapedChars;

Expand Down Expand Up @@ -470,7 +470,7 @@ impl Iterator<char> for UnicodeEscapedChars {
}
UnicodeEscapedCharsState::Type => {
let (typechar, pad) = if self.c <= '\x7f' { ('x', 2) }
else if self.c <= '\uffff' { ('u', 4) }
else if self.c <= '\u{ffff}' { ('u', 4) }
else { ('U', 8) };
self.state = UnicodeEscapedCharsState::Value(range_step(4 * (pad - 1), -1, -4i32));
Some(typechar)
Expand Down
50 changes: 0 additions & 50 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,53 +864,3 @@ impl<F,A,R> FnOnce<A,R> for F
self.call_mut(args)
}
}

#[cfg(stage0)]
mod fn_impls {
use super::Fn;

impl<Result> Fn<(),Result> for extern "Rust" fn() -> Result {
#[allow(non_snake_case)]
extern "rust-call" fn call(&self, _args: ()) -> Result {
(*self)()
}
}

impl<Result,A0> Fn<(A0,),Result> for extern "Rust" fn(A0) -> Result {
#[allow(non_snake_case)]
extern "rust-call" fn call(&self, args: (A0,)) -> Result {
let (a0,) = args;
(*self)(a0)
}
}

macro_rules! def_fn(
($($args:ident)*) => (
impl<Result$(,$args)*>
Fn<($($args,)*),Result>
for extern "Rust" fn($($args: $args,)*) -> Result {
#[allow(non_snake_case)]
extern "rust-call" fn call(&self, args: ($($args,)*)) -> Result {
let ($($args,)*) = args;
(*self)($($args,)*)
}
}
)
)

def_fn!(A0 A1)
def_fn!(A0 A1 A2)
def_fn!(A0 A1 A2 A3)
def_fn!(A0 A1 A2 A3 A4)
def_fn!(A0 A1 A2 A3 A4 A5)
def_fn!(A0 A1 A2 A3 A4 A5 A6)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14)
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15)
}
3 changes: 0 additions & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@

#![stable]

#[cfg(stage0)]
pub use self::Option::*;
#[cfg(not(stage0))]
use self::Option::*;

use cmp::{Eq, Ord};
Expand Down
1 change: 0 additions & 1 deletion src/libcore/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,5 @@ pub fn fold<T,
Ok(init)
}

#[cfg(not(stage0))]
impl<T:Copy,U:Copy> Copy for Result<T,U> {}

12 changes: 6 additions & 6 deletions src/libcore/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,13 +914,13 @@ fn run_utf8_validation_iterator(iter: &mut slice::Items<u8>) -> bool {
if first >= 128 {
let w = utf8_char_width(first);
let second = next!();
// 2-byte encoding is for codepoints \u0080 to \u07ff
// 2-byte encoding is for codepoints \u{0080} to \u{07ff}
// first C2 80 last DF BF
// 3-byte encoding is for codepoints \u0800 to \uffff
// 3-byte encoding is for codepoints \u{0800} to \u{ffff}
// first E0 A0 80 last EF BF BF
// excluding surrogates codepoints \ud800 to \udfff
// excluding surrogates codepoints \u{d800} to \u{dfff}
// ED A0 80 to ED BF BF
// 4-byte encoding is for codepoints \u10000 to \u10ffff
// 4-byte encoding is for codepoints \u{1000}0 to \u{10ff}ff
// first F0 90 80 80 last F4 8F BF BF
//
// Use the UTF-8 syntax from the RFC
Expand Down Expand Up @@ -1007,7 +1007,7 @@ impl Utf16Item {
pub fn to_char_lossy(&self) -> char {
match *self {
ScalarValue(c) => c,
LoneSurrogate(_) => '\uFFFD'
LoneSurrogate(_) => '\u{FFFD}'
}
}
}
Expand Down Expand Up @@ -1523,7 +1523,7 @@ pub trait StrPrelude for Sized? {
/// // composed forms of `ö` and `é`
/// let c = "Löwe 老虎 Léopard"; // German, Simplified Chinese, French
/// // decomposed forms of `ö` and `é`
/// let d = "Lo\u0308we 老虎 Le\u0301opard";
/// let d = "Lo\u{0308}we 老虎 Le\u{0301}opard";
///
/// assert_eq!(c.char_len(), 15);
/// assert_eq!(d.char_len(), 17);
Expand Down
4 changes: 2 additions & 2 deletions src/libgetopts/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,10 +1569,10 @@ Options:
#[test]
fn test_usage_description_multibyte_handling() {
let optgroups = vec!(
optflag("k", "k\u2013w\u2013",
optflag("k", "k\u{2013}w\u{2013}",
"The word kiwi is normally spelled with two i's"),
optflag("a", "apple",
"This \u201Cdescription\u201D has some characters that could \
"This \u{201C}description\u{201D} has some characters that could \
confuse the line wrapping; an apple costs 0.51€ in some parts of Europe."));

let expected =
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]

#![feature(default_type_params, globs, if_let, import_shadowing, macro_rules, phase, quote)]
#![feature(slicing_syntax, tuple_indexing, unsafe_destructor)]
#![feature(default_type_params, globs, import_shadowing, macro_rules, phase, quote)]
#![feature(slicing_syntax, unsafe_destructor)]
#![feature(rustc_diagnostic_macros)]

extern crate arena;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]

#![feature(default_type_params, globs, if_let, import_shadowing, macro_rules, phase, quote)]
#![feature(default_type_params, globs, import_shadowing, macro_rules, phase, quote)]
#![feature(slicing_syntax, unsafe_destructor)]
#![feature(rustc_diagnostic_macros)]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]

#![feature(default_type_params, globs, if_let, import_shadowing, macro_rules, phase, quote)]
#![feature(default_type_params, globs, import_shadowing, macro_rules, phase, quote)]
#![feature(slicing_syntax, unsafe_destructor)]
#![feature(rustc_diagnostic_macros)]

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ This API is completely unstable and subject to change.
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]

#![feature(default_type_params, globs, if_let, import_shadowing, macro_rules, phase, quote)]
#![feature(slicing_syntax, tuple_indexing, unsafe_destructor)]
#![feature(default_type_params, globs, import_shadowing, macro_rules, phase, quote)]
#![feature(slicing_syntax, unsafe_destructor)]
#![feature(rustc_diagnostic_macros)]
#![allow(non_camel_case_types)]

Expand Down
Loading