Skip to content

Commit f7b5669

Browse files
committed
---
yaml --- r: 89682 b: refs/heads/master c: acbcb9e h: refs/heads/master v: v3
1 parent 1743f7a commit f7b5669

File tree

22 files changed

+188
-91
lines changed

22 files changed

+188
-91
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: e6a1f6d7df80f1063116fa48d4971f6baca8daaa
2+
refs/heads/master: acbcb9ed2e24137040a4c0a4f87034e943036ecb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/doc/po/ja/rust.md.po

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,13 @@ msgid ""
678678
"and continues as any mixture hex digits and underscores."
679679
msgstr ""
680680

681+
#. type: Bullet: ' * '
682+
#: doc/rust.md:326
683+
msgid ""
684+
"An _octal literal_ starts with the character sequence `U+0030` `U+006F` (`0o`) "
685+
"and continues as any mixture octal digits and underscores."
686+
msgstr ""
687+
681688
#. type: Bullet: ' * '
682689
#: doc/rust.md:326
683690
msgid ""
@@ -740,6 +747,7 @@ msgid ""
740747
"123u; // type uint\n"
741748
"123_u; // type uint\n"
742749
"0xff_u8; // type u8\n"
750+
"0o70_i16; // type i16\n"
743751
"0b1111_1111_1001_0000_i32; // type i32\n"
744752
"~~~~\n"
745753
msgstr ""

trunk/doc/po/ja/tutorial.md.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ msgstr "## プリミティブ型とリテラル"
849849
msgid ""
850850
"There are general signed and unsigned integer types, `int` and `uint`, as "
851851
"well as 8-, 16-, 32-, and 64-bit variants, `i8`, `u16`, etc. Integers can "
852-
"be written in decimal (`144`), hexadecimal (`0x90`), or binary "
852+
"be written in decimal (`144`), hexadecimal (`0x90`), octal (`0o70`), or binary "
853853
"(`0b10010000`) base. Each integral type has a corresponding literal suffix "
854854
"that can be used to indicate the type of a literal: `i` for `int`, `u` for "
855855
"`uint`, `i8` for the `i8` type."

trunk/doc/po/rust.md.pot

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ msgstr ""
661661

662662
#. type: Plain text
663663
#: doc/rust.md:319
664-
msgid "An _integer literal_ has one of three forms:"
664+
msgid "An _integer literal_ has one of four forms:"
665665
msgstr ""
666666

667667
#. type: Bullet: ' * '
@@ -678,6 +678,13 @@ msgid ""
678678
"and continues as any mixture hex digits and underscores."
679679
msgstr ""
680680

681+
#. type: Bullet: ' * '
682+
#: doc/rust.md:326
683+
msgid ""
684+
"An _octal literal_ starts with the character sequence `U+0030` `U+006F` (`0o`) "
685+
"and continues as any mixture octal digits and underscores."
686+
msgstr ""
687+
681688
#. type: Bullet: ' * '
682689
#: doc/rust.md:326
683690
msgid ""
@@ -740,6 +747,7 @@ msgid ""
740747
"123u; // type uint\n"
741748
"123_u; // type uint\n"
742749
"0xff_u8; // type u8\n"
750+
"0o70_i16; // type i16\n"
743751
"0b1111_1111_1001_0000_i32; // type i32\n"
744752
"~~~~\n"
745753
msgstr ""

trunk/doc/po/tutorial.md.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ msgstr ""
646646
msgid ""
647647
"There are general signed and unsigned integer types, `int` and `uint`, as "
648648
"well as 8-, 16-, 32-, and 64-bit variants, `i8`, `u16`, etc. Integers can "
649-
"be written in decimal (`144`), hexadecimal (`0x90`), or binary "
649+
"be written in decimal (`144`), hexadecimal (`0x90`), octal (`0o70`), or binary "
650650
"(`0b10010000`) base. Each integral type has a corresponding literal suffix "
651651
"that can be used to indicate the type of a literal: `i` for `int`, `u` for "
652652
"`uint`, `i8` for the `i8` type."

