Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a

This commit is contained in:
Jack Moffitt 2014-11-05 12:33:11 -07:00 committed by Glenn Watson
parent 26045d7fcb
commit d1b433a3b3
160 changed files with 1427 additions and 1162 deletions

View file

@ -7,7 +7,7 @@ use servo_util::range;
use servo_util::range::{Range, RangeIndex, IntRangeIndex, EachIndex};
use servo_util::geometry::Au;
use std::cmp::{PartialOrd, PartialEq};
use std::cmp::PartialOrd;
use std::num::{NumCast, Zero};
use std::mem;
use std::u16;
@ -22,7 +22,7 @@ use geom::point::Point2D;
/// In the uncommon case (multiple glyphs per unicode character, large glyph index/advance, or
/// glyph offsets), we pack the glyph count into GlyphEntry, and store the other glyph information
/// in DetailedGlyphStore.
#[deriving(Clone)]
#[deriving(Clone, Show)]
struct GlyphEntry {
value: u32,
}
@ -251,7 +251,7 @@ impl GlyphEntry {
// Stores data for a detailed glyph, in the case that several glyphs
// correspond to one character, or the glyph's data couldn't be packed.
#[deriving(Clone)]
#[deriving(Clone, Show)]
struct DetailedGlyph {
id: GlyphId,
// glyph's advance, in the text's direction (RTL or RTL)
@ -270,7 +270,7 @@ impl DetailedGlyph {
}
}
#[deriving(PartialEq, Clone, Eq)]
#[deriving(PartialEq, Clone, Eq, Show)]
struct DetailedGlyphRecord {
// source string offset/GlyphEntry offset in the TextRun
entry_offset: CharIndex,
@ -319,7 +319,7 @@ impl<'a> DetailedGlyphStore {
detail_offset: self.detail_buffer.len() as int,
};
debug!("Adding entry[off={}] for detailed glyphs: {:?}", entry_offset, glyphs);
debug!("Adding entry[off={}] for detailed glyphs: {}", entry_offset, glyphs);
/* TODO: don't actually assert this until asserts are compiled
in/out based on severity, debug/release, etc. This assertion
@ -563,7 +563,7 @@ impl<'a> GlyphStore {
}
}.adapt_character_flags_of_entry(self.entry_buffer[i.to_uint()]);
*self.entry_buffer.get_mut(i.to_uint()) = entry;
self.entry_buffer[i.to_uint()] = entry;
}
pub fn add_glyphs_for_char_index(&mut self, i: CharIndex, data_for_glyphs: &[GlyphData]) {
@ -589,9 +589,9 @@ impl<'a> GlyphStore {
}
}.adapt_character_flags_of_entry(self.entry_buffer[i.to_uint()]);
debug!("Adding multiple glyphs[idx={}, count={}]: {:?}", i, glyph_count, entry);
debug!("Adding multiple glyphs[idx={}, count={}]: {}", i, glyph_count, entry);
*self.entry_buffer.get_mut(i.to_uint()) = entry;
self.entry_buffer[i.to_uint()] = entry;
}
// used when a character index has no associated glyph---for example, a ligature continuation.
@ -601,7 +601,7 @@ impl<'a> GlyphStore {
let entry = GlyphEntry::complex(cluster_start, ligature_start, 0);
debug!("adding spacer for chracter without associated glyph[idx={}]", i);
*self.entry_buffer.get_mut(i.to_uint()) = entry;
self.entry_buffer[i.to_uint()] = entry;
}
pub fn iter_glyphs_for_char_index(&'a self, i: CharIndex) -> GlyphIterator<'a> {
@ -611,10 +611,10 @@ impl<'a> GlyphStore {
#[inline]
pub fn iter_glyphs_for_char_range(&'a self, rang: &Range<CharIndex>) -> GlyphIterator<'a> {
if rang.begin() >= self.char_len() {
fail!("iter_glyphs_for_range: range.begin beyond length!");
panic!("iter_glyphs_for_range: range.begin beyond length!");
}
if rang.end() > self.char_len() {
fail!("iter_glyphs_for_range: range.end beyond length!");
panic!("iter_glyphs_for_range: range.end beyond length!");
}
GlyphIterator {
@ -666,25 +666,25 @@ impl<'a> GlyphStore {
pub fn set_char_is_space(&mut self, i: CharIndex) {
assert!(i < self.char_len());
let entry = self.entry_buffer[i.to_uint()];
*self.entry_buffer.get_mut(i.to_uint()) = entry.set_char_is_space();
self.entry_buffer[i.to_uint()] = entry.set_char_is_space();
}
pub fn set_char_is_tab(&mut self, i: CharIndex) {
assert!(i < self.char_len());
let entry = self.entry_buffer[i.to_uint()];
*self.entry_buffer.get_mut(i.to_uint()) = entry.set_char_is_tab();
self.entry_buffer[i.to_uint()] = entry.set_char_is_tab();
}
pub fn set_char_is_newline(&mut self, i: CharIndex) {
assert!(i < self.char_len());
let entry = self.entry_buffer[i.to_uint()];
*self.entry_buffer.get_mut(i.to_uint()) = entry.set_char_is_newline();
self.entry_buffer[i.to_uint()] = entry.set_char_is_newline();
}
pub fn set_can_break_before(&mut self, i: CharIndex, t: BreakType) {
assert!(i < self.char_len());
let entry = self.entry_buffer[i.to_uint()];
*self.entry_buffer.get_mut(i.to_uint()) = entry.set_can_break_before(t);
self.entry_buffer[i.to_uint()] = entry.set_can_break_before(t);
}
}

View file

@ -249,7 +249,7 @@ impl Shaper {
} else {
byte_to_glyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
for (i, _) in text.char_indices() {
*byte_to_glyph.get_mut(i) = NO_GLYPH;
byte_to_glyph[i] = NO_GLYPH;
}
}
@ -259,7 +259,7 @@ impl Shaper {
let loc = glyph_data.byte_offset_of_glyph(i);
if loc < byte_max {
assert!(byte_to_glyph[loc as uint] != CONTINUATION_BYTE);
*byte_to_glyph.get_mut(loc as uint) = i as i32;
byte_to_glyph[loc as uint] = i as i32;
} else {
debug!("ERROR: tried to set out of range byte_to_glyph: idx={}, glyph idx={}",
loc,
@ -271,7 +271,7 @@ impl Shaper {
debug!("text: {:s}", text);
debug!("(char idx): char->(glyph index):");
for (i, ch) in text.char_indices() {
debug!("{}: {} --> {:d}", i, ch, *byte_to_glyph.get(i) as int);
debug!("{}: {} --> {:d}", i, ch, *byte_to_glyph.get(i).unwrap() as int);
}
// some helpers

View file

@ -238,9 +238,9 @@ impl<'a> TextRun {
}
pub fn min_width_for_range(&self, range: &Range<CharIndex>) -> Au {
debug!("iterating outer range {:?}", range);
debug!("iterating outer range {}", range);
self.iter_slices_for_range(range).fold(Au(0), |max_piece_width, (_, offset, slice_range)| {
debug!("iterated on {:?}[{:?}]", offset, slice_range);
debug!("iterated on {}[{}]", offset, slice_range);
Au::max(max_piece_width, self.advance_for_range(&slice_range))
})
}

View file

@ -48,7 +48,7 @@ pub fn transform_text(text: &str,
if ch != '\n' {
new_line_index = new_line_index + CharIndex(1);
}
output_text.push_char(ch);
output_text.push(ch);
}
}
text.len() > 0 && is_in_whitespace(text.char_at_reverse(0), mode)
@ -67,14 +67,14 @@ pub fn transform_text(text: &str,
// TODO: record skipped char
} else {
// TODO: record kept char
output_text.push_char(ch);
output_text.push(ch);
}
} else { /* next_in_whitespace; possibly add a space char */
if in_whitespace {
// TODO: record skipped char
} else {
// TODO: record kept char
output_text.push_char(' ');
output_text.push(' ');
}
}
// save whitespace context for next char