Skip to content

Commit 96e708a

Browse files
committed
---
yaml --- r: 188405 b: refs/heads/tmp c: 2417273 h: refs/heads/master i: 188403: 8e790c1 v: v3
1 parent 8fcac43 commit 96e708a

File tree

25 files changed

+204
-719
lines changed

25 files changed

+204
-719
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 522d09dfecbeca1595f25ac58c6d0178bbd21d7d
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: 3b3bb0e682c2d252e9f62dd9df5cff9552af91ad
37+
refs/heads/tmp: 241727326ebccd5ae40557b36f35317df25b3150
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/tmp/src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#![feature(unboxed_closures)]
7474
#![feature(unsafe_no_drop_flag)]
7575
#![feature(core)]
76+
#![feature(unique)]
7677
#![cfg_attr(test, feature(test, alloc, rustc_private))]
7778
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
7879
feature(libc))]

branches/tmp/src/libcollections/slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,8 +2176,8 @@ mod tests {
21762176
fn test_connect() {
21772177
let v: [Vec<i32>; 0] = [];
21782178
assert_eq!(v.connect(&0), []);
2179-
assert_eq!([vec![1], vec![2, 3]].connect(&0), [1, 0, 2, 3]);
2180-
assert_eq!([vec![1], vec![2], vec![3]].connect(&0), [1, 0, 2, 0, 3]);
2179+
assert_eq!([vec![1i], vec![2, 3]].connect(&0), [1, 0, 2, 3]);
2180+
assert_eq!([vec![1i], vec![2], vec![3]].connect(&0), [1, 0, 2, 0, 3]);
21812181

21822182
let v: [&[_]; 2] = [&[1], &[2, 3]];
21832183
assert_eq!(v.connect(&0), [1, 0, 2, 3]);

branches/tmp/src/libcoretest/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct CustomHasher { output: u64 }
8686

8787
impl Hasher for CustomHasher {
8888
fn finish(&self) -> u64 { self.output }
89-
fn write(&mut self, _: &[u8]) { panic!() }
89+
fn write(&mut self, data: &[u8]) { panic!() }
9090
fn write_u64(&mut self, data: u64) { self.output = data; }
9191
}
9292

branches/tmp/src/libcoretest/str.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,15 @@ fn trim_ws() {
188188

189189
mod pattern {
190190
use std::str::Pattern;
191-
use std::str::{Searcher, ReverseSearcher};
191+
use std::str::{Searcher, ReverseSearcher, DoubleEndedSearcher};
192192
use std::str::SearchStep::{self, Match, Reject, Done};
193193

194194
macro_rules! make_test {
195195
($name:ident, $p:expr, $h:expr, [$($e:expr,)*]) => {
196196
mod $name {
197-
use std::str::SearchStep::{Match, Reject};
197+
use std::str::Pattern;
198+
use std::str::{Searcher, ReverseSearcher, DoubleEndedSearcher};
199+
use std::str::SearchStep::{self, Match, Reject, Done};
198200
use super::{cmp_search_to_vec};
199201
#[test]
200202
fn fwd() {

branches/tmp/src/librand/rand_impls.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ impl<T:Rand> Rand for Option<T> {
214214

215215
#[cfg(test)]
216216
mod tests {
217+
use std::prelude::v1::*;
217218
use std::rand::{Rng, thread_rng, Open01, Closed01};
218219

219220
struct ConstantRng(u64);

branches/tmp/src/librbml/io.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,32 +140,32 @@ mod tests {
140140
fn test_seekable_mem_writer() {
141141
let mut writer = SeekableMemWriter::new();
142142
assert_eq!(writer.tell(), Ok(0));
143-
writer.write_all(&[0]).unwrap();
143+
writer.write(&[0]).unwrap();
144144
assert_eq!(writer.tell(), Ok(1));
145-
writer.write_all(&[1, 2, 3]).unwrap();
146-
writer.write_all(&[4, 5, 6, 7]).unwrap();
145+
writer.write(&[1, 2, 3]).unwrap();
146+
writer.write(&[4, 5, 6, 7]).unwrap();
147147
assert_eq!(writer.tell(), Ok(8));
148148
let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
149149
assert_eq!(writer.get_ref(), b);
150150

151151
writer.seek(0, old_io::SeekSet).unwrap();
152152
assert_eq!(writer.tell(), Ok(0));
153-
writer.write_all(&[3, 4]).unwrap();
153+
writer.write(&[3, 4]).unwrap();
154154
let b: &[_] = &[3, 4, 2, 3, 4, 5, 6, 7];
155155
assert_eq!(writer.get_ref(), b);
156156

157157
writer.seek(1, old_io::SeekCur).unwrap();
158-
writer.write_all(&[0, 1]).unwrap();
158+
writer.write(&[0, 1]).unwrap();
159159
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7];
160160
assert_eq!(writer.get_ref(), b);
161161

162162
writer.seek(-1, old_io::SeekEnd).unwrap();
163-
writer.write_all(&[1, 2]).unwrap();
163+
writer.write(&[1, 2]).unwrap();
164164
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2];
165165
assert_eq!(writer.get_ref(), b);
166166

167167
writer.seek(1, old_io::SeekEnd).unwrap();
168-
writer.write_all(&[1]).unwrap();
168+
writer.write(&[1]).unwrap();
169169
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1];
170170
assert_eq!(writer.get_ref(), b);
171171
}
@@ -174,7 +174,7 @@ mod tests {
174174
fn seek_past_end() {
175175
let mut r = SeekableMemWriter::new();
176176
r.seek(10, old_io::SeekSet).unwrap();
177-
assert!(r.write_all(&[3]).is_ok());
177+
assert!(r.write(&[3]).is_ok());
178178
}
179179

180180
#[test]
@@ -190,7 +190,7 @@ mod tests {
190190
b.iter(|| {
191191
let mut wr = SeekableMemWriter::new();
192192
for _ in 0..times {
193-
wr.write_all(&src).unwrap();
193+
wr.write(&src).unwrap();
194194
}
195195

196196
let v = wr.unwrap();

branches/tmp/src/librustc/metadata/common.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,3 @@ pub const tag_macro_def: uint = 0x9e;
252252
pub const tag_macro_def_body: uint = 0x9f;
253253

254254
pub const tag_paren_sugar: uint = 0xa0;
255-
256-
pub const tag_codemap: uint = 0xa1;
257-
pub const tag_codemap_filemap: uint = 0xa2;

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

Lines changed: 3 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use syntax::ast;
2626
use syntax::abi;
2727
use syntax::attr;
2828
use syntax::attr::AttrMetaMethods;
29-
use syntax::codemap::{self, Span, mk_sp, Pos};
29+
use syntax::codemap::{Span, mk_sp};
3030
use syntax::parse;
3131
use syntax::parse::token::InternedString;
3232
use syntax::parse::token;
@@ -373,17 +373,15 @@ impl<'a> CrateReader<'a> {
373373
// Maintain a reference to the top most crate.
374374
let root = if root.is_some() { root } else { &crate_paths };
375375

376-
let loader::Library { dylib, rlib, metadata } = lib;
376+
let cnum_map = self.resolve_crate_deps(root, lib.metadata.as_slice(), span);
377377

378-
let cnum_map = self.resolve_crate_deps(root, metadata.as_slice(), span);
379-
let codemap_import_info = import_codemap(self.sess.codemap(), &metadata);
378+
let loader::Library{ dylib, rlib, metadata } = lib;
380379

381380
let cmeta = Rc::new( cstore::crate_metadata {
382381
name: name.to_string(),
383382
data: metadata,
384383
cnum_map: cnum_map,
385384
cnum: cnum,
386-
codemap_import_info: codemap_import_info,
387385
span: span,
388386
});
389387

@@ -588,131 +586,3 @@ impl<'a> CrateReader<'a> {
588586
}
589587
}
590588
}
591-
592-
/// Imports the codemap from an external crate into the codemap of the crate
593-
/// currently being compiled (the "local crate").
594-
///
595-
/// The import algorithm works analogous to how AST items are inlined from an
596-
/// external crate's metadata:
597-
/// For every FileMap in the external codemap an 'inline' copy is created in the
598-
/// local codemap. The correspondence relation between external and local
599-
/// FileMaps is recorded in the `ImportedFileMap` objects returned from this
600-
/// function. When an item from an external crate is later inlined into this
601-
/// crate, this correspondence information is used to translate the span
602-
/// information of the inlined item so that it refers the correct positions in
603-
/// the local codemap (see `astencode::DecodeContext::tr_span()`).
604-
///
605-
/// The import algorithm in the function below will reuse FileMaps already
606-
/// existing in the local codemap. For example, even if the FileMap of some
607-
/// source file of libstd gets imported many times, there will only ever be
608-
/// one FileMap object for the corresponding file in the local codemap.
609-
///
610-
/// Note that imported FileMaps do not actually contain the source code of the
611-
/// file they represent, just information about length, line breaks, and
612-
/// multibyte characters. This information is enough to generate valid debuginfo
613-
/// for items inlined from other crates.
614-
fn import_codemap(local_codemap: &codemap::CodeMap,
615-
metadata: &MetadataBlob)
616-
-> Vec<cstore::ImportedFileMap> {
617-
let external_codemap = decoder::get_imported_filemaps(metadata.as_slice());
618-
619-
let imported_filemaps = external_codemap.into_iter().map(|filemap_to_import| {
620-
// Try to find an existing FileMap that can be reused for the filemap to
621-
// be imported. A FileMap is reusable if it is exactly the same, just
622-
// positioned at a different offset within the codemap.
623-
let reusable_filemap = {
624-
local_codemap.files
625-
.borrow()
626-
.iter()
627-
.find(|fm| are_equal_modulo_startpos(&fm, &filemap_to_import))
628-
.map(|rc| rc.clone())
629-
};
630-
631-
match reusable_filemap {
632-
Some(fm) => {
633-
cstore::ImportedFileMap {
634-
original_start_pos: filemap_to_import.start_pos,
635-
original_end_pos: filemap_to_import.end_pos,
636-
translated_filemap: fm
637-
}
638-
}
639-
None => {
640-
// We can't reuse an existing FileMap, so allocate a new one
641-
// containing the information we need.
642-
let codemap::FileMap {
643-
name,
644-
start_pos,
645-
end_pos,
646-
lines,
647-
multibyte_chars,
648-
..
649-
} = filemap_to_import;
650-
651-
let source_length = (end_pos - start_pos).to_usize();
652-
653-
// Translate line-start positions and multibyte character
654-
// position into frame of reference local to file.
655-
// `CodeMap::new_imported_filemap()` will then translate those
656-
// coordinates to their new global frame of reference when the
657-
// offset of the FileMap is known.
658-
let lines = lines.into_inner().map_in_place(|pos| pos - start_pos);
659-
let multibyte_chars = multibyte_chars
660-
.into_inner()
661-
.map_in_place(|mbc|
662-
codemap::MultiByteChar {
663-
pos: mbc.pos + start_pos,
664-
bytes: mbc.bytes
665-
});
666-
667-
let local_version = local_codemap.new_imported_filemap(name,
668-
source_length,
669-
lines,
670-
multibyte_chars);
671-
cstore::ImportedFileMap {
672-
original_start_pos: start_pos,
673-
original_end_pos: end_pos,
674-
translated_filemap: local_version
675-
}
676-
}
677-
}
678-
}).collect();
679-
680-
return imported_filemaps;
681-
682-
fn are_equal_modulo_startpos(fm1: &codemap::FileMap,
683-
fm2: &codemap::FileMap)
684-
-> bool {
685-
if fm1.name != fm2.name {
686-
return false;
687-
}
688-
689-
let lines1 = fm1.lines.borrow();
690-
let lines2 = fm2.lines.borrow();
691-
692-
if lines1.len() != lines2.len() {
693-
return false;
694-
}
695-
696-
for (&line1, &line2) in lines1.iter().zip(lines2.iter()) {
697-
if (line1 - fm1.start_pos) != (line2 - fm2.start_pos) {
698-
return false;
699-
}
700-
}
701-
702-
let multibytes1 = fm1.multibyte_chars.borrow();
703-
let multibytes2 = fm2.multibyte_chars.borrow();
704-
705-
if multibytes1.len() != multibytes2.len() {
706-
return false;
707-
}
708-
709-
for (mb1, mb2) in multibytes1.iter().zip(multibytes2.iter()) {
710-
if (mb1.bytes != mb2.bytes) ||
711-
((mb1.pos - fm1.start_pos) != (mb2.pos - fm2.start_pos)) {
712-
return false;
713-
}
714-
}
715-
716-
true
717-
}
718-
}

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use std::cell::RefCell;
2727
use std::rc::Rc;
2828
use flate::Bytes;
2929
use syntax::ast;
30-
use syntax::codemap;
30+
use syntax::codemap::Span;
3131
use syntax::parse::token::IdentInterner;
3232

3333
// A map from external crate numbers (as decoded from some crate file) to
@@ -41,24 +41,12 @@ pub enum MetadataBlob {
4141
MetadataArchive(loader::ArchiveMetadata),
4242
}
4343

44-
/// Holds information about a codemap::FileMap imported from another crate.
45-
/// See creader::import_codemap() for more information.
46-
pub struct ImportedFileMap {
47-
/// This FileMap's byte-offset within the codemap of its original crate
48-
pub original_start_pos: codemap::BytePos,
49-
/// The end of this FileMap within the codemap of its original crate
50-
pub original_end_pos: codemap::BytePos,
51-
/// The imported FileMap's representation within the local codemap
52-
pub translated_filemap: Rc<codemap::FileMap>
53-
}
54-
5544
pub struct crate_metadata {
5645
pub name: String,
5746
pub data: MetadataBlob,
5847
pub cnum_map: cnum_map,
5948
pub cnum: ast::CrateNum,
60-
pub codemap_import_info: Vec<ImportedFileMap>,
61-
pub span: codemap::Span,
49+
pub span: Span,
6250
}
6351

6452
#[derive(Copy, Debug, PartialEq, Clone)]

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,26 +1561,11 @@ pub fn is_associated_type(cdata: Cmd, id: ast::NodeId) -> bool {
15611561
}
15621562
}
15631563

1564+
15641565
pub fn is_default_trait<'tcx>(cdata: Cmd, id: ast::NodeId) -> bool {
15651566
let item_doc = lookup_item(id, cdata.data());
15661567
match item_family(item_doc) {
15671568
Family::DefaultImpl => true,
15681569
_ => false
15691570
}
15701571
}
1571-
1572-
pub fn get_imported_filemaps(metadata: &[u8]) -> Vec<codemap::FileMap> {
1573-
let crate_doc = rbml::Doc::new(metadata);
1574-
let cm_doc = reader::get_doc(crate_doc, tag_codemap);
1575-
1576-
let mut filemaps = vec![];
1577-
1578-
reader::tagged_docs(cm_doc, tag_codemap_filemap, |filemap_doc| {
1579-
let mut decoder = reader::Decoder::new(filemap_doc);
1580-
let filemap: codemap::FileMap = Decodable::decode(&mut decoder).unwrap();
1581-
filemaps.push(filemap);
1582-
true
1583-
});
1584-
1585-
return filemaps;
1586-
}

0 commit comments

Comments
 (0)