Skip to content

Commit ab6a565

Browse files
committed
---
yaml --- r: 77215 b: refs/heads/snap-stage3 c: df66441 h: refs/heads/master i: 77213: f4cccde 77211: a9c8dc7 77207: aa56440 77199: 36f29a5 77183: 0d6f51b v: v3
1 parent e5780f6 commit ab6a565

File tree

16 files changed

+520
-574
lines changed

16 files changed

+520
-574
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: f1132496dddbdd88f321a7919eec3d65136b3f75
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 413f868220e0ccd5fcc728be5ebde1f8e4eabf19
4+
refs/heads/snap-stage3: df6644104e689900d49b5709da295dc4cba9485f
55
refs/heads/try: ebfe63cd1c0b5d23f7ea60c69b4fde2e30cfd42a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/src/librustc/metadata/creader.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use syntax::codemap::{span, dummy_sp};
2525
use syntax::diagnostic::span_handler;
2626
use syntax::parse::token;
2727
use syntax::parse::token::ident_interner;
28-
use syntax::oldvisit;
28+
use syntax::visit;
2929

3030
// Traverses an AST, reading all the information about use'd crates and extern
3131
// libraries necessary for later resolving, typechecking, linking, etc.
@@ -46,17 +46,25 @@ pub fn read_crates(diag: @mut span_handler,
4646
next_crate_num: 1,
4747
intr: intr
4848
};
49-
let v =
50-
oldvisit::mk_simple_visitor(@oldvisit::SimpleVisitor {
51-
visit_view_item: |a| visit_view_item(e, a),
52-
visit_item: |a| visit_item(e, a),
53-
.. *oldvisit::default_simple_visitor()});
49+
let mut v = ReadCrateVisitor{ e:e };
5450
visit_crate(e, crate);
55-
oldvisit::visit_crate(crate, ((), v));
51+
visit::walk_crate(&mut v, crate, ());
5652
dump_crates(*e.crate_cache);
5753
warn_if_multiple_versions(e, diag, *e.crate_cache);
5854
}
5955

56+
struct ReadCrateVisitor { e:@mut Env }
57+
impl visit::Visitor<()> for ReadCrateVisitor {
58+
fn visit_view_item(&mut self, a:&ast::view_item, _:()) {
59+
visit_view_item(self.e, a);
60+
visit::walk_view_item(self, a, ());
61+
}
62+
fn visit_item(&mut self, a:@ast::item, _:()) {
63+
visit_item(self.e, a);
64+
visit::walk_item(self, a, ());
65+
}
66+
}
67+
6068
#[deriving(Clone)]
6169
struct cache_entry {
6270
cnum: int,

branches/snap-stage3/src/librustc/middle/lint.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use syntax::visit::Visitor;
5656
* lint attributes.
5757
*
5858
* At each node of the ast which can modify lint attributes, all known lint
59-
* passes are also applied. Each lint pass is an oldvisit::vt<()> structure.
59+
* passes are also applied. Each lint pass is a visit::Visitor implementator.
6060
* The visitors are constructed via the lint_*() functions below. There are
6161
* also some lint checks which operate directly on ast nodes (such as
6262
* @ast::item), and those are organized as check_item_*(). Each visitor added
@@ -508,7 +508,7 @@ impl Context {
508508
}
509509
}
510510

511-
fn add_oldvisit_lint(&mut self, v: @mut OuterLint) {
511+
fn add_old_lint(&mut self, v: @mut OuterLint) {
512512
self.visitors.push(OldVisitor(v, v.inner_variant()));
513513
}
514514

@@ -547,7 +547,7 @@ impl Context {
547547
}
548548
}
549549
}
550-
// Can't use oldvisit::visit_method_helper because the
550+
// Can't use visit::walk_method_helper because the
551551
// item_stopping_visitor has overridden visit_fn(&fk_method(... ))
552552
// to be a no-op, so manually invoke visit_fn.
553553
Method(m) => {
@@ -1450,14 +1450,14 @@ pub fn check_crate(tcx: ty::ctxt, crate: @ast::Crate) {
14501450
}
14511451

14521452
// Register each of the lint passes with the context
1453-
cx.add_oldvisit_lint(lint_while_true());
1454-
cx.add_oldvisit_lint(lint_path_statement());
1455-
cx.add_oldvisit_lint(lint_heap());
1456-
cx.add_oldvisit_lint(lint_type_limits());
1457-
cx.add_oldvisit_lint(lint_unused_unsafe());
1458-
cx.add_oldvisit_lint(lint_unused_mut());
1459-
cx.add_oldvisit_lint(lint_unnecessary_allocations());
1460-
cx.add_oldvisit_lint(lint_missing_doc());
1453+
cx.add_old_lint(lint_while_true());
1454+
cx.add_old_lint(lint_path_statement());
1455+
cx.add_old_lint(lint_heap());
1456+
cx.add_old_lint(lint_type_limits());
1457+
cx.add_old_lint(lint_unused_unsafe());
1458+
cx.add_old_lint(lint_unused_mut());
1459+
cx.add_old_lint(lint_unnecessary_allocations());
1460+
cx.add_old_lint(lint_missing_doc());
14611461
cx.add_lint(lint_session(cx));
14621462

14631463
// Actually perform the lint checks (iterating the ast)

0 commit comments

Comments
 (0)