auto merge of #4922 : servo/servo/warnings, r=jdm

This commit is contained in:
bors-servo 2015-02-13 05:33:49 -07:00
commit 66f4faf44f
31 changed files with 116 additions and 83 deletions

View file

@ -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;

View file

@ -1190,9 +1190,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
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,

View file

@ -1084,7 +1084,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
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();

View file

@ -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)]

View file

@ -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<String>,

View file

@ -353,7 +353,7 @@ impl StackingContext {
fn hit_test_in_list<'a,I>(point: Point2D<Au>,
result: &mut Vec<DisplayItemMetadata>,
topmost_only: bool,
mut iterator: I)
iterator: I)
where I: Iterator<Item=&'a DisplayItem> {
for item in iterator {
// TODO(pcwalton): Use a precise algorithm here. This will allow us to properly hit

View file

@ -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<DisplayItem>,
mut display_items: I)
display_items: I)
where I: Iterator<Item=&'a DisplayItem> {
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<Arc<StackingContext>>,
mut stacking_contexts: I)
stacking_contexts: I)
where I: Iterator<Item=&'a Arc<StackingContext>> {
for stacking_context in stacking_contexts {
let overflow = stacking_context.overflow.translate(&stacking_context.bounds.origin);

View file

@ -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)
}

View file

@ -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;

View file

@ -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,

View file

@ -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,

View file

@ -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)

View file

@ -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

View file

@ -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;

View file

@ -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()
}

View file

@ -55,7 +55,7 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
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.

View file

@ -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();
}
}
}

View file

@ -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;

View file

@ -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<String, String>> = 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

View file

@ -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;

View file

@ -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<T>(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::<T>());
let from_buf = slice::from_raw_parts(buf, size_of::<T>());
hexdump_slice(from_buf);
}
}

View file

@ -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`

View file

@ -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;

View file

@ -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;

View file

@ -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.

View file

@ -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 `<servo source>/components/servo/target`
// or `<servo source>/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();

View file

@ -44,7 +44,7 @@ impl<T> VecLike<T> for Vec<T> {
#[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<T> FromIterator<T> for $name<T> {
fn from_iter<I: Iterator<Item=T>>(mut iter: I) -> $name<T> {
fn from_iter<I: Iterator<Item=T>>(iter: I) -> $name<T> {
let mut v = $name::new();
let (lower_size_bound, _) = iter.size_hint();
@ -428,7 +428,7 @@ macro_rules! def_small_vector(
}
impl<T> $name<T> {
pub fn extend<I: Iterator<Item=T>>(&mut self, mut iter: I) {
pub fn extend<I: Iterator<Item=T>>(&mut self, iter: I) {
let (lower_size_bound, _) = iter.size_hint();
let target_len = self.len() + lower_size_bound;

View file

@ -273,7 +273,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> {
// 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..]);

View file

@ -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<RefCell<Option<uint>>> = Rc::new(RefCell::new(None)));

View file

@ -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")]

View file

@ -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,