trunk/doc/rust.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,14 @@ as they are differentiated by suffixes.
340340

341341
##### Integer literals
342342

343-
An _integer literal_ has one of three forms:
343+
An _integer literal_ has one of four forms:
344344

345345
* A _decimal literal_ starts with a *decimal digit* and continues with any
346346
mixture of *decimal digits* and _underscores_.
347347
* A _hex literal_ starts with the character sequence `U+0030` `U+0078`
348348
(`0x`) and continues as any mixture hex digits and underscores.
349+
* An _octal literal_ starts with the character sequence `U+0030` `U+006F`
350+
(`0o`) and continues as any mixture octal digits and underscores.
349351
* A _binary literal_ starts with the character sequence `U+0030` `U+0062`
350352
(`0b`) and continues as any mixture binary digits and underscores.
351353

@@ -376,6 +378,7 @@ Examples of integer literals of various forms:
376378
123u; // type uint
377379
123_u; // type uint
378380
0xff_u8; // type u8
381+
0o70_i16; // type i16
379382
0b1111_1111_1001_0000_i32; // type i32
380383
~~~~
381384

trunk/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ fn is_four(x: int) -> bool {
305305

306306
There are general signed and unsigned integer types, `int` and `uint`,
307307
as well as 8-, 16-, 32-, and 64-bit variants, `i8`, `u16`, etc.
308-
Integers can be written in decimal (`144`), hexadecimal (`0x90`), or
308+
Integers can be written in decimal (`144`), hexadecimal (`0x90`), octal (`0o70`), or
309309
binary (`0b10010000`) base. Each integral type has a corresponding literal
310310
suffix that can be used to indicate the type of a literal: `i` for `int`,
311311
`u` for `uint`, `i8` for the `i8` type.

trunk/src/compiletest/errors.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
5252
let start_kind = idx;
5353
while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
5454

55-
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
56-
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
5755
let kind = line.slice(start_kind, idx);
58-
let kind = kind.to_ascii().to_lower().to_str_ascii();
56+
let kind = kind.to_ascii().to_lower().into_str();
5957

6058
// Extract msg:
6159
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }

trunk/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,18 @@
224224
[0-9a-fA-F]
225225
</define-regex>
226226

227+
<define-regex id="oct_digit" extended="true">
228+
[0-7]
229+
</define-regex>
230+
227231
<context id="number" style-ref="number">
228232
<match extended="true">
229233
((?&lt;=\.\.)|(?&lt;![\w\.]))
230234
(
231235
[1-9][0-9_]*\%{num_suffix}?|
232236
0[0-9_]*\%{num_suffix}?|
233237
0b[01_]+\%{int_suffix}?|
238+
0o(\%{oct_digit}|_)+\%{int_suffix}?|
234239
0x(\%{hex_digit}|_)+\%{int_suffix}?
235240
)
236241
((?![\w\.].)|(?=\.\.))

trunk/src/etc/kate/rust.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
<Detect2Chars char="/" char1="/" attribute="Comment" context="Commentar 1"/>
200200
<Detect2Chars char="/" char1="*" attribute="Comment" context="Commentar 2" beginRegion="Comment"/>
201201
<RegExpr String="0x[0-9a-fA-F_]+&rustIntSuf;" attribute="Number" context="#stay"/>
202+
<RegExpr String="0o[0-7_]+&rustIntSuf;" attribute="Number" context="#stay"/>
202203
<RegExpr String="0b[0-1_]+&rustIntSuf;" attribute="Number" context="#stay"/>
203204
<RegExpr String="[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?" attribute="Number" context="#stay"/>
204205
<RegExpr String="[0-9][0-9_]*&rustIntSuf;" attribute="Number" context="#stay"/>

