Skip to content

Commit 342d3d7

Browse files
committed
---
yaml --- r: 78814 b: refs/heads/try c: 540d98e h: refs/heads/master v: v3
1 parent 93af6d9 commit 342d3d7

File tree

22 files changed

+409
-233
lines changed

22 files changed

+409
-233
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 25ed29a0edb3d48fef843a0b818ee68faf2252da
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 60fba4d7d677ec098e6a43014132fe99f7547363
5-
refs/heads/try: 4de9bca4d813b88f06f7c5f64d2c452c80611f6b
5+
refs/heads/try: 540d98e7fc145258371345c536c8e0ec987270f0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/getopts.rs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,9 @@ pub mod groups {
689689
}
690690
}
691691

692-
// FIXME: #5516
692+
// FIXME: #5516 should be graphemes not codepoints
693693
// here we just need to indent the start of the description
694-
let rowlen = row.len();
694+
let rowlen = row.char_len();
695695
if rowlen < 24 {
696696
do (24 - rowlen).times {
697697
row.push_char(' ')
@@ -707,14 +707,14 @@ pub mod groups {
707707
desc_normalized_whitespace.push_char(' ');
708708
}
709709

710-
// FIXME: #5516
710+
// FIXME: #5516 should be graphemes not codepoints
711711
let mut desc_rows = ~[];
712712
do each_split_within(desc_normalized_whitespace, 54) |substr| {
713713
desc_rows.push(substr.to_owned());
714714
true
715715
};
716716

717-
// FIXME: #5516
717+
// FIXME: #5516 should be graphemes not codepoints
718718
// wrapped description
719719
row.push_str(desc_rows.connect(desc_sep));
720720

@@ -798,7 +798,7 @@ pub mod groups {
798798
cont
799799
};
800800

801-
ss.iter().enumerate().advance(|x| machine(x));
801+
ss.char_offset_iter().advance(|x| machine(x));
802802

803803
// Let the automaton 'run out' by supplying trailing whitespace
804804
while cont && match state { B | C => true, A => false } {
@@ -1580,4 +1580,31 @@ Options:
15801580
debug!("generated: <<%s>>", usage);
15811581
assert!(usage == expected)
15821582
}
1583+
1584+
#[test]
1585+
fn test_groups_usage_description_multibyte_handling() {
1586+
let optgroups = ~[
1587+
groups::optflag("k", "k\u2013w\u2013",
1588+
"The word kiwi is normally spelled with two i's"),
1589+
groups::optflag("a", "apple",
1590+
"This \u201Cdescription\u201D has some characters that could \
1591+
confuse the line wrapping; an apple costs 0.51€ in some parts of Europe."),
1592+
];
1593+
1594+
let expected =
1595+
~"Usage: fruits
1596+
1597+
Options:
1598+
-k --k–w– The word kiwi is normally spelled with two i's
1599+
-a --apple This “description” has some characters that could
1600+
confuse the line wrapping; an apple costs 0.51in
1601+
some parts of Europe.
1602+
";
1603+
1604+
let usage = groups::usage("Usage: fruits", optgroups);
1605+
1606+
debug!("expected: <<%s>>", expected);
1607+
debug!("generated: <<%s>>", usage);
1608+
assert!(usage == expected)
1609+
}
15831610
}

branches/try/src/librustc/back/arm.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use driver::session::sess_os_to_meta_os;
1313
use driver::session;
1414
use metadata::loader::meta_section_name;
1515

16-
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
16+
pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
1717
return target_strs::t {
1818
module_asm: ~"",
1919

@@ -61,13 +61,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
6161
}
6262
},
6363

64-
target_triple: match target_os {
65-
session::os_macos => ~"arm-apple-darwin",
66-
session::os_win32 => ~"arm-pc-mingw32",
67-
session::os_linux => ~"arm-unknown-linux-gnueabihf",
68-
session::os_android => ~"arm-linux-androideabi",
69-
session::os_freebsd => ~"arm-unknown-freebsd"
70-
},
64+
target_triple: target_triple,
7165

7266
cc_args: ~[~"-marm"]
7367
};

branches/try/src/librustc/back/mips.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use driver::session;
1313
use driver::session::sess_os_to_meta_os;
1414
use metadata::loader::meta_section_name;
1515

16-
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
16+
pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
1717
return target_strs::t {
1818
module_asm: ~"",
1919

@@ -61,13 +61,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
6161
}
6262
},
6363

64-
target_triple: match target_os {
65-
session::os_macos => ~"mips-apple-darwin",
66-
session::os_win32 => ~"mips-pc-mingw32",
67-
session::os_linux => ~"mips-unknown-linux-gnu",
68-
session::os_android => ~"mips-unknown-android-gnu",
69-
session::os_freebsd => ~"mips-unknown-freebsd"
70-
},
64+
target_triple: target_triple,
7165

7266
cc_args: ~[]
7367
};

