Skip to content

Commit bba2b3e

Browse files
committed
---
yaml --- r: 78797 b: refs/heads/try c: 9d8897b h: refs/heads/master i: 78795: b3fd3ff v: v3
1 parent f68d262 commit bba2b3e

File tree

14 files changed

+243
-331
lines changed

14 files changed

+243
-331
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: 491bc3568c87dadaba4d342135bd308961c6e0ef
5+
refs/heads/try: 9d8897ba603b044a82a4cbcf97e5aadcb77ef661
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/configure

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ opt mingw-cross 0 "cross-compile for win32 using mingw"
381381
opt clang 0 "prefer clang to gcc for building the runtime"
382382
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
383383
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
384-
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched
385-
kernels)"
384+
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched kernels)"
386385
valopt prefix "/usr/local" "set installation prefix"
387386
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
388387
valopt llvm-root "" "set LLVM root"

branches/try/src/etc/emacs/rust-mode.el

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,27 @@ 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+
228251
;;; rust-mode.el ends here

branches/try/src/libextra/ebml.rs

Lines changed: 20 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313

1414
use std::str;
15-
use std::cast;
16-
use std::vec;
1715

1816
// Simple Extensible Binary Markup Language (ebml) reader and writer on a
1917
// cursor model. See the specification here:
@@ -31,42 +29,9 @@ struct EbmlState {
3129
data_pos: uint,
3230
}
3331

34-
#[deriving(Clone)]
35-
pub enum EbmlData {
36-
SafeData(@~[u8]),
37-
UnsafeData(*u8, uint)
38-
}
39-
40-
impl EbmlData {
41-
#[inline]
42-
pub fn slice<'a>(&'a self, start: uint, end: uint) -> &'a [u8] {
43-
match *self {
44-
SafeData(@ref v) => v.slice(start, end),
45-
UnsafeData(buf, len) => unsafe {
46-
do vec::raw::buf_as_slice(buf, len) |s| {
47-
cast::transmute(s.slice(start, end))
48-
}
49-
}
50-
}
51-
}
52-
53-
#[inline]
54-
pub fn as_slice<'a>(&'a self) -> &'a [u8] {
55-
self.slice(0, self.len())
56-
}
57-
58-
#[inline]
59-
pub fn len(&self) -> uint {
60-
match *self {
61-
SafeData(@ref v) => v.len(),
62-
UnsafeData(_, len) => len
63-
}
64-
}
65-
}
66-
6732
#[deriving(Clone)]
6833
pub struct Doc {
69-
data: EbmlData,
34+
data: @~[u8],
7035
start: uint,
7136
end: uint,
7237
}
@@ -220,28 +185,24 @@ pub mod reader {
220185
}
221186

222187
pub fn Doc(data: @~[u8]) -> Doc {
223-
Doc { data: SafeData(data), start: 0u, end: data.len() }
224-
}
225-
226-
pub fn unsafe_Doc(buf: *u8, len: uint) -> Doc {
227-
Doc { data: UnsafeData(buf, len), start: 0u, end: len }
188+
Doc { data: data, start: 0u, end: data.len() }
228189
}
229190