trunk/src/etc/vim/syntax/rust.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ syn match rustNumber display "\<[0-9][0-9_]*\(i\|i8\|i16\|i32\|i64\)\>"
161161
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\>"
162162
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(u\|u8\|u16\|u32\|u64\)\>"
163163
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(i8\|i16\|i32\|i64\)\>"
164+
syn match rustOctNumber display "\<0o[0-7_]\+\>"
165+
syn match rustOctNumber display "\<0o[0-7_]\+\(u\|u8\|u16\|u32\|u64\)\>"
166+
syn match rustOctNumber display "\<0o[0-7_]\+\(i8\|i16\|i32\|i64\)\>"
164167
syn match rustBinNumber display "\<0b[01_]\+\>"
165168
syn match rustBinNumber display "\<0b[01_]\+\(u\|u8\|u16\|u32\|u64\)\>"
166169
syn match rustBinNumber display "\<0b[01_]\+\(i8\|i16\|i32\|i64\)\>"
@@ -198,6 +201,7 @@ syn region rustFoldBraces start="{" end="}" transparent fold
198201

199202
" Default highlighting {{{1
200203
hi def link rustHexNumber rustNumber
204+
hi def link rustOctNumber rustNumber
201205
hi def link rustBinNumber rustNumber
202206
hi def link rustIdentifierPrime rustIdentifier
203207
hi def link rustTrait rustType

