Skip to content

Commit

Permalink
Upgrade to rustc 0.12.0-pre (4d2af3861 2014-09-17 15:51:11 +0000)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcallister committed Sep 20, 2014
1 parent 8a7eefe commit a640a7c
Show file tree
Hide file tree
Showing 74 changed files with 460 additions and 450 deletions.
244 changes: 126 additions & 118 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion components/compositing/compositor.rs
Expand Up @@ -22,6 +22,7 @@ use windowing::PinchZoomWindowEvent;
use azure::azure_hl::SourceSurfaceMethods;
use azure::azure_hl;
use std::cmp;
use std::time::duration::Duration;
use geom::point::{Point2D, TypedPoint2D};
use geom::rect::Rect;
use geom::size::TypedSize2D;
Expand Down Expand Up @@ -223,7 +224,7 @@ impl IOCompositor {
self.composite();
}

sleep(10);
sleep(Duration::milliseconds(10));

// If a pinch-zoom happened recently, ask for tiles at the new resolution
if self.zoom_action && precise_time_s() - self.zoom_time > 0.3 {
Expand Down
4 changes: 2 additions & 2 deletions components/compositing/compositor_task.rs
Expand Up @@ -56,8 +56,8 @@ impl ScriptListener for CompositorChan {
port.recv();
}

fn dup(&self) -> Box<ScriptListener> {
box self.clone() as Box<ScriptListener>
fn dup(&self) -> Box<ScriptListener+'static> {
box self.clone() as Box<ScriptListener+'static>
}
}

Expand Down
6 changes: 3 additions & 3 deletions components/compositing/lib.rs
Expand Up @@ -28,10 +28,10 @@ extern crate layout_traits;
extern crate opengles;
extern crate png;
extern crate script_traits;
extern crate servo_msg = "msg";
extern crate servo_net = "net";
extern crate "msg" as servo_msg;
extern crate "net" as servo_net;
#[phase(plugin, link)]
extern crate servo_util = "util";
extern crate "util" as servo_util;

extern crate libc;
extern crate time;
Expand Down
11 changes: 5 additions & 6 deletions components/devtools/actor.rs
Expand Up @@ -8,7 +8,7 @@ use std::any::{Any, AnyRefExt, AnyMutRefExt};
use std::collections::hashmap::HashMap;
use std::cell::{Cell, RefCell};
use std::io::TcpStream;
use std::mem::{transmute, transmute_copy};
use std::mem::{transmute, transmute_copy, replace};
use std::raw::TraitObject;
use serialize::json;

Expand All @@ -24,7 +24,7 @@ pub trait Actor: Any {
fn name(&self) -> String;
}

impl<'a> AnyMutRefExt<'a> for &'a mut Actor {
impl<'a> AnyMutRefExt<'a> for &'a mut Actor + 'a {
fn downcast_mut<T: 'static>(self) -> Option<&'a mut T> {
if self.is::<T>() {
unsafe {
Expand All @@ -40,7 +40,7 @@ impl<'a> AnyMutRefExt<'a> for &'a mut Actor {
}
}

impl<'a> AnyRefExt<'a> for &'a Actor {
impl<'a> AnyRefExt<'a> for &'a Actor + 'a {
fn is<T: 'static>(self) -> bool {
//FIXME: This implementation is bogus since get_type_id is private now.
// However, this implementation is only needed so long as there's a Rust bug
Expand Down Expand Up @@ -162,10 +162,9 @@ impl ActorRegistry {
}
}
}
let mut new_actors = self.new_actors.borrow_mut();
for &actor in new_actors.iter() {
let mut new_actors = replace(&mut *self.new_actors.borrow_mut(), vec!());
for actor in new_actors.into_iter() {
self.actors.insert(actor.name().to_string(), actor);
}
new_actors.clear();
}
}
7 changes: 3 additions & 4 deletions components/devtools/lib.rs
Expand Up @@ -22,10 +22,9 @@ extern crate collections;
extern crate core;
extern crate devtools_traits;
extern crate debug;
extern crate std;
extern crate serialize;
extern crate sync;
extern crate servo_msg = "msg";
extern crate "msg" as servo_msg;