branches/try/src/librustc/back/x86.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use driver::session::sess_os_to_meta_os;
1414
use driver::session;
1515
use metadata::loader::meta_section_name;
1616

17-
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
17+
pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
1818
return target_strs::t {
1919
module_asm: ~"",
2020

@@ -44,13 +44,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
4444
}
4545
},
4646

47-
target_triple: match target_os {
48-
session::os_macos => ~"i686-apple-darwin",
49-
session::os_win32 => ~"i686-pc-mingw32",
50-
session::os_linux => ~"i686-unknown-linux-gnu",
51-
session::os_android => ~"i686-unknown-android-gnu",
52-
session::os_freebsd => ~"i686-unknown-freebsd"
53-
},
47+
target_triple: target_triple,
5448

5549
cc_args: ~[~"-m32"]
5650
};

branches/try/src/librustc/back/x86_64.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use driver::session::sess_os_to_meta_os;
1414
use driver::session;
1515
use metadata::loader::meta_section_name;
1616

17-
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
17+
pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
1818
return target_strs::t {
1919
module_asm: ~"",
2020

@@ -52,13 +52,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
5252
}
5353
},
5454

55-
target_triple: match target_os {
56-
session::os_macos => ~"x86_64-apple-darwin",
57-
session::os_win32 => ~"x86_64-pc-mingw32",
58-
session::os_linux => ~"x86_64-unknown-linux-gnu",
59-
session::os_android => ~"x86_64-unknown-android-gnu",
60-
session::os_freebsd => ~"x86_64-unknown-freebsd",
61-
},
55+
target_triple: target_triple,
6256

6357
cc_args: ~[~"-m64"]
6458
};

branches/try/src/librustc/driver/driver.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,11 +570,12 @@ pub fn build_target_config(sopts: @session::options,
570570
abi::Arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
571571
abi::Mips => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
572572
};
573+
let target_triple = sopts.target_triple.clone();
573574
let target_strs = match arch {
574-
abi::X86 => x86::get_target_strs(os),
575-
abi::X86_64 => x86_64::get_target_strs(os),
576-
abi::Arm => arm::get_target_strs(os),
577-
abi::Mips => mips::get_target_strs(os)
575+
abi::X86 => x86::get_target_strs(target_triple, os),
576+
abi::X86_64 => x86_64::get_target_strs(target_triple, os),
577+
abi::Arm => arm::get_target_strs(target_triple, os),
578+
abi::Mips => mips::get_target_strs(target_triple, os)
578579
};
579580
let target_cfg = @session::config {
580581
os: os,

branches/try/src/librustc/metadata/decoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use middle::astencode::vtable_decoder_helpers;
2626

2727

2828
use std::hash::HashUtil;
29-
use std::uint;
29+
use std::u64;
3030
use std::io::WriterUtil;
3131
use std::io;
3232
use std::option;
@@ -207,9 +207,9 @@ fn each_reexport(d: ebml::Doc, f: &fn(ebml::Doc) -> bool) -> bool {
207207
reader::tagged_docs(d, tag_items_data_item_reexport, f)
208208
}
209209

210-
fn variant_disr_val(d: ebml::Doc) -> Option<uint> {
210+
fn variant_disr_val(d: ebml::Doc) -> Option<ty::Disr> {
211211
do reader::maybe_get_doc(d, tag_disr_val).chain |val_doc| {
212-
do reader::with_doc_data(val_doc) |data| { uint::parse_bytes(data, 10u) }
212+
do reader::with_doc_data(val_doc) |data| { u64::parse_bytes(data, 10u) }
213213
}
214214
}
215215

branches/try/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fn encode_symbol(ecx: &EncodeContext,
292292

293293
fn encode_disr_val(_: &EncodeContext,
294294
ebml_w: &mut writer::Encoder,
295-
disr_val: uint) {
295+
disr_val: ty::Disr) {
296296
ebml_w.start_tag(tag_disr_val);
297297
let s = disr_val.to_str();
298298
ebml_w.writer.write(s.as_bytes());

branches/try/src/librustc/middle/trans/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ pub enum VecLenOpt {
245245
// range)
246246
enum Opt {
247247
lit(Lit),
248-
var(/* disr val */ uint, @adt::Repr),
248+
var(ty::Disr, @adt::Repr),
249249
range(@ast::expr, @ast::expr),
250250
vec_len(/* length */ uint, VecLenOpt, /*range of matches*/(uint, uint))
251251
}
@@ -992,7 +992,7 @@ struct ExtractedBlock {
992992

993993
fn extract_variant_args(bcx: @mut Block,
994994
repr: &adt::Repr,
995-
disr_val: uint,
995+
disr_val: ty::Disr,
996996
val: ValueRef)
997997
-> ExtractedBlock {
998998
let _icx = push_ctxt("match::extract_variant_args");

0 commit comments

Comments
 (0)