Remove a large amount of deprecated functionality

Spring cleaning is here! In the Fall! This commit removes quite a large amount
of deprecated functionality from the standard libraries. I tried to ensure that
only old deprecated functionality was removed.

This is removing lots and lots of deprecated features, so this is a breaking
change. Please consult the deprecation messages of the deleted code to see how
to migrate code forward if it still needs migration.

[breaking-change]
This commit is contained in:
Alex Crichton
2014-10-14 23:05:01 -07:00
parent fb169d5543
commit 9d5d97b55d
342 changed files with 1352 additions and 4266 deletions

View File

@@ -283,9 +283,9 @@ impl FileMap {
/// filemap.start_pos + newline_offset_relative_to_the_start_of_filemap.
pub fn next_line(&self, pos: BytePos) {
// the new charpos must be > the last one (or it's the first one).
let mut lines = self.lines.borrow_mut();;
let mut lines = self.lines.borrow_mut();
let line_len = lines.len();
assert!(line_len == 0 || (*lines.get(line_len - 1) < pos))
assert!(line_len == 0 || ((*lines)[line_len - 1] < pos))
lines.push(pos);
}
@@ -293,7 +293,7 @@ impl FileMap {
///
pub fn get_line(&self, line: int) -> String {
let lines = self.lines.borrow();
let begin: BytePos = *lines.get(line as uint) - self.start_pos;
let begin: BytePos = (*lines)[line as uint] - self.start_pos;
let begin = begin.to_uint();
let slice = self.src.as_slice().slice_from(begin);
match slice.find('\n') {
@@ -351,7 +351,7 @@ impl CodeMap {
// overflowing into the next filemap in case the last byte of span is also the last
// byte of filemap, which leads to incorrect results from CodeMap.span_to_*.
if src.len() > 0 && !src.as_slice().ends_with("\n") {
src.push_char('\n');
src.push('\n');
}
let filemap = Rc::new(FileMap {
@@ -446,7 +446,7 @@ impl CodeMap {
pub fn lookup_byte_offset(&self, bpos: BytePos) -> FileMapAndBytePos {
let idx = self.lookup_filemap_idx(bpos);
let fm = self.files.borrow().get(idx).clone();
let fm = (*self.files.borrow())[idx].clone();
let offset = bpos - fm.start_pos;
FileMapAndBytePos {fm: fm, pos: offset}
}
@@ -455,7 +455,7 @@ impl CodeMap {
pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
let idx = self.lookup_filemap_idx(bpos);
let files = self.files.borrow();
let map = files.get(idx);
let map = &(*files)[idx];
// The number of extra bytes due to multibyte chars in the FileMap
let mut total_extra_bytes = 0;
@@ -480,34 +480,37 @@ impl CodeMap {
fn lookup_filemap_idx(&self, pos: BytePos) -> uint {
let files = self.files.borrow();
let files = files;
let files = &*files;
let len = files.len();
let mut a = 0u;
let mut b = len;
while b - a > 1u {
let m = (a + b) / 2u;
if files.get(m).start_pos > pos {
if files[m].start_pos > pos {
b = m;
} else {
a = m;
}
}
// There can be filemaps with length 0. These have the same start_pos as the previous
// filemap, but are not the filemaps we want (because they are length 0, they cannot
// contain what we are looking for). So, rewind until we find a useful filemap.
// There can be filemaps with length 0. These have the same start_pos as
// the previous filemap, but are not the filemaps we want (because they
// are length 0, they cannot contain what we are looking for). So,
// rewind until we find a useful filemap.
loop {
let lines = files.get(a).lines.borrow();
let lines = files[a].lines.borrow();
let lines = lines;
if lines.len() > 0 {
break;
}
if a == 0 {
fail!("position {} does not resolve to a source location", pos.to_uint());
fail!("position {} does not resolve to a source location",
pos.to_uint());
}
a -= 1;
}
if a >= len {
fail!("position {} does not resolve to a source location", pos.to_uint())
fail!("position {} does not resolve to a source location",
pos.to_uint())
}
return a;
@@ -517,14 +520,14 @@ impl CodeMap {
let idx = self.lookup_filemap_idx(pos);
let files = self.files.borrow();
let f = files.get(idx).clone();
let f = (*files)[idx].clone();
let mut a = 0u;
{
let lines = f.lines.borrow();
let mut b = lines.len();
while b - a > 1u {
let m = (a + b) / 2u;
if *lines.get(m) > pos { b = m; } else { a = m; }
if (*lines)[m] > pos { b = m; } else { a = m; }
}
}
FileMapAndLine {fm: f, line: a}
@@ -534,7 +537,7 @@ impl CodeMap {
let FileMapAndLine {fm: f, line: a} = self.lookup_line(pos);
let line = a + 1u; // Line numbers start at 1
let chpos = self.bytepos_to_file_charpos(pos);
let linebpos = *f.lines.borrow().get(a);
let linebpos = (*f.lines.borrow())[a];
let linechpos = self.bytepos_to_file_charpos(linebpos);
debug!("byte pos {} is on the line at byte pos {}",
pos, linebpos);
@@ -704,7 +707,7 @@ mod test {
assert_eq!(file_lines.file.name, "blork.rs".to_string());
assert_eq!(file_lines.lines.len(), 1);
assert_eq!(*file_lines.lines.get(0), 1u);
assert_eq!(file_lines.lines[0], 1u);
}
#[test]