Skip to content

Commit b8bb182

Browse files
committed
---
yaml --- r: 77647 b: refs/heads/master c: 36d698d h: refs/heads/master i: 77645: 279024a 77643: 77eb1f4 77639: 4c07dde 77631: 1d79d6e v: v3
1 parent 7b9591a commit b8bb182

File tree

4 files changed

+44
-54
lines changed

4 files changed

+44
-54
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: fe7092dafb83e7d541aa06095342252dc02c2d5d
2+
refs/heads/master: 36d698d544953c7fc03a8bf10ea9423e47732ab8
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 60fba4d7d677ec098e6a43014132fe99f7547363
55
refs/heads/try: ebfe63cd1c0b5d23f7ea60c69b4fde2e30cfd42a

trunk/src/etc/emacs/rust-mode.el

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -225,27 +225,4 @@ The initializer is `DEFAULT-TAB-WIDTH'.")
225225

226226
(provide 'rust-mode)
227227

228-
;; Issue #6887: Rather than inheriting the 'gnu compilation error
229-
;; regexp (which is broken on a few edge cases), add our own 'rust
230-
;; compilation error regexp and use it instead.
231-
(defvar rustc-compilation-regexps
232-
(let ((file "\\([^ \n]+\\)")
233-
(start-line "\\([0-9]+\\)")
234-
(start-col "\\([0-9]+\\)")
235-
(end-line "\\([0-9]+\\)")
236-
(end-col "\\([0-9]+\\)")
237-
(error-or-warning "\\(?:[Ee]rror\\|\\([Ww]arning\\)\\)"))
238-
(let ((re (concat "^" file ":" start-line ":" start-col
239-
": " end-line ":" end-col
240-
" \\(?:[Ee]rror\\|\\([Ww]arning\\)\\):")))
241-
(cons re '(1 (2 . 4) (3 . 5) (6)))))
242-
"Specifications for matching errors in rustc invocations.
243-
See `compilation-error-regexp-alist for help on their format.")
244-
245-
(eval-after-load 'compile
246-
'(progn
247-
(add-to-list 'compilation-error-regexp-alist-alist
248-
(cons 'rustc rustc-compilation-regexps))
249-
(add-to-list 'compilation-error-regexp-alist 'rustc)))
250-
251228
;;; rust-mode.el ends here

trunk/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
}

trunk/src/libextra/num/bigint.rs

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,26 @@ A BigDigit is a BigUint's composing element.
3232
3333
A BigDigit is half the size of machine word size.
3434
*/
35-
#[cfg(target_arch = "x86")]
36-
#[cfg(target_arch = "arm")]
37-
#[cfg(target_arch = "mips")]
35+
#[cfg(target_word_size = "32")]
3836
pub type BigDigit = u16;
3937

4038
/**
4139
A BigDigit is a BigUint's composing element.
4240
4341
A BigDigit is half the size of machine word size.
4442
*/
45-
#[cfg(target_arch = "x86_64")]
43+
#[cfg(target_word_size = "64")]
4644
pub type BigDigit = u32;
4745

4846
pub static ZERO_BIG_DIGIT: BigDigit = 0;
4947

5048
pub mod BigDigit {
5149
use bigint::BigDigit;
5250

53-
#[cfg(target_arch = "x86")]
54-
#[cfg(target_arch = "arm")]
55-
#[cfg(target_arch = "mips")]
51+
#[cfg(target_word_size = "32")]
5652
pub static bits: uint = 16;
5753

58-
#[cfg(target_arch = "x86_64")]
54+
#[cfg(target_word_size = "64")]
5955
pub static bits: uint = 32;
6056

6157
pub static base: uint = 1 << bits;
@@ -659,8 +655,7 @@ impl BigUint {
659655
}
660656
}
661657

662-
#[cfg(target_arch = "x86_64")]
663-
658+
#[cfg(target_word_size = "64")]
664659
fn get_radix_base(radix: uint) -> (uint, uint) {
665660
assert!(1 < radix && radix <= 16);
666661
match radix {
@@ -683,10 +678,7 @@ fn get_radix_base(radix: uint) -> (uint, uint) {
683678
}
684679
}
685680

686-
#[cfg(target_arch = "arm")]
687-
#[cfg(target_arch = "x86")]
688-
#[cfg(target_arch = "mips")]
689-
681+
#[cfg(target_word_size = "32")]
690682
fn get_radix_base(radix: uint) -> (uint, uint) {
691683
assert!(1 < radix && radix <= 16);
692684
match radix {
@@ -1233,7 +1225,7 @@ mod biguint_tests {
12331225
12341226
test_shl_bits();
12351227
1236-
#[cfg(target_arch = "x86_64")]
1228+
#[cfg(target_word_size = "64")]
12371229
fn test_shl_bits() {
12381230
check(~[0x7654_3210, 0xfedc_ba98,
12391231
0x7654_3210, 0xfedc_ba98], 4,
@@ -1245,9 +1237,7 @@ mod biguint_tests {
12451237
0x5555_4444, 0x7777_6666, 0x8888]);
12461238
}
12471239

1248-
#[cfg(target_arch = "arm")]
1249-
#[cfg(target_arch = "x86")]
1250-
#[cfg(target_arch = "mips")]
1240+
#[cfg(target_word_size = "32")]
12511241
fn test_shl_bits() {
12521242
check(~[0x3210, 0x7654, 0xba98, 0xfedc,
12531243
0x3210, 0x7654, 0xba98, 0xfedc], 4,
@@ -1262,9 +1252,7 @@ mod biguint_tests {
12621252
}
12631253

12641254
#[test]
1265-
#[ignore(cfg(target_arch = "x86"))]
1266-
#[ignore(cfg(target_arch = "arm"))]
1267-
#[ignore(cfg(target_arch = "mips"))]
1255+
#[ignore(cfg(target_word_size = "32"))]
12681256
fn test_shr() {
12691257
fn check(v: ~[BigDigit], shift: uint, ans: ~[BigDigit]) {
12701258
assert_eq!(BigUint::new(v) >> shift, BigUint::new(ans));
@@ -1279,7 +1267,7 @@ mod biguint_tests {
12791267
check(~[0, 1], 1, ~[0x80000000]);
12801268
test_shr_bits();
12811269

1282-
#[cfg(target_arch = "x86_64")]
1270+
#[cfg(target_word_size = "64")]
12831271
fn test_shr_bits() {
12841272
check(~[0x6543_2100, 0xedcb_a987,
12851273
0x6543_210f, 0xedcb_a987, 0xf], 4,
@@ -1291,9 +1279,7 @@ mod biguint_tests {
12911279
0x6666_5555, 0x8888_7777]);
12921280
}
12931281

1294-
#[cfg(target_arch = "arm")]
1295-
#[cfg(target_arch = "x86")]
1296-
#[cfg(target_arch = "mips")]
1282+
#[cfg(target_word_size = "32")]
12971283
fn test_shr_bits() {
12981284
check(~[0x2100, 0x6543, 0xa987, 0xedcb,
12991285
0x210f, 0x6543, 0xa987, 0xedcb, 0xf], 4,

0 commit comments

Comments
 (0)