trunk/src/libextra/sort.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -887,12 +887,8 @@ mod tests {
887887
// tjc: funny that we have to use parens
888888
fn ile(x: &(&'static str), y: &(&'static str)) -> bool
889889
{
890-
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
891-
// to_ascii_move and to_str_move to not do a unnecessary clone.
892-
// (Actually, could just remove the to_str_* call, but needs an deriving(Ord) on
893-
// Ascii)
894-
let x = x.to_ascii().to_lower().to_str_ascii();
895-
let y = y.to_ascii().to_lower().to_str_ascii();
890+
let x = x.to_ascii().to_lower().into_str();
891+
let y = y.to_ascii().to_lower().into_str();
896892
x <= y
897893
}
898894

trunk/src/libextra/time.rs

Lines changed: 59 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -965,8 +965,35 @@ mod tests {
965965
use super::*;
966966
967967
use std::f64;
968-
use std::os;
969968
use std::result::{Err, Ok};
969+
use std::libc;
970+
971+
#[cfg(windows)]
972+
#[fixed_stack_segment]
973+
fn set_time_zone() {
974+
// Windows crt doesn't see any environment variable set by
975+
// `SetEnvironmentVariable`, which `os::setenv` internally uses.
976+
// It is why we use `putenv` here.
977+
extern {
978+
fn _putenv(envstring: *libc::c_char) -> libc::c_int;
979+
}
980+
981+
unsafe {
982+
// Windows does not understand "America/Los_Angeles".
983+
// PST+08 may look wrong, but not! "PST" indicates
984+
// the name of timezone. "+08" means UTC = local + 08.
985+
do "TZ=PST+08".with_c_str |env| {
986+
_putenv(env);
987+
}
988+
}
989+
tzset();
990+
}
991+
#[cfg(not(windows))]
992+
fn set_time_zone() {
993+
use std::os;
994+
os::setenv("TZ", "America/Los_Angeles");
995+
tzset();
996+
}
970997

971998
fn test_get_time() {
972999
static SOME_RECENT_DATE: i64 = 1325376000i64; // 2012-01-01T00:00:00Z
@@ -1007,57 +1034,54 @@ mod tests {
10071034
}
10081035

10091036
fn test_at_utc() {
1010-
os::setenv("TZ", "America/Los_Angeles");
1011-
tzset();
1037+
set_time_zone();
10121038

10131039
let time = Timespec::new(1234567890, 54321);
10141040
let utc = at_utc(time);
10151041

1016-
assert!(utc.tm_sec == 30_i32);
1017-
assert!(utc.tm_min == 31_i32);
1018-
assert!(utc.tm_hour == 23_i32);
1019-
assert!(utc.tm_mday == 13_i32);
1020-
assert!(utc.tm_mon == 1_i32);
1021-
assert!(utc.tm_year == 109_i32);
1022-
assert!(utc.tm_wday == 5_i32);
1023-
assert!(utc.tm_yday == 43_i32);
1024-
assert!(utc.tm_isdst == 0_i32);
1025-
assert!(utc.tm_gmtoff == 0_i32);
1026-
assert!(utc.tm_zone == ~"UTC");
1027-
assert!(utc.tm_nsec == 54321_i32);
1042+
assert_eq!(utc.tm_sec, 30_i32);
1043+
assert_eq!(utc.tm_min, 31_i32);
1044+
assert_eq!(utc.tm_hour, 23_i32);
1045+
assert_eq!(utc.tm_mday, 13_i32);
1046+
assert_eq!(utc.tm_mon, 1_i32);
1047+
assert_eq!(utc.tm_year, 109_i32);
1048+
assert_eq!(utc.tm_wday, 5_i32);
1049+
assert_eq!(utc.tm_yday, 43_i32);
1050+
assert_eq!(utc.tm_isdst, 0_i32);
1051+
assert_eq!(utc.tm_gmtoff, 0_i32);
1052+
assert_eq!(utc.tm_zone, ~"UTC");
1053+
assert_eq!(utc.tm_nsec, 54321_i32);
10281054
}
10291055
10301056
fn test_at() {
1031-
os::setenv("TZ", "America/Los_Angeles");
1032-
tzset();
1057+
set_time_zone();
10331058
10341059
let time = Timespec::new(1234567890, 54321);
10351060
let local = at(time);
10361061
10371062
error!("time_at: {:?}", local);
10381063
1039-
assert!(local.tm_sec == 30_i32);
1040-
assert!(local.tm_min == 31_i32);
1041-
assert!(local.tm_hour == 15_i32);
1042-
assert!(local.tm_mday == 13_i32);
1043-
assert!(local.tm_mon == 1_i32);
1044-
assert!(local.tm_year == 109_i32);
1045-
assert!(local.tm_wday == 5_i32);
1046-
assert!(local.tm_yday == 43_i32);
1047-
assert!(local.tm_isdst == 0_i32);
1048-
assert!(local.tm_gmtoff == -28800_i32);
1064+
assert_eq!(local.tm_sec, 30_i32);
1065+
assert_eq!(local.tm_min, 31_i32);
1066+
assert_eq!(local.tm_hour, 15_i32);
1067+
assert_eq!(local.tm_mday, 13_i32);
1068+
assert_eq!(local.tm_mon, 1_i32);
1069+
assert_eq!(local.tm_year, 109_i32);
1070+
assert_eq!(local.tm_wday, 5_i32);
1071+
assert_eq!(local.tm_yday, 43_i32);
1072+
assert_eq!(local.tm_isdst, 0_i32);
1073+
assert_eq!(local.tm_gmtoff, -28800_i32);
10491074
10501075
// FIXME (#2350): We should probably standardize on the timezone
10511076
// abbreviation.
10521077
let zone = &local.tm_zone;
10531078
assert!(*zone == ~"PST" || *zone == ~"Pacific Standard Time");
10541079
1055-
assert!(local.tm_nsec == 54321_i32);
1080+
assert_eq!(local.tm_nsec, 54321_i32);
10561081
}
10571082
10581083
fn test_to_timespec() {
1059-
os::setenv("TZ", "America/Los_Angeles");
1060-
tzset();
1084+
set_time_zone();
10611085
10621086
let time = Timespec::new(1234567890, 54321);
10631087
let utc = at_utc(time);
@@ -1067,8 +1091,7 @@ mod tests {
10671091
}
10681092
10691093
fn test_conversions() {
1070-
os::setenv("TZ", "America/Los_Angeles");
1071-
tzset();
1094+
set_time_zone();
10721095
10731096
let time = Timespec::new(1234567890, 54321);
10741097
let utc = at_utc(time);
@@ -1083,8 +1106,7 @@ mod tests {
10831106
}
10841107
10851108
fn test_strptime() {
1086-
os::setenv("TZ", "America/Los_Angeles");
1087-
tzset();
1109+
set_time_zone();
10881110
10891111
match strptime("", "") {
10901112
Ok(ref tm) => {
@@ -1248,8 +1270,7 @@ mod tests {
12481270
}
12491271
12501272
fn test_ctime() {
1251-
os::setenv("TZ", "America/Los_Angeles");
1252-
tzset();
1273+
set_time_zone();
12531274
12541275
let time = Timespec::new(1234567890, 54321);
12551276
let utc = at_utc(time);
@@ -1262,8 +1283,7 @@ mod tests {
12621283
}
12631284
12641285
fn test_strftime() {
1265-
os::setenv("TZ", "America/Los_Angeles");
1266-
tzset();
1286+
set_time_zone();
12671287
12681288
let time = Timespec::new(1234567890, 54321);
12691289
let utc = at_utc(time);
@@ -1323,8 +1343,7 @@ mod tests {
13231343
// abbreviation.
13241344
let rfc822 = local.rfc822();
13251345
let prefix = ~"Fri, 13 Feb 2009 15:31:30 ";
1326-
assert!(rfc822 == prefix + "PST" ||
1327-
rfc822 == prefix + "Pacific Standard Time");
1346+
assert!(rfc822 == prefix + "PST" || rfc822 == prefix + "Pacific Standard Time");
13281347
13291348
assert_eq!(local.ctime(), ~"Fri Feb 13 15:31:30 2009");
13301349
assert_eq!(local.rfc822z(), ~"Fri, 13 Feb 2009 15:31:30 -0800");

trunk/src/libextra/url.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -581,7 +581,7 @@ fn get_path(rawurl: &str, authority: bool) ->
581581
match c {
582582
'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '&' |'\'' | '(' | ')' | '.'
583583
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '='
584-
| '_' | '-' => {
584+
| '_' | '-' | '~' => {
585585
continue;
586586
}
587587
'?' | '#' => {
@@ -824,15 +824,15 @@ mod tests {
824824
825825
#[test]
826826
fn test_url_parse() {
827-
let url = ~"http://user:[email protected]:8080/doc?s=v#something";
827+
let url = ~"http://user:[email protected]:8080/doc/~u?s=v#something";
828828

829829
let up = from_str(url);
830830
let u = up.unwrap();
831831
assert_eq!(&u.scheme, &~"http");
832832
assert_eq!(&u.user, &Some(UserInfo::new(~"user", Some(~"pass"))));
833833
assert_eq!(&u.host, &~"rust-lang.org");
834834
assert_eq!(&u.port, &Some(~"8080"));
835-
assert_eq!(&u.path, &~"/doc");
835+
assert_eq!(&u.path, &~"/doc/~u");
836836
assert_eq!(&u.query, &~[(~"s", ~"v")]);
837837
assert_eq!(&u.fragment, &Some(~"something"));
838838
}

trunk/src/librustc/driver/driver.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,8 @@ pub fn build_session_options(binary: @str,
669669
for level in lint_levels.iter() {
670670
let level_name = lint::level_to_str(*level);
671671

672-
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
673-
// to_ascii_move and to_str_move to not do a unnecessary copy.
674672
let level_short = level_name.slice_chars(0, 1);
675-
let level_short = level_short.to_ascii().to_upper().to_str_ascii();
673+
let level_short = level_short.to_ascii().to_upper().into_str();
676674
let flags = vec::append(matches.opt_strs(level_short),
677675
matches.opt_strs(level_name));
678676
for lint_name in flags.iter() {

0 commit comments

Comments
 (0)