230-
pub fn doc_at(data: &EbmlData, start: uint) -> TaggedDoc {
231-
let elt_tag = vuint_at(data.as_slice(), start);
232-
let elt_size = vuint_at(data.as_slice(), elt_tag.next);
191+
pub fn doc_at(data: @~[u8], start: uint) -> TaggedDoc {
192+
let elt_tag = vuint_at(*data, start);
193+
let elt_size = vuint_at(*data, elt_tag.next);
233194
let end = elt_size.next + elt_size.val;
234195
TaggedDoc {
235196
tag: elt_tag.val,
236-
doc: Doc { data: data.clone(), start: elt_size.next, end: end }
197+
doc: Doc { data: data, start: elt_size.next, end: end }
237198
}
238199
}
239200

240201
pub fn maybe_get_doc(d: Doc, tg: uint) -> Option<Doc> {
241202
let mut pos = d.start;
242203
while pos < d.end {
243-
let elt_tag = vuint_at(d.data.as_slice(), pos);
244-
let elt_size = vuint_at(d.data.as_slice(), elt_tag.next);
204+
let elt_tag = vuint_at(*d.data, pos);
205+
let elt_size = vuint_at(*d.data, elt_tag.next);
245206
pos = elt_size.next + elt_size.val;
246207
if elt_tag.val == tg {
247208
return Some(Doc { data: d.data, start: elt_size.next,
@@ -264,8 +225,8 @@ pub mod reader {
264225
pub fn docs(d: Doc, it: &fn(uint, Doc) -> bool) -> bool {
265226
let mut pos = d.start;
266227
while pos < d.end {
267-
let elt_tag = vuint_at(d.data.as_slice(), pos);
268-
let elt_size = vuint_at(d.data.as_slice(), elt_tag.next);
228+
let elt_tag = vuint_at(*d.data, pos);
229+
let elt_size = vuint_at(*d.data, elt_tag.next);
269230
pos = elt_size.next + elt_size.val;
270231
let doc = Doc { data: d.data, start: elt_size.next, end: pos };
271232
if !it(elt_tag.val, doc) {
@@ -278,8 +239,8 @@ pub mod reader {
278239
pub fn tagged_docs(d: Doc, tg: uint, it: &fn(Doc) -> bool) -> bool {
279240
let mut pos = d.start;
280241
while pos < d.end {
281-
let elt_tag = vuint_at(d.data.as_slice(), pos);
282-
let elt_size = vuint_at(d.data.as_slice(), elt_tag.next);
242+
let elt_tag = vuint_at(*d.data, pos);
243+
let elt_size = vuint_at(*d.data, elt_tag.next);
283244
pos = elt_size.next + elt_size.val;
284245
if elt_tag.val == tg {
285246
let doc = Doc { data: d.data, start: elt_size.next,
@@ -299,22 +260,22 @@ pub mod reader {
299260

300261
pub fn doc_as_u8(d: Doc) -> u8 {
301262
assert_eq!(d.end, d.start + 1u);
302-
d.data.as_slice()[d.start]
263+
(*d.data)[d.start]
303264
}
304265

305266
pub fn doc_as_u16(d: Doc) -> u16 {
306267
assert_eq!(d.end, d.start + 2u);
307-
io::u64_from_be_bytes(d.data.as_slice(), d.start, 2u) as u16
268+
io::u64_from_be_bytes(*d.data, d.start, 2u) as u16
308269
}
309270

310271
pub fn doc_as_u32(d: Doc) -> u32 {
311272
assert_eq!(d.end, d.start + 4u);
312-
io::u64_from_be_bytes(d.data.as_slice(), d.start, 4u) as u32
273+
io::u64_from_be_bytes(*d.data, d.start, 4u) as u32
313274
}
314275

315276
pub fn doc_as_u64(d: Doc) -> u64 {
316277
assert_eq!(d.end, d.start + 8u);
317-
io::u64_from_be_bytes(d.data.as_slice(), d.start, 8u)
278+
io::u64_from_be_bytes(*d.data, d.start, 8u)
318279
}
319280

320281
pub fn doc_as_i8(d: Doc) -> i8 { doc_as_u8(d) as i8 }
@@ -337,7 +298,8 @@ pub mod reader {
337298
impl Decoder {
338299
fn _check_label(&mut self, lbl: &str) {
339300
if self.pos < self.parent.end {
340-
let TaggedDoc { tag: r_tag, doc: r_doc } = doc_at(&self.parent.data, self.pos);
301+
let TaggedDoc { tag: r_tag, doc: r_doc } =
302+
doc_at(self.parent.data, self.pos);
341303

342304
if r_tag == (EsLabel as uint) {
343305
self.pos = r_doc.end;
@@ -354,7 +316,8 @@ pub mod reader {
354316
if self.pos >= self.parent.end {
355317
fail!("no more documents in current node!");
356318
}
357-
let TaggedDoc { tag: r_tag, doc: r_doc } = doc_at(&self.parent.data, self.pos);
319+
let TaggedDoc { tag: r_tag, doc: r_doc } =
320+
doc_at(self.parent.data, self.pos);
358321
debug!("self.parent=%?-%? self.pos=%? r_tag=%? r_doc=%?-%?",
359322
self.parent.start,
360323
self.parent.end,

branches/try/src/libextra/getopts.rs

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

692-
// FIXME: #5516 should be graphemes not codepoints
692+
// FIXME: #5516
693693
// here we just need to indent the start of the description
694-
let rowlen = row.char_len();
694+
let rowlen = row.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 should be graphemes not codepoints
710+
// FIXME: #5516
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 should be graphemes not codepoints
717+
// FIXME: #5516
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.char_offset_iter().advance(|x| machine(x));
801+
ss.iter().enumerate().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,31 +1580,4 @@ 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-
}
16101583
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ pub fn build_session_options(binary: @str,
763763
parse_only: parse_only,
764764
no_trans: no_trans,
765765
debugging_opts: debugging_opts,
766-
android_cross_path: android_cross_path,
766+
android_cross_path: android_cross_path
767767
};
768768
return sopts;
769769
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use metadata::cstore;
1515
use metadata::decoder;
1616
use metadata::filesearch::FileSearch;
1717
use metadata::loader;
18-
use metadata::loader::MetadataSection;
1918

2019
use std::hashmap::HashMap;
2120
use syntax::ast;
@@ -309,7 +308,7 @@ fn resolve_crate(e: @mut Env,
309308
}
310309

311310
// Go through the crate metadata and load any crates that it references
312-
fn resolve_crate_deps(e: @mut Env, cdata: MetadataSection) -> cstore::cnum_map {
311+
fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map {
313312
debug!("resolving deps of external crate");
314313
// The map from crate numbers in the crate we're resolving to local crate
315314
// numbers

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub fn get_field_type(tcx: ty::ctxt, class_id: ast::def_id,
188188
def: ast::def_id) -> ty::ty_param_bounds_and_ty {
189189
let cstore = tcx.cstore;
190190
let cdata = cstore::get_crate_data(cstore, class_id.crate);
191-
let all_items = reader::get_doc(decoder::section_to_ebml_doc(cdata.data), tag_items);
191+
let all_items = reader::get_doc(reader::Doc(cdata.data), tag_items);
192192
debug!("Looking up %?", class_id);
193193
let class_doc = expect(tcx.diag,
194194
decoder::maybe_find_item(class_id.node, all_items),

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use metadata::cstore;
1717
use metadata::decoder;
18-
use metadata::loader::MetadataSection;
1918

2019
use std::hashmap::HashMap;
2120
use extra;
@@ -30,7 +29,7 @@ pub type cnum_map = @mut HashMap<ast::CrateNum, ast::CrateNum>;
3029

3130
pub struct crate_metadata {
3231
name: @str,
33-
data: MetadataSection,
32+
data: @~[u8],
3433
cnum_map: cnum_map,
3534
cnum: ast::CrateNum
3635
}

0 commit comments

Comments
 (0)