diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index 3a1f3459eb1..4e71e9fb2a7 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -5,7 +5,8 @@ #![feature(box_syntax)] #![feature(core)] #![feature(int_uint)] -#![feature(io)] +#![feature(old_io)] +#![feature(old_path)] #![feature(rustc_private)] #![feature(std_misc)] diff --git a/components/compositing/scrolling.rs b/components/compositing/scrolling.rs index 71e58bcd94a..89890fd2b27 100644 --- a/components/compositing/scrolling.rs +++ b/components/compositing/scrolling.rs @@ -40,7 +40,7 @@ impl ScrollingTimerProxy { receiver: to_scrolling_timer_receiver, }; scrolling_timer.run(); - }); + }).unwrap(); ScrollingTimerProxy { sender: to_scrolling_timer_sender, } diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 78f4cd951fe..828f3b3bbab 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -10,7 +10,7 @@ #![crate_name = "devtools"] #![crate_type = "rlib"] -#![feature(int_uint, box_syntax, io, core, rustc_private)] +#![feature(int_uint, box_syntax, io, old_io, core, rustc_private)] #![feature(collections, std_misc)] #![allow(non_snake_case)] diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index c8da46bee58..74c0792fdcd 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -14,7 +14,7 @@ //! They are therefore not exactly analogous to constructs like Skia pictures, which consist of //! low-level drawing primitives. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use display_list::optimizer::DisplayListOptimizer; use paint_context::{PaintContext, ToAzureRect}; diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 3fe671fc888..2bd53bd699b 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -6,10 +6,9 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![feature(hash)] #![feature(int_uint)] -#![cfg_attr(any(target_os="linux", target_os = "android"), feature(io))] -#![cfg_attr(any(target_os="linux", target_os = "android"), feature(path))] +#![cfg_attr(any(target_os="linux", target_os = "android"), feature(old_io))] +#![cfg_attr(any(target_os="linux", target_os = "android"), feature(old_path))] #![feature(plugin)] #![feature(rustc_private)] #![feature(std_misc)] diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index b21e861a8f8..db281e1acac 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -439,7 +439,7 @@ impl WorkerThreadProxy { font_cache_task, time_profiler_chan); worker_thread.main(); - }); + }).unwrap(); WorkerThreadProxy { receiver: from_worker_receiver, sender: to_worker_sender, diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs index 1b835339e31..5b1d309b31e 100644 --- a/components/gfx/platform/freetype/font_list.rs +++ b/components/gfx/platform/freetype/font_list.rs @@ -59,7 +59,7 @@ pub fn get_variations_for_family(family_name: &str, mut callback: F) let font_set_array_ptr = &mut font_set; let pattern = FcPatternCreate(); assert!(!pattern.is_null()); - let family_name_c = CString::from_slice(family_name.as_bytes()); + let family_name_c = CString::new(family_name).unwrap(); let family_name = family_name_c.as_ptr(); let ok = FcPatternAddString(pattern, FC_FAMILY.as_ptr() as *mut c_char, family_name as *mut FcChar8); assert!(ok != 0); @@ -102,7 +102,7 @@ pub fn get_variations_for_family(family_name: &str, mut callback: F) } pub fn get_system_default_family(generic_name: &str) -> Option { - let generic_name_c = CString::from_slice(generic_name.as_bytes()); + let generic_name_c = CString::new(generic_name).unwrap(); let generic_name_ptr = generic_name_c.as_ptr(); unsafe { diff --git a/components/msg/lib.rs b/components/msg/lib.rs index b7aec05fe87..b4517b2fff9 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -2,7 +2,6 @@ * 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)] extern crate azure; diff --git a/components/net/lib.rs b/components/net/lib.rs index e29a4cfdaed..2387583b76e 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -5,10 +5,12 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![feature(env)] #![feature(int_uint)] #![feature(io)] +#![feature(old_io)] +#![feature(old_path)] #![feature(path)] +#![feature(path_ext)] #![feature(plugin)] #![feature(rustc_private)] #![feature(std_misc)] diff --git a/components/net/sniffer_task.rs b/components/net/sniffer_task.rs index 2b9b2363a0a..f3ec4c988ea 100644 --- a/components/net/sniffer_task.rs +++ b/components/net/sniffer_task.rs @@ -14,7 +14,7 @@ pub fn new_sniffer_task() -> SnifferTask { let builder = Builder::new().name("SnifferManager".to_string()); builder.spawn(move || { SnifferManager::new(rec).start(); - }); + }).unwrap(); sen } diff --git a/components/script/build.rs b/components/script/build.rs index ca5ecaf9369..88b1e22b953 100644 --- a/components/script/build.rs +++ b/components/script/build.rs @@ -2,17 +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(io)] - -use std::old_io::process::{Command, ProcessExit, StdioContainer}; - +use std::process::Command; fn main() { - let result = Command::new("make") + assert!(Command::new("make") .args(&["-f", "makefile.cargo"]) - .stdout(StdioContainer::InheritFd(1)) - .stderr(StdioContainer::InheritFd(2)) .status() - .unwrap(); - assert_eq!(result, ProcessExit::ExitStatus(0)); + .unwrap() + .success()); } diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index d6e81a90ac0..58fa83dbf67 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -2,7 +2,6 @@ * 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)] extern crate devtools_traits; diff --git a/components/style/build.rs b/components/style/build.rs index ff177c4f702..8e2117614cf 100644 --- a/components/style/build.rs +++ b/components/style/build.rs @@ -2,32 +2,33 @@ * 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(env, old_io, old_path)] +#![feature(io, path)] use std::env; -use std::old_path::Path; -use std::old_io::process::{Command, ProcessExit, StdioContainer}; -use std::old_io::File; +use std::fs::File; +use std::io::Write; +use std::process::{Command, Stdio}; +use std::path::Path; fn main() { - let python = if Command::new("python2.7").arg("--version").status() == Ok(ProcessExit::ExitStatus(0)) { + let python = if Command::new("python2.7").arg("--version").status().unwrap().success() { "python2.7" } else { "python" }; - let style = Path::new(file!()).dir_path(); + let style = Path::new(file!()).parent().unwrap(); let mako = style.join("Mako-0.9.1.zip"); let template = style.join("properties.mako.rs"); let result = Command::new(python) - .env("PYTHONPATH", mako.as_str().unwrap()) - .env("TEMPLATE", template.as_str().unwrap()) + .env("PYTHONPATH", &mako) + .env("TEMPLATE", &template) .arg("-c") .arg("from os import environ; from mako.template import Template; print(Template(filename=environ['TEMPLATE']).render())") - .stderr(StdioContainer::InheritFd(2)) + .stderr(Stdio::inherit()) .output() .unwrap(); - assert_eq!(result.status, ProcessExit::ExitStatus(0)); - let out = Path::new(env::var("OUT_DIR").unwrap()); - File::create(&out.join("properties.rs")).unwrap().write_all(&*result.output).unwrap(); + assert!(result.status.success()); + let out = env::var("OUT_DIR").unwrap(); + File::create(&Path::new(&out).join("properties.rs")).unwrap().write_all(&result.stdout).unwrap(); } diff --git a/components/style/lib.rs b/components/style/lib.rs index 32e4a3bf3ef..76a0cbb6866 100644 --- a/components/style/lib.rs +++ b/components/style/lib.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/. */ +#![feature(alloc)] #![feature(plugin)] #![feature(int_uint)] #![feature(box_syntax)] #![feature(core)] -#![feature(std_misc)] #![feature(collections)] #![feature(rustc_private)] diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index bc74eb1c122..7ada9b7fdb8 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -9,7 +9,7 @@ use selectors::matching::{SelectorMap, Rule}; use selectors::matching::DeclarationBlock as GenericDeclarationBlock; use selectors::parser::PseudoElement; use selectors::smallvec::VecLike; -use selectors::tree::{TNode, TElement}; +use selectors::tree::TNode; use util::resource_files::read_resource_file; use legacy::PresentationalHintSynthesis; diff --git a/components/util/lib.rs b/components/util/lib.rs index 6cebd0155a5..094bd292897 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -6,15 +6,20 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![feature(env)] +#![feature(exit_status)] #![feature(hash)] #![feature(int_uint)] #![feature(io)] #![feature(optin_builtin_traits)] +#![feature(old_io)] +#![feature(old_path)] +#![feature(page_size)] #![feature(path)] +#![feature(path_ext)] #![feature(plugin)] #![feature(rustc_private)] #![feature(std_misc)] +#![feature(str_words)] #![feature(unicode)] #![feature(unsafe_destructor)] diff --git a/components/util/memory.rs b/components/util/memory.rs index 6c9f38c6141..4bc44b332c3 100644 --- a/components/util/memory.rs +++ b/components/util/memory.rs @@ -451,12 +451,12 @@ fn get_jemalloc_stat(value_name: &str) -> Option { // request. Without that jemalloc gives cached statistics(!) which can be // highly inaccurate. let epoch_name = "epoch"; - let epoch_c_name = CString::from_slice(epoch_name.as_bytes()); + let epoch_c_name = CString::new(epoch_name).unwrap(); let mut epoch: u64 = 0; let epoch_ptr = &mut epoch as *mut _ as *mut c_void; let mut epoch_len = size_of::() as size_t; - let value_c_name = CString::from_slice(value_name.as_bytes()); + let value_c_name = CString::new(value_name).unwrap(); let mut value: size_t = 0; let value_ptr = &mut value as *mut _ as *mut c_void; let mut value_len = size_of::() as size_t; diff --git a/components/util/range.rs b/components/util/range.rs index df32d0cffd3..86d670d2f84 100644 --- a/components/util/range.rs +++ b/components/util/range.rs @@ -126,7 +126,7 @@ macro_rules! int_range_index { impl ::std::num::NumCast for $Self_ { fn from(n: T) -> Option<$Self_> { - n.to_int().map($Self_) + n.to_isize().map($Self_) } } diff --git a/components/util/str.rs b/components/util/str.rs index bc193002ff1..f4e3badab15 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -9,10 +9,10 @@ use cssparser::{self, RGBA, Color}; use libc::c_char; use std::ascii::AsciiExt; use std::borrow::ToOwned; -use std::ffi::c_str_to_bytes; +use std::ffi::CStr; use std::iter::Filter; use std::num::{Int, ToPrimitive}; -use std::str::{from_utf8, CharEq, FromStr, Split}; +use std::str::{from_utf8, FromStr, Split}; pub type DOMString = String; pub type StaticCharVec = &'static [char]; @@ -333,5 +333,5 @@ impl Str for LowercaseString { /// Creates a String from the given null-terminated buffer. /// Panics if the buffer does not contain UTF-8. pub unsafe fn c_str_to_string(s: *const c_char) -> String { - from_utf8(c_str_to_bytes(&s)).unwrap().to_owned() + from_utf8(CStr::from_ptr(s).to_bytes()).unwrap().to_owned() } diff --git a/components/util/task.rs b/components/util/task.rs index 88acbd65e09..97770269259 100644 --- a/components/util/task.rs +++ b/components/util/task.rs @@ -14,7 +14,7 @@ pub fn spawn_named(name: String, f: F) let builder = thread::Builder::new().name(name); builder.spawn(move || { f() - }); + }).unwrap(); } /// Arrange to send a particular message to a channel if the task fails. @@ -40,7 +40,7 @@ pub fn spawn_named_with_send_on_failure(name: &'static str, dest.send(msg).unwrap(); } } - }); + }).unwrap(); } #[test] diff --git a/ports/glutin/lib.rs b/ports/glutin/lib.rs index 8e56150d6af..c64ff2a4e91 100644 --- a/ports/glutin/lib.rs +++ b/ports/glutin/lib.rs @@ -6,7 +6,6 @@ #![feature(int_uint)] #![feature(core)] -#![cfg_attr(feature = "window", feature(hash))] #![feature(box_syntax)] #[macro_use] extern crate bitflags; diff --git a/support/rust-task_info/build.rs b/support/rust-task_info/build.rs index f2dc14999c4..99552a2ed48 100644 --- a/support/rust-task_info/build.rs +++ b/support/rust-task_info/build.rs @@ -2,21 +2,14 @@ * 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(env)] -#![feature(io)] -#![feature(old_io)] - -use std::old_io::process::{Command, ProcessExit, StdioContainer}; +use std::process::Command; use std::env; fn main() { - let out_dir = env::var("OUT_DIR").unwrap(); - let result = Command::new("make") + assert!(Command::new("make") .args(&["-f", "makefile.cargo"]) - .stdout(StdioContainer::InheritFd(1)) - .stderr(StdioContainer::InheritFd(2)) .status() - .unwrap(); - assert_eq!(result, ProcessExit::ExitStatus(0)); - println!("cargo:rustc-flags=-L native={}", out_dir); + .unwrap() + .success()); + println!("cargo:rustc-flags=-L native={}", env::var("OUT_DIR").unwrap()); }