use actor::{Actor, ActorRegistry};
use actors::console::ConsoleActor;
Expand Down Expand Up @@ -181,8 +180,8 @@ fn run_server(port: Receiver<DevtoolsControlMsg>) {
//TODO: make constellation send ServerExitMsg on shutdown.

// accept connections and process them, spawning a new tasks for each one
for stream in acceptor.incoming() {
match stream {
loop {
match acceptor.accept() {
Err(ref e) if e.kind == TimedOut => {
match port.try_recv() {
Ok(ServerExitMsg) | Err(Disconnected) => break,
Expand Down
2 changes: 1 addition & 1 deletion components/devtools_traits/lib.rs
Expand Up @@ -8,7 +8,7 @@
#![comment = "The Servo Parallel Browser Project"]
#![license = "MPL"]

extern crate servo_msg = "msg";
extern crate "msg" as servo_msg;

/// This module contains shared types and messages for use by devtools/script.
/// The traits are here instead of in script so that the devtools crate can be
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/color.rs
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use azure::AzFloat;
use AzColor = azure::azure_hl::Color;
use azure::azure_hl::Color as AzColor;

pub type Color = AzColor;

Expand Down
2 changes: 1 addition & 1 deletion components/gfx/display_list/mod.rs
Expand Up @@ -134,7 +134,7 @@ impl ScaledFontExtensionMethods for ScaledFont {
&mut glyphbuf,
azure_pattern,
&mut options,
ptr::mut_null());
ptr::null_mut());
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions components/gfx/lib.rs
Expand Up @@ -22,11 +22,11 @@ extern crate stb_image;
extern crate png;
extern crate serialize;
#[phase(plugin)]
extern crate servo_macros = "macros";
extern crate servo_net = "net";
extern crate "macros" as servo_macros;
extern crate "net" as servo_net;
#[phase(plugin, link)]
extern crate servo_util = "util";
extern crate servo_msg = "msg";
extern crate "util" as servo_util;
extern crate "msg" as servo_msg;
extern crate style;
extern crate sync;
extern crate url;
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/platform/freetype/font.rs
Expand Up @@ -96,7 +96,7 @@ impl FontHandleMethods for FontHandle {
fn create_face_from_buffer(lib: FT_Library, cbuf: *const u8, cbuflen: uint, pt_size: Option<f64>)
-> Result<FT_Face, ()> {
unsafe {
let mut face: FT_Face = ptr::mut_null();
let mut face: FT_Face = ptr::null_mut();
let face_index = 0 as FT_Long;
let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long,
face_index, &mut face);
Expand Down
4 changes: 2 additions & 2 deletions components/gfx/platform/freetype/font_context.rs
Expand Up @@ -61,13 +61,13 @@ impl FontContextHandle {
let ptr = libc::malloc(mem::size_of::<struct_FT_MemoryRec_>() as size_t);
let allocator: &mut struct_FT_MemoryRec_ = mem::transmute(ptr);
ptr::write(allocator, struct_FT_MemoryRec_ {
user: ptr::mut_null(),
user: ptr::null_mut(),
alloc: ft_alloc,
free: ft_free,
realloc: ft_realloc,
});

let mut ctx: FT_Library = ptr::mut_null();
let mut ctx: FT_Library = ptr::null_mut();

let result = FT_New_Library(ptr as FT_Memory, &mut ctx);
if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
Expand Down
10 changes: 5 additions & 5 deletions components/gfx/platform/freetype/font_list.rs
Expand Up @@ -35,7 +35,7 @@ pub fn get_available_families(callback: |String|) {
let fontSet = FcConfigGetFonts(config, FcSetSystem);
for i in range(0, (*fontSet).nfont as int) {
let font = (*fontSet).fonts.offset(i);
let mut family: *mut FcChar8 = ptr::mut_null();
let mut family: *mut FcChar8 = ptr::null_mut();
let mut v: c_int = 0;
while FcPatternGetString(*font, FC_FAMILY.as_ptr() as *mut i8, v, &mut family) == FcResultMatch {
let family_name = string::raw::from_buf(family as *const i8 as *const u8);
Expand Down Expand Up @@ -71,7 +71,7 @@ pub fn get_variations_for_family(family_name: &str, callback: |String|) {

for i in range(0, (*matches).nfont as int) {
let font = (*matches).fonts.offset(i);
let mut file: *mut FcChar8 = ptr::mut_null();
let mut file: *mut FcChar8 = ptr::null_mut();
let file = if FcPatternGetString(*font, FC_FILE.as_ptr() as *mut i8, 0, &mut file) == FcResultMatch {
string::raw::from_buf(file as *const i8 as *const u8)
} else {
Expand Down Expand Up @@ -103,14 +103,14 @@ pub fn get_system_default_family(generic_name: &str) -> Option<String> {
unsafe {
let pattern = FcNameParse(generic_name_ptr as *mut FcChar8);

FcConfigSubstitute(ptr::mut_null(), pattern, FcMatchPattern);
FcConfigSubstitute(ptr::null_mut(), pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);

let mut result = 0;
let family_match = FcFontMatch(ptr::mut_null(), pattern, &mut result);
let family_match = FcFontMatch(ptr::null_mut(), pattern, &mut result);

let family_name = if result == FcResultMatch {
let mut match_string: *mut FcChar8 = ptr::mut_null();
let mut match_string: *mut FcChar8 = ptr::null_mut();
FcPatternGetString(family_match, FC_FAMILY.as_ptr() as *mut i8, 0, &mut match_string);
let result = string::raw::from_buf(match_string as *const i8 as *const u8);
FcPatternDestroy(family_match);
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/platform/macos/font.rs
Expand Up @@ -138,7 +138,7 @@ impl FontHandleMethods for FontHandle {
let glyphs = [glyph as CGGlyph];
let advance = self.ctfont.get_advances_for_glyphs(kCTFontDefaultOrientation,
&glyphs[0],
ptr::mut_null(),
ptr::null_mut(),
1);
Some(advance as FractionalPixel)
}
Expand Down
12 changes: 6 additions & 6 deletions components/gfx/text/shaping/harfbuzz.rs
Expand Up @@ -175,9 +175,9 @@ impl Shaper {
// configure static function callbacks.
// NB. This funcs structure could be reused globally, as it never changes.
let hb_funcs: *mut hb_font_funcs_t = hb_font_funcs_create();
hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::mut_null(), None);
hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::mut_null(), None);
hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::mut_null(), ptr::mut_null());
hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut());
hb_font_set_funcs(hb_font, hb_funcs, font_ptr as *mut c_void, None);

Shaper {
Expand Down Expand Up @@ -211,7 +211,7 @@ impl ShaperMethods for Shaper {
0,
text.len() as c_int);

hb_shape(self.hb_font, hb_buffer, ptr::mut_null(), 0);
hb_shape(self.hb_font, hb_buffer, ptr::null_mut(), 0);
self.save_glyph_results(text, glyphs, hb_buffer);
hb_buffer_destroy(hb_buffer);
}
Expand Down Expand Up @@ -511,11 +511,11 @@ extern fn get_font_table_func(_: *mut hb_face_t, tag: hb_tag_t, user_data: *mut

// TODO(Issue #197): reuse font table data, which will change the unsound trickery here.
match (*font).get_table_for_tag(tag as FontTableTag) {
None => ptr::mut_null(),
None => ptr::null_mut(),
Some(ref font_table) => {
let skinny_font_table_ptr: *const FontTable = font_table; // private context

let mut blob: *mut hb_blob_t = ptr::mut_null();
let mut blob: *mut hb_blob_t = ptr::null_mut();
(*skinny_font_table_ptr).with_buffer(|buf: *const u8, len: uint| {
// HarfBuzz calls `destroy_blob_func` when the buffer is no longer needed.
blob = hb_blob_create(buf as *const c_char,
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/text/shaping/mod.rs
Expand Up @@ -9,7 +9,7 @@

use text::glyph::GlyphStore;

pub use Shaper = text::shaping::harfbuzz::Shaper;
pub use text::shaping::harfbuzz::Shaper;

pub mod harfbuzz;

Expand Down
63 changes: 41 additions & 22 deletions components/layout/block.rs
Expand Up @@ -977,10 +977,16 @@ impl BlockFlow {
let mut candidate_block_size_iterator = CandidateBSizeIterator::new(
self.fragment.style(),
self.base.block_container_explicit_block_size);
for candidate_block_size in candidate_block_size_iterator {
candidate_block_size_iterator.candidate_value = match candidate_block_size {
Auto => block_size,
Specified(value) => value
// Can't use `for` because we assign to candidate_block_size_iterator.candidate_value
loop {
match candidate_block_size_iterator.next() {
Some(candidate_block_size) => {
candidate_block_size_iterator.candidate_value = match candidate_block_size {
Auto => block_size,
Specified(value) => value
}
}
None => break,
}
}

Expand Down Expand Up @@ -1097,10 +1103,16 @@ impl BlockFlow {
let mut candidate_block_size_iterator =
CandidateBSizeIterator::new(self.fragment.style(),
self.base.block_container_explicit_block_size);
for candidate_block_size in candidate_block_size_iterator {
candidate_block_size_iterator.candidate_value = match candidate_block_size {
Auto => content_block_size,
Specified(value) => value,
// Can't use `for` because we assign to candidate_block_size_iterator.candidate_value
loop {
match candidate_block_size_iterator.next() {
Some(candidate_block_size) => {
candidate_block_size_iterator.candidate_value = match candidate_block_size {
Auto => content_block_size,
Specified(value) => value,
}
}
None => break,
}
}

Expand Down Expand Up @@ -1241,19 +1253,26 @@ impl BlockFlow {
let mut candidate_block_size_iterator =
CandidateBSizeIterator::new(style, Some(containing_block_block_size));

for block_size_used_val in candidate_block_size_iterator {
solution =
Some(BSizeConstraintSolution::solve_vertical_constraints_abs_nonreplaced(
block_size_used_val,
margin_block_start,
margin_block_end,
block_start,
block_end,
content_block_size,
available_block_size,
static_b_offset));

candidate_block_size_iterator.candidate_value = solution.unwrap().block_size
// Can't use `for` because we assign to candidate_block_size_iterator.candidate_value
loop {
match candidate_block_size_iterator.next() {
Some(block_size_used_val) => {
solution =
Some(BSizeConstraintSolution::solve_vertical_constraints_abs_nonreplaced(
block_size_used_val,
margin_block_start,
margin_block_end,
block_start,
block_end,
content_block_size,
available_block_size,
static_b_offset));

candidate_block_size_iterator.candidate_value
= solution.unwrap().block_size;
}
None => break,
}
}
}
}
Expand Down Expand Up @@ -1773,7 +1792,7 @@ impl Flow for BlockFlow {
// FIXME(#2010, pcwalton): This is a hack and is totally bogus in the presence of pseudo-
// elements. But until we have incremental reflow we can't do better--we recreate the flow
// for every DOM node so otherwise we nuke layers on every reflow.
LayerId(self.fragment.node.id(), fragment_index)
LayerId(self.fragment.node.id() as uint, fragment_index)
}

fn is_absolute_containing_block(&self) -> bool {
Expand Down

0 comments on commit a640a7c

Please sign in to comment.