From dda12e196b2dc915587b2e298bc5d43b6ed0de11 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 10:25:51 +0100 Subject: [PATCH 1/9] Fix warnings in compositing. --- components/compositing/compositor.rs | 6 +++--- components/compositing/constellation.rs | 2 +- components/compositing/lib.rs | 9 +++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 3d1de33be16..3ed89b37604 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -1190,9 +1190,9 @@ impl IOCompositor { for y in range(0, height) { let dst_start = y * stride; let src_start = (height - y - 1) * stride; - let src_slice = orig_pixels.slice(src_start, src_start + stride); - copy_memory(pixels.slice_mut(dst_start, dst_start + stride), - src_slice.slice_to(stride)); + let src_slice = &orig_pixels[src_start .. src_start + stride]; + copy_memory(&mut pixels[dst_start .. dst_start + stride], + &src_slice[..stride]); } let mut img = png::Image { width: width as u32, diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index d3a8aa43474..07c1faea6dd 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -1084,7 +1084,7 @@ impl Constellation { return; // Our message has been discarded, probably shutting down. } - let mut iter = frame_tree.iter(); + let iter = frame_tree.iter(); for frame in iter { frame.has_compositor_layer.set(true); frame.pipeline.borrow().grant_paint_permission(); diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index 742f4a72d8d..2fcf680cbf4 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -2,8 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![feature(box_syntax, plugin)] -#![feature(int_uint, core, libc, std_misc)] +#![feature(box_syntax)] +#![feature(core)] +#![feature(int_uint)] +#![feature(io)] +#![feature(libc)] +#![feature(rustc_private)] +#![feature(std_misc)] #![allow(missing_copy_implementations)] From 19a8f24e8b5e79368940b51b1df2c6309654389c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 10:37:00 +0100 Subject: [PATCH 2/9] Fix warnings in glutin. --- ports/glutin/lib.rs | 7 +++++-- ports/glutin/window.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ports/glutin/lib.rs b/ports/glutin/lib.rs index 824b151bb8b..4ac0a2c18aa 100644 --- a/ports/glutin/lib.rs +++ b/ports/glutin/lib.rs @@ -4,8 +4,11 @@ //! A simple application that uses glutin to open a window for Servo to display in. -#![feature(box_syntax, int_uint)] -#![allow(unstable)] +#![feature(int_uint)] +#![feature(core)] +#![feature(hash)] +#![feature(box_syntax)] +#![feature(libc)] #[macro_use] extern crate bitflags; #[cfg(target_os="macos")] diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index c7707108b48..8fe2f02599b 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -47,7 +47,7 @@ static mut g_nested_event_loop_listener: Option<*mut (NestedEventLoopListener + #[cfg(feature = "window")] bitflags! { - #[derive(Show)] + #[derive(Debug)] flags KeyModifiers: u8 { const LEFT_CONTROL = 1, const RIGHT_CONTROL = 2, From 5e999c7d406a5d48c15f00a07137354a0634cf6f Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 10:40:04 +0100 Subject: [PATCH 3/9] Fix warnings in canvas. --- components/canvas/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index 3e8350b8c37..af26c94d3ba 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -2,8 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#![feature(core)] + #![allow(missing_copy_implementations)] -#![allow(unstable)] extern crate azure; extern crate geom; From e25322ce5b8a1486bc00ac85a6aee93d457abc1f Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 11:00:20 +0100 Subject: [PATCH 4/9] Fix warnings in gfx. --- components/gfx/display_list/mod.rs | 2 +- components/gfx/display_list/optimizer.rs | 4 ++-- components/gfx/font.rs | 2 +- components/gfx/lib.rs | 16 ++++++++++++++-- components/gfx/text/glyph.rs | 4 ++-- components/gfx/text/text_run.rs | 8 ++++---- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 2b5b8707780..99a7cc5fe0c 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -353,7 +353,7 @@ impl StackingContext { fn hit_test_in_list<'a,I>(point: Point2D, result: &mut Vec, topmost_only: bool, - mut iterator: I) + iterator: I) where I: Iterator { for item in iterator { // TODO(pcwalton): Use a precise algorithm here. This will allow us to properly hit diff --git a/components/gfx/display_list/optimizer.rs b/components/gfx/display_list/optimizer.rs index 485cc1816a6..f14ff8a74a8 100644 --- a/components/gfx/display_list/optimizer.rs +++ b/components/gfx/display_list/optimizer.rs @@ -43,7 +43,7 @@ impl DisplayListOptimizer { /// Adds display items that intersect the visible rect to `result_list`. fn add_in_bounds_display_items<'a,I>(&self, result_list: &mut DList, - mut display_items: I) + display_items: I) where I: Iterator { for display_item in display_items { if self.visible_rect.intersects(&display_item.base().bounds) && @@ -56,7 +56,7 @@ impl DisplayListOptimizer { /// Adds child stacking contexts whose boundaries intersect the visible rect to `result_list`. fn add_in_bounds_stacking_contexts<'a,I>(&self, result_list: &mut DList>, - mut stacking_contexts: I) + stacking_contexts: I) where I: Iterator> { for stacking_context in stacking_contexts { let overflow = stacking_context.overflow.translate(&stacking_context.bounds.origin); diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 0e676b6f3e3..21ab30ca0af 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -58,7 +58,7 @@ impl FontTableTagConversions for FontTableTag { fn tag_to_str(&self) -> String { unsafe { let pointer = mem::transmute::<&u32, *const u8>(self); - let mut bytes = slice::from_raw_buf(&pointer, 4).to_vec(); + let mut bytes = slice::from_raw_parts(pointer, 4).to_vec(); bytes.reverse(); String::from_utf8_unchecked(bytes) } diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 8274da13714..5ccf043d3b7 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -2,10 +2,22 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![feature(unsafe_destructor, int_uint, plugin, box_syntax)] +#![feature(alloc)] +#![feature(box_syntax)] +#![feature(collections)] +#![feature(core)] +#![feature(hash)] +#![feature(int_uint)] +#![feature(io)] +#![feature(libc)] +#![feature(path)] +#![feature(plugin)] +#![feature(rustc_private)] +#![feature(std_misc)] +#![feature(unicode)] +#![feature(unsafe_destructor)] #![allow(missing_copy_implementations)] -#![allow(unstable)] #[macro_use] extern crate log; diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index 1389be3fa62..7341036e6d3 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -345,7 +345,7 @@ impl<'a> DetailedGlyphStore { // FIXME: Is this right? --pcwalton // TODO: should fix this somewhere else if count == 0 { - return self.detail_buffer.slice(0, 0); + return &self.detail_buffer[0..0]; } assert!((count as uint) <= self.detail_buffer.len()); @@ -361,7 +361,7 @@ impl<'a> DetailedGlyphStore { assert!(i + (count as uint) <= self.detail_buffer.len()); // return a slice into the buffer - self.detail_buffer.slice(i, i + count as uint) + &self.detail_buffer[i .. i + count as uint] } fn get_detailed_glyph_with_index(&'a self, diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index 20429079c7e..9c28462411e 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -231,7 +231,7 @@ impl<'a> TextRun { // Create a glyph store for this slice if it's nonempty. if can_break_before && byte_i > byte_last_boundary { - let slice = text.slice(byte_last_boundary, byte_i); + let slice = &text[byte_last_boundary .. byte_i]; debug!("creating glyph store for slice {} (ws? {}), {} - {} in run {}", slice, !cur_slice_is_whitespace, byte_last_boundary, byte_i, text); @@ -254,7 +254,7 @@ impl<'a> TextRun { // Create a glyph store for the final slice if it's nonempty. if byte_i > byte_last_boundary { - let slice = text.slice_from(byte_last_boundary); + let slice = &text[byte_last_boundary..]; debug!("creating glyph store for final slice {} (ws? {}), {} - {} in run {}", slice, cur_slice_is_whitespace, byte_last_boundary, text.len(), text); @@ -343,7 +343,7 @@ impl<'a> TextRun { Some(index) => index, }; NaturalWordSliceIterator { - glyph_iter: self.glyphs.slice_from(index).iter(), + glyph_iter: self.glyphs[index..].iter(), range: *range, } } @@ -356,7 +356,7 @@ impl<'a> TextRun { None => self.glyphs.len(), Some(index) => index, }; - let mut glyph_run_iter = self.glyphs.slice_from(index).iter(); + let mut glyph_run_iter = self.glyphs[index..].iter(); let first_glyph_run = glyph_run_iter.next(); CharacterSliceIterator { glyph_run: first_glyph_run, From 79b8c3b9c0ea2fe6bbc35670a92c606094537202 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 11:07:26 +0100 Subject: [PATCH 5/9] Fix warnings in devtools_traits. --- components/devtools_traits/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/devtools_traits/lib.rs b/components/devtools_traits/lib.rs index 8a76012099d..349452bc40f 100644 --- a/components/devtools_traits/lib.rs +++ b/components/devtools_traits/lib.rs @@ -10,13 +10,13 @@ #![crate_type = "rlib"] #![feature(int_uint)] +#![feature(rustc_private)] #![allow(non_snake_case)] #![allow(missing_copy_implementations)] -#![allow(unstable)] extern crate msg; -extern crate serialize; +extern crate "serialize" as rustc_serialize; extern crate url; extern crate util; @@ -24,7 +24,7 @@ pub use self::DevtoolsControlMsg::*; pub use self::DevtoolScriptControlMsg::*; pub use self::EvaluateJSReply::*; -use serialize::{Decodable, Decoder}; +use rustc_serialize::{Decodable, Decoder}; use msg::constellation_msg::PipelineId; use util::str::DOMString; use url::Url; @@ -105,7 +105,7 @@ pub enum ScriptDevtoolControlMsg { ReportConsoleMsg(String), } -#[derive(Encodable)] +#[derive(RustcEncodable)] pub struct Modification{ pub attributeName: String, pub newValue: Option, From 58180fa4f7166c52b21403ea61c6556604ff2a17 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 11:08:14 +0100 Subject: [PATCH 6/9] Fix warnings in script_traits. --- components/script_traits/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 895f290da2b..8b5f509544c 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -2,10 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#![feature(core)] #![feature(int_uint)] +#![feature(libc)] +#![feature(rustc_private)] #![allow(missing_copy_implementations)] -#![allow(unstable)] extern crate devtools_traits; extern crate geom; From 2ca59b3f5b0775488bae33506c1c618a6210e4be Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 11:08:31 +0100 Subject: [PATCH 7/9] Fix warnings in msg. --- components/msg/compositor_msg.rs | 8 ++++---- components/msg/constellation_msg.rs | 10 +++++----- components/msg/lib.rs | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs index 111636c349c..54dc125f589 100644 --- a/components/msg/compositor_msg.rs +++ b/components/msg/compositor_msg.rs @@ -8,7 +8,7 @@ use geom::point::Point2D; use geom::rect::Rect; use layers::platform::surface::NativeGraphicsMetadata; use layers::layers::LayerBufferSet; -use std::fmt::{Formatter, Show}; +use std::fmt::{Formatter, Debug}; use std::fmt; use constellation_msg::PipelineId; @@ -20,7 +20,7 @@ pub enum PaintState { Painting, } -#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Show, Copy)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Debug, Copy)] pub enum ReadyState { /// Informs the compositor that nothing has been done yet. Used for setting status Blank, @@ -33,7 +33,7 @@ pub enum ReadyState { } /// A newtype struct for denoting the age of messages; prevents race conditions. -#[derive(PartialEq, Eq, Show, Copy)] +#[derive(PartialEq, Eq, Debug, Copy)] pub struct Epoch(pub uint); impl Epoch { @@ -46,7 +46,7 @@ impl Epoch { #[derive(Clone, PartialEq, Eq, Copy)] pub struct LayerId(pub uint, pub uint); -impl Show for LayerId { +impl Debug for LayerId { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let LayerId(a, b) = *self; write!(f, "Layer({}, {})", a, b) diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 67449d4d9ec..27a187edfde 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -60,7 +60,7 @@ pub enum KeyState { } //N.B. Based on the glutin key enum -#[derive(Show, PartialEq, Eq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, Copy, Clone)] pub enum Key { Space, Apostrophe, @@ -237,22 +237,22 @@ impl LoadData { } /// Represents the two different ways to which a page can be navigated -#[derive(Clone, PartialEq, Eq, Copy, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug)] pub enum NavigationType { Load, // entered or clicked on a url Navigate, // browser forward/back buttons } -#[derive(Clone, PartialEq, Eq, Copy, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug)] pub enum NavigationDirection { Forward, Back, } -#[derive(Clone, PartialEq, Eq, Copy, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug)] pub struct PipelineId(pub uint); -#[derive(Clone, PartialEq, Eq, Copy, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug)] pub struct SubpageId(pub uint); // The type of pipeline exit. During complete shutdowns, pipelines do not have to diff --git a/components/msg/lib.rs b/components/msg/lib.rs index 869b095a882..3fed347b085 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -2,10 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#![feature(hash)] #![feature(int_uint)] +#![feature(rustc_private)] #![allow(missing_copy_implementations)] -#![allow(unstable)] extern crate azure; #[macro_use] extern crate bitflags; From b25564440ddeab1fdcb3dec2b069130759bc4f41 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 11:24:21 +0100 Subject: [PATCH 8/9] Fix warnings in net. --- components/net/cookie.rs | 2 +- components/net/data_loader.rs | 2 +- components/net/http_loader.rs | 6 +++--- components/net/lib.rs | 12 +++++++++--- components/net/resource_task.rs | 12 ++++++------ 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/components/net/cookie.rs b/components/net/cookie.rs index 35c5d4dbe73..dfca6912c94 100644 --- a/components/net/cookie.rs +++ b/components/net/cookie.rs @@ -100,7 +100,7 @@ impl Cookie { request_path.chars().filter(|&c| c == '/').count() == 1 { "/".to_owned() } else if request_path.ends_with("/") { - request_path.slice_to(request_path.len()-1).to_owned() + request_path[..request_path.len() - 1].to_owned() } else { request_path.to_owned() } diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index 987b39568f3..bdaca050477 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -55,7 +55,7 @@ fn load(load_data: LoadData, start_chan: Sender) { let mut ct_str = parts[0]; if ct_str.ends_with(";base64") { is_base64 = true; - ct_str = ct_str.slice_to(ct_str.as_bytes().len() - 7); + ct_str = &ct_str[..ct_str.as_bytes().len() - 7]; } // Parse the content type using rust-http. diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index b23450c38df..9cb33763866 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -126,7 +126,7 @@ reason: \"certificate verify failed\" }]"; req.headers_mut().set(host); let (tx, rx) = channel(); - cookies_chan.send(ControlMsg::GetCookiesForUrl(url.clone(), tx, CookieSource::HTTP)); + cookies_chan.send(ControlMsg::GetCookiesForUrl(url.clone(), tx, CookieSource::HTTP)).unwrap(); if let Some(cookie_list) = rx.recv().unwrap() { let mut v = Vec::new(); v.push(cookie_list.into_bytes()); @@ -157,7 +157,7 @@ reason: \"certificate verify failed\" }]"; return; } }; - match writer.write(data.as_slice()) { + match writer.write_all(&*data) { Err(e) => { send_error(url, e.desc.to_string(), senders); return; @@ -201,7 +201,7 @@ reason: \"certificate verify failed\" }]"; if let Ok(cookies) = String::from_utf8(cookie.clone()) { cookies_chan.send(ControlMsg::SetCookiesForUrl(url.clone(), cookies, - CookieSource::HTTP)); + CookieSource::HTTP)).unwrap(); } } } diff --git a/components/net/lib.rs b/components/net/lib.rs index 4beb588047c..45a6c4c114e 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -2,12 +2,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![feature(int_uint)] -#![feature(unboxed_closures)] #![feature(box_syntax)] +#![feature(collections)] +#![feature(core)] +#![feature(env)] +#![feature(int_uint)] +#![feature(io)] +#![feature(path)] +#![feature(rustc_private)] +#![feature(std_misc)] +#![feature(unboxed_closures)] #![allow(missing_copy_implementations)] -#![allow(unstable)] extern crate "cookie" as cookie_rs; extern crate collections; diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index b8c7190ebd9..c6f6414f125 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -23,12 +23,12 @@ use hyper::mime::{Mime, Attr}; use url::Url; use std::borrow::{ToOwned, IntoCow}; +use std::collections::HashMap; +use std::env; +use std::mem; +use std::old_io::{BufferedReader, File}; use std::sync::mpsc::{channel, Receiver, Sender}; use std::thunk::Invoke; -use std::collections::HashMap; -use std::old_io::{BufferedReader, File}; -use std::mem; -use std::os; #[cfg(test)] use std::old_io::{Listener, Acceptor, TimedOut}; @@ -38,7 +38,7 @@ use std::old_io::net::tcp::TcpListener; static mut HOST_TABLE: Option<*mut HashMap> = None; pub fn global_init() { - if let Some(host_file_path) = os::getenv("HOST_FILE") { + if let Ok(host_file_path) = env::var_string("HOST_FILE") { //TODO: handle bad file path and corrupted file let path = Path::new(host_file_path); let mut file = BufferedReader::new(File::open(&path)); @@ -291,7 +291,7 @@ impl ResourceManager { } } ControlMsg::GetCookiesForUrl(url, consumer, source) => { - consumer.send(self.cookie_storage.cookies_for_url(&url, source)); + consumer.send(self.cookie_storage.cookies_for_url(&url, source)).unwrap(); } ControlMsg::Exit => { break From 830e6741c76a5eef85096d0378484d62f70c911a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 13 Feb 2015 11:42:13 +0100 Subject: [PATCH 9/9] Fix warnings in util. --- components/util/debug_utils.rs | 12 ++++++------ components/util/deque/mod.rs | 2 -- components/util/lib.rs | 20 ++++++++++++++------ components/util/memory.rs | 2 +- components/util/opts.rs | 4 ++-- components/util/resource_files.rs | 15 ++++++--------- components/util/smallvec.rs | 6 +++--- components/util/str.rs | 2 +- components/util/tid.rs | 4 ++-- 9 files changed, 35 insertions(+), 32 deletions(-) diff --git a/components/util/debug_utils.rs b/components/util/debug_utils.rs index 1eaa5085c8b..8d9789de029 100644 --- a/components/util/debug_utils.rs +++ b/components/util/debug_utils.rs @@ -10,25 +10,25 @@ use std::slice; fn hexdump_slice(buf: &[u8]) { let mut stderr = io::stderr(); - stderr.write(b" ").unwrap(); + stderr.write_all(b" ").unwrap(); for (i, &v) in buf.iter().enumerate() { let output = format!("{:02X} ", v as uint); - stderr.write(output.as_bytes()).unwrap(); + stderr.write_all(output.as_bytes()).unwrap(); match i % 16 { - 15 => { stderr.write(b"\n ").unwrap(); }, - 7 => { stderr.write(b" ").unwrap(); }, + 15 => { stderr.write_all(b"\n ").unwrap(); }, + 7 => { stderr.write_all(b" ").unwrap(); }, _ => () } stderr.flush().unwrap(); } - stderr.write(b"\n").unwrap(); + stderr.write_all(b"\n").unwrap(); } pub fn hexdump(obj: &T) { unsafe { let buf: *const u8 = mem::transmute(obj); debug!("dumping at {:p}", buf); - let from_buf = slice::from_raw_buf(&buf, size_of::()); + let from_buf = slice::from_raw_parts(buf, size_of::()); hexdump_slice(from_buf); } } diff --git a/components/util/deque/mod.rs b/components/util/deque/mod.rs index 04d8ab76f39..6dce728679b 100644 --- a/components/util/deque/mod.rs +++ b/components/util/deque/mod.rs @@ -42,8 +42,6 @@ //! let mut stealer2 = stealer.clone(); //! stealer2.steal(); -#![experimental] - // NB: the "buffer pool" strategy is not done for speed, but rather for // correctness. For more info, see the comment on `swap_buffer` diff --git a/components/util/lib.rs b/components/util/lib.rs index 045760a037d..36b61f6ed6a 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -2,16 +2,24 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![feature(unsafe_destructor)] -#![feature(plugin)] -#![feature(int_uint)] +#![feature(alloc)] #![feature(box_syntax)] +#![feature(collections)] +#![feature(core)] +#![feature(env)] +#![feature(hash)] +#![feature(int_uint)] +#![feature(io)] +#![feature(libc)] #![feature(optin_builtin_traits)] -#![feature(core, rustc_private, hash, alloc)] -#![feature(collections, libc, std_misc)] +#![feature(path)] +#![feature(plugin)] +#![feature(rustc_private)] +#![feature(std_misc)] +#![feature(unicode)] +#![feature(unsafe_destructor)] #![allow(missing_copy_implementations)] -#![allow(unstable)] #[macro_use] extern crate log; diff --git a/components/util/memory.rs b/components/util/memory.rs index 566b6ad3590..d52500b62a3 100644 --- a/components/util/memory.rs +++ b/components/util/memory.rs @@ -13,7 +13,7 @@ use std::old_io::File; use std::mem; use std::mem::size_of; #[cfg(target_os="linux")] -use std::os::page_size; +use std::env::page_size; use std::ptr::null_mut; use std::sync::mpsc::{Sender, channel, Receiver}; use std::time::duration::Duration; diff --git a/components/util/opts.rs b/components/util/opts.rs index 26f0651580f..aeee40ac249 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -13,9 +13,9 @@ use layers::geometry::DevicePixel; use getopts; use std::collections::HashSet; use std::cmp; +use std::env; use std::old_io as io; use std::mem; -use std::os; use std::ptr; use std::rt; @@ -137,7 +137,7 @@ pub fn print_debug_usage(app: &str) { fn args_fail(msg: &str) { io::stderr().write_line(msg).unwrap(); - os::set_exit_status(1); + env::set_exit_status(1); } // Always use CPU painting on android. diff --git a/components/util/resource_files.rs b/components/util/resource_files.rs index 2df0d059d95..c1defd887f0 100644 --- a/components/util/resource_files.rs +++ b/components/util/resource_files.rs @@ -5,14 +5,6 @@ use std::old_io::{File, IoResult}; use std::old_path::Path; -#[cfg(not(target_os = "android"))] -use opts; - -#[cfg(not(target_os = "android"))] -use std::old_io::fs::PathExtensions; -#[cfg(not(target_os = "android"))] -use std::os; - #[cfg(target_os = "android")] pub fn resources_dir_path() -> Path { Path::new("/sdcard/servo/") @@ -20,13 +12,18 @@ pub fn resources_dir_path() -> Path { #[cfg(not(target_os = "android"))] pub fn resources_dir_path() -> Path { + use opts; + use std::env; + use std::old_io::fs::PathExtensions; + match opts::get().resources_path { Some(ref path) => Path::new(path), None => { // FIXME: Find a way to not rely on the executable being // under `/components/servo/target` // or `/components/servo/target/release`. - let mut path = os::self_exe_path().expect("can't get exe path"); + let mut path = env::current_exe().ok().expect("can't get exe path"); + path.pop(); path.pop(); path.pop(); path.pop(); diff --git a/components/util/smallvec.rs b/components/util/smallvec.rs index 1707c0a6eba..14d983376e8 100644 --- a/components/util/smallvec.rs +++ b/components/util/smallvec.rs @@ -44,7 +44,7 @@ impl VecLike for Vec { #[inline] fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] { - self.slice_mut(start, end) + &mut self[start..end] } } @@ -410,7 +410,7 @@ macro_rules! def_small_vector( } impl FromIterator for $name { - fn from_iter>(mut iter: I) -> $name { + fn from_iter>(iter: I) -> $name { let mut v = $name::new(); let (lower_size_bound, _) = iter.size_hint(); @@ -428,7 +428,7 @@ macro_rules! def_small_vector( } impl $name { - pub fn extend>(&mut self, mut iter: I) { + pub fn extend>(&mut self, iter: I) { let (lower_size_bound, _) = iter.size_hint(); let target_len = self.len() + lower_size_bound; diff --git a/components/util/str.rs b/components/util/str.rs index 4b785de0a3b..80cdd1ae230 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -273,7 +273,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result { // Step 12. let mut length = input.len() / 3; - let (mut red, mut green, mut blue) = (input.slice_to(length), + let (mut red, mut green, mut blue) = (&input[..length], &input[length..length * 2], &input[length * 2..]); diff --git a/components/util/tid.rs b/components/util/tid.rs index e52dbf7fd61..7351f85f085 100644 --- a/components/util/tid.rs +++ b/components/util/tid.rs @@ -2,11 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use std::sync::atomic::{AtomicUint, ATOMIC_UINT_INIT, Ordering}; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; use std::rc::Rc; use std::cell::RefCell; -static mut next_tid: AtomicUint = ATOMIC_UINT_INIT; +static mut next_tid: AtomicUsize = ATOMIC_USIZE_INIT; thread_local!(static TASK_LOCAL_TID: Rc>> = Rc::new(RefCell::new(None)));