auto merge of #6431 : catamorphism/rust/warnings, r=catamorphism
Just cleaning up warnings.
This commit is contained in:
commit
1f62b23411
29 changed files with 58 additions and 144 deletions
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
#[allow(vecs_implicitly_copyable)];
|
#[allow(vecs_implicitly_copyable)];
|
||||||
#[allow(non_camel_case_types)];
|
#[allow(non_camel_case_types)];
|
||||||
#[allow(deprecated_mode)];
|
|
||||||
#[allow(deprecated_pattern)];
|
#[allow(deprecated_pattern)];
|
||||||
|
|
||||||
extern mod std(vers = "0.7-pre");
|
extern mod std(vers = "0.7-pre");
|
||||||
|
|
|
@ -13,7 +13,6 @@ Message passing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use cast::{transmute, transmute_mut};
|
use cast::{transmute, transmute_mut};
|
||||||
use cast;
|
|
||||||
use either::{Either, Left, Right};
|
use either::{Either, Left, Right};
|
||||||
use kinds::Owned;
|
use kinds::Owned;
|
||||||
use option::{Option, Some, None};
|
use option::{Option, Some, None};
|
||||||
|
@ -150,7 +149,7 @@ impl<T: Owned> GenericChan<T> for Chan<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn send(&self, x: T) {
|
fn send(&self, x: T) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut self_endp = transmute_mut(&self.endp);
|
let self_endp = transmute_mut(&self.endp);
|
||||||
let endp = replace(self_endp, None);
|
let endp = replace(self_endp, None);
|
||||||
*self_endp = Some(streamp::client::data(endp.unwrap(), x))
|
*self_endp = Some(streamp::client::data(endp.unwrap(), x))
|
||||||
}
|
}
|
||||||
|
@ -161,7 +160,7 @@ impl<T: Owned> GenericSmartChan<T> for Chan<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn try_send(&self, x: T) -> bool {
|
fn try_send(&self, x: T) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut self_endp = transmute_mut(&self.endp);
|
let self_endp = transmute_mut(&self.endp);
|
||||||
let endp = replace(self_endp, None);
|
let endp = replace(self_endp, None);
|
||||||
match streamp::client::try_data(endp.unwrap(), x) {
|
match streamp::client::try_data(endp.unwrap(), x) {
|
||||||
Some(next) => {
|
Some(next) => {
|
||||||
|
@ -178,7 +177,7 @@ impl<T: Owned> GenericPort<T> for Port<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn recv(&self) -> T {
|
fn recv(&self) -> T {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut self_endp = transmute_mut(&self.endp);
|
let self_endp = transmute_mut(&self.endp);
|
||||||
let endp = replace(self_endp, None);
|
let endp = replace(self_endp, None);
|
||||||
let streamp::data(x, endp) = recv(endp.unwrap());
|
let streamp::data(x, endp) = recv(endp.unwrap());
|
||||||
*self_endp = Some(endp);
|
*self_endp = Some(endp);
|
||||||
|
@ -189,7 +188,7 @@ impl<T: Owned> GenericPort<T> for Port<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn try_recv(&self) -> Option<T> {
|
fn try_recv(&self) -> Option<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut self_endp = transmute_mut(&self.endp);
|
let self_endp = transmute_mut(&self.endp);
|
||||||
let endp = replace(self_endp, None);
|
let endp = replace(self_endp, None);
|
||||||
match try_recv(endp.unwrap()) {
|
match try_recv(endp.unwrap()) {
|
||||||
Some(streamp::data(x, endp)) => {
|
Some(streamp::data(x, endp)) => {
|
||||||
|
@ -206,7 +205,7 @@ impl<T: Owned> Peekable<T> for Port<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn peek(&self) -> bool {
|
fn peek(&self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut self_endp = transmute_mut(&self.endp);
|
let self_endp = transmute_mut(&self.endp);
|
||||||
let mut endp = replace(self_endp, None);
|
let mut endp = replace(self_endp, None);
|
||||||
let peek = match endp {
|
let peek = match endp {
|
||||||
Some(ref mut endp) => peek(endp),
|
Some(ref mut endp) => peek(endp),
|
||||||
|
@ -220,12 +219,10 @@ impl<T: Owned> Peekable<T> for Port<T> {
|
||||||
|
|
||||||
impl<T: Owned> Selectable for Port<T> {
|
impl<T: Owned> Selectable for Port<T> {
|
||||||
fn header(&mut self) -> *mut PacketHeader {
|
fn header(&mut self) -> *mut PacketHeader {
|
||||||
unsafe {
|
|
||||||
match self.endp {
|
match self.endp {
|
||||||
Some(ref mut endp) => endp.header(),
|
Some(ref mut endp) => endp.header(),
|
||||||
None => fail!(~"peeking empty stream")
|
None => fail!(~"peeking empty stream")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +256,7 @@ pub impl<T: Owned> PortSet<T> {
|
||||||
impl<T:Owned> GenericPort<T> for PortSet<T> {
|
impl<T:Owned> GenericPort<T> for PortSet<T> {
|
||||||
fn try_recv(&self) -> Option<T> {
|
fn try_recv(&self) -> Option<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut self_ports = transmute_mut(&self.ports);
|
let self_ports = transmute_mut(&self.ports);
|
||||||
let mut result = None;
|
let mut result = None;
|
||||||
// we have to swap the ports array so we aren't borrowing
|
// we have to swap the ports array so we aren't borrowing
|
||||||
// aliasable mutable memory.
|
// aliasable mutable memory.
|
||||||
|
@ -351,7 +348,7 @@ pub mod oneshot {
|
||||||
pub fn init<T: Owned>() -> (client::Oneshot<T>, server::Oneshot<T>) {
|
pub fn init<T: Owned>() -> (client::Oneshot<T>, server::Oneshot<T>) {
|
||||||
pub use core::pipes::HasBuffer;
|
pub use core::pipes::HasBuffer;
|
||||||
|
|
||||||
let mut buffer = ~::core::pipes::Buffer {
|
let buffer = ~::core::pipes::Buffer {
|
||||||
header: ::core::pipes::BufferHeader(),
|
header: ::core::pipes::BufferHeader(),
|
||||||
data: __Buffer {
|
data: __Buffer {
|
||||||
Oneshot: ::core::pipes::mk_packet::<Oneshot<T>>()
|
Oneshot: ::core::pipes::mk_packet::<Oneshot<T>>()
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
/*! Condition handling */
|
/*! Condition handling */
|
||||||
|
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use task;
|
|
||||||
use local_data::{local_data_pop, local_data_set};
|
use local_data::{local_data_pop, local_data_set};
|
||||||
|
|
||||||
// helper for transmutation, shown below.
|
// helper for transmutation, shown below.
|
||||||
|
|
|
@ -61,7 +61,6 @@ they contained the following prologue:
|
||||||
#[no_core];
|
#[no_core];
|
||||||
|
|
||||||
#[deny(non_camel_case_types)];
|
#[deny(non_camel_case_types)];
|
||||||
#[allow(deprecated_mutable_fields)];
|
|
||||||
|
|
||||||
// Make core testable by not duplicating lang items. See #2912
|
// Make core testable by not duplicating lang items. See #2912
|
||||||
#[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");
|
#[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");
|
||||||
|
|
|
@ -36,7 +36,6 @@ use option::{Some, None};
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use ptr;
|
use ptr;
|
||||||
use str;
|
use str;
|
||||||
use task;
|
|
||||||
use uint;
|
use uint;
|
||||||
use unstable::finally::Finally;
|
use unstable::finally::Finally;
|
||||||
use vec;
|
use vec;
|
||||||
|
|
|
@ -348,7 +348,7 @@ pub fn send<T,Tbuffer>(mut p: SendPacketBuffered<T,Tbuffer>,
|
||||||
payload: T)
|
payload: T)
|
||||||
-> bool {
|
-> bool {
|
||||||
let header = p.header();
|
let header = p.header();
|
||||||
let mut p_ = p.unwrap();
|
let p_ = p.unwrap();
|
||||||
let p = unsafe { &mut *p_ };
|
let p = unsafe { &mut *p_ };
|
||||||
assert!(ptr::to_unsafe_ptr(&(p.header)) == header);
|
assert!(ptr::to_unsafe_ptr(&(p.header)) == header);
|
||||||
assert!(p.payload.is_none());
|
assert!(p.payload.is_none());
|
||||||
|
@ -405,10 +405,8 @@ a message, or `Some(T)` if a message was received.
|
||||||
*/
|
*/
|
||||||
pub fn try_recv<T:Owned,Tbuffer:Owned>(mut p: RecvPacketBuffered<T, Tbuffer>)
|
pub fn try_recv<T:Owned,Tbuffer:Owned>(mut p: RecvPacketBuffered<T, Tbuffer>)
|
||||||
-> Option<T> {
|
-> Option<T> {
|
||||||
let mut p_ = p.unwrap();
|
let p_ = p.unwrap();
|
||||||
let mut p = unsafe {
|
let p = unsafe { &mut *p_ };
|
||||||
&mut *p_
|
|
||||||
};
|
|
||||||
|
|
||||||
do (|| {
|
do (|| {
|
||||||
try_recv_(p)
|
try_recv_(p)
|
||||||
|
|
|
@ -43,7 +43,6 @@ fn main () {
|
||||||
use int;
|
use int;
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use str;
|
use str;
|
||||||
use task;
|
|
||||||
use u32;
|
use u32;
|
||||||
use uint;
|
use uint;
|
||||||
use util;
|
use util;
|
||||||
|
|
|
@ -409,7 +409,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
|
||||||
disr_val: int,
|
disr_val: int,
|
||||||
n_fields: uint,
|
n_fields: uint,
|
||||||
name: &str) -> bool {
|
name: &str) -> bool {
|
||||||
self.inner.push_ptr(); // NOTE remove after next snapshot
|
|
||||||
if ! self.inner.visit_enter_enum_variant(variant, disr_val,
|
if ! self.inner.visit_enter_enum_variant(variant, disr_val,
|
||||||
n_fields, name) {
|
n_fields, name) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -433,7 +432,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
|
||||||
n_fields, name) {
|
n_fields, name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
self.inner.pop_ptr(); // NOTE remove after next snapshot
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,7 @@ pub impl StreamWatcher {
|
||||||
extern fn close_cb(handle: *uvll::uv_stream_t) {
|
extern fn close_cb(handle: *uvll::uv_stream_t) {
|
||||||
let mut stream_watcher: StreamWatcher = NativeHandle::from_native_handle(handle);
|
let mut stream_watcher: StreamWatcher = NativeHandle::from_native_handle(handle);
|
||||||
{
|
{
|
||||||
let mut data = get_watcher_data(&mut stream_watcher);
|
get_watcher_data(&mut stream_watcher).close_cb.swap_unwrap()();
|
||||||
data.close_cb.swap_unwrap()();
|
|
||||||
}
|
}
|
||||||
drop_watcher_data(&mut stream_watcher);
|
drop_watcher_data(&mut stream_watcher);
|
||||||
unsafe { free_handle(handle as *c_void) }
|
unsafe { free_handle(handle as *c_void) }
|
||||||
|
@ -214,8 +213,7 @@ pub impl TcpWatcher {
|
||||||
assert!(get_watcher_data(self).connect_cb.is_none());
|
assert!(get_watcher_data(self).connect_cb.is_none());
|
||||||
get_watcher_data(self).connect_cb = Some(cb);
|
get_watcher_data(self).connect_cb = Some(cb);
|
||||||
|
|
||||||
let mut connect_watcher = ConnectRequest::new();
|
let connect_handle = ConnectRequest::new().native_handle();
|
||||||
let connect_handle = connect_watcher.native_handle();
|
|
||||||
match address {
|
match address {
|
||||||
Ipv4(*) => {
|
Ipv4(*) => {
|
||||||
do ip4_as_uv_ip4(address) |addr| {
|
do ip4_as_uv_ip4(address) |addr| {
|
||||||
|
|
|
@ -46,8 +46,7 @@ impl Drop for UvEventLoop {
|
||||||
let self = unsafe {
|
let self = unsafe {
|
||||||
transmute::<&UvEventLoop, &mut UvEventLoop>(self)
|
transmute::<&UvEventLoop, &mut UvEventLoop>(self)
|
||||||
};
|
};
|
||||||
let mut uv_loop = self.uvio.uv_loop();
|
self.uvio.uv_loop().close();
|
||||||
uv_loop.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,9 +188,8 @@ impl TcpListener for UvTcpListener {
|
||||||
let maybe_stream = if status.is_none() {
|
let maybe_stream = if status.is_none() {
|
||||||
let mut server_stream_watcher = server_stream_watcher;
|
let mut server_stream_watcher = server_stream_watcher;
|
||||||
let mut loop_ = loop_from_watcher(&server_stream_watcher);
|
let mut loop_ = loop_from_watcher(&server_stream_watcher);
|
||||||
let mut client_tcp_watcher = TcpWatcher::new(&mut loop_);
|
let client_tcp_watcher = TcpWatcher::new(&mut loop_).as_stream();
|
||||||
let client_tcp_watcher = client_tcp_watcher.as_stream();
|
// XXX: Needs to be surfaced in interface
|
||||||
// XXX: Need's to be surfaced in interface
|
|
||||||
server_stream_watcher.accept(client_tcp_watcher);
|
server_stream_watcher.accept(client_tcp_watcher);
|
||||||
Some(~UvStream::new(client_tcp_watcher))
|
Some(~UvStream::new(client_tcp_watcher))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -472,7 +472,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
|
||||||
/*##################################################################*
|
/*##################################################################*
|
||||||
* Step 1. Get spawner's taskgroup info.
|
* Step 1. Get spawner's taskgroup info.
|
||||||
*##################################################################*/
|
*##################################################################*/
|
||||||
let mut spawner_group: @@mut TCB =
|
let spawner_group: @@mut TCB =
|
||||||
match local_get(OldHandle(spawner), taskgroup_key!()) {
|
match local_get(OldHandle(spawner), taskgroup_key!()) {
|
||||||
None => {
|
None => {
|
||||||
// Main task, doing first spawn ever. Lazily initialise
|
// Main task, doing first spawn ever. Lazily initialise
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
/*! See doc.rs for a thorough explanation of the borrow checker */
|
/*! See doc.rs for a thorough explanation of the borrow checker */
|
||||||
|
|
||||||
use core;
|
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use mc = middle::mem_categorization;
|
use mc = middle::mem_categorization;
|
||||||
|
@ -22,6 +21,8 @@ use middle::dataflow::DataFlowOperator;
|
||||||
use util::common::stmt_set;
|
use util::common::stmt_set;
|
||||||
use util::ppaux::{note_and_explain_region, Repr};
|
use util::ppaux::{note_and_explain_region, Repr};
|
||||||
|
|
||||||
|
#[cfg(stage0)]
|
||||||
|
use core; // NOTE: this can be removed after the next snapshot
|
||||||
use core::hashmap::{HashSet, HashMap};
|
use core::hashmap::{HashSet, HashMap};
|
||||||
use core::io;
|
use core::io;
|
||||||
use core::result::{Result};
|
use core::result::{Result};
|
||||||
|
|
|
@ -571,8 +571,6 @@ pub impl mem_categorization_ctxt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The `field_id` parameter is the ID of the enclosing expression or
|
|
||||||
/// pattern. It is used to determine which variant of an enum is in use.
|
|
||||||
fn cat_field<N:ast_node>(&self,
|
fn cat_field<N:ast_node>(&self,
|
||||||
node: N,
|
node: N,
|
||||||
base_cmt: cmt,
|
base_cmt: cmt,
|
||||||
|
|
|
@ -60,7 +60,7 @@ use syntax::ast_util::{def_id_of_def, local_def};
|
||||||
use syntax::ast_util::{path_to_ident, walk_pat, trait_method_to_ty_method};
|
use syntax::ast_util::{path_to_ident, walk_pat, trait_method_to_ty_method};
|
||||||
use syntax::ast_util::{Privacy, Public, Private};
|
use syntax::ast_util::{Privacy, Public, Private};
|
||||||
use syntax::ast_util::{variant_visibility_to_privacy, visibility_to_privacy};
|
use syntax::ast_util::{variant_visibility_to_privacy, visibility_to_privacy};
|
||||||
use syntax::attr::{attr_metas, contains_name, attrs_contains_name};
|
use syntax::attr::{attr_metas, contains_name};
|
||||||
use syntax::parse::token::ident_interner;
|
use syntax::parse::token::ident_interner;
|
||||||
use syntax::parse::token::special_idents;
|
use syntax::parse::token::special_idents;
|
||||||
use syntax::print::pprust::path_to_str;
|
use syntax::print::pprust::path_to_str;
|
||||||
|
|
|
@ -28,7 +28,8 @@ use util::ppaux::Repr;
|
||||||
use util::common::{indenter};
|
use util::common::{indenter};
|
||||||
use util::enum_set::{EnumSet, CLike};
|
use util::enum_set::{EnumSet, CLike};
|
||||||
|
|
||||||
use core;
|
#[cfg(stage0)]
|
||||||
|
use core; // NOTE: this can be removed after the next snapshot
|
||||||
use core::ptr::to_unsafe_ptr;
|
use core::ptr::to_unsafe_ptr;
|
||||||
use core::to_bytes;
|
use core::to_bytes;
|
||||||
use core::hashmap::{HashMap, HashSet};
|
use core::hashmap::{HashMap, HashSet};
|
||||||
|
|
|
@ -544,12 +544,13 @@ use middle::typeck::infer::cres;
|
||||||
use util::common::indenter;
|
use util::common::indenter;
|
||||||
use util::ppaux::note_and_explain_region;
|
use util::ppaux::note_and_explain_region;
|
||||||
|
|
||||||
|
#[cfg(stage0)]
|
||||||
|
use core; // NOTE: this can be removed after next snapshot
|
||||||
use core::cell::{Cell, empty_cell};
|
use core::cell::{Cell, empty_cell};
|
||||||
use core::hashmap::{HashMap, HashSet};
|
use core::hashmap::{HashMap, HashSet};
|
||||||
use core::to_bytes;
|
use core::to_bytes;
|
||||||
use core::uint;
|
use core::uint;
|
||||||
use core::vec;
|
use core::vec;
|
||||||
use core;
|
|
||||||
use syntax::codemap::span;
|
use syntax::codemap::span;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
|
||||||
|
|
|
@ -634,13 +634,6 @@ pub mod writer {
|
||||||
use core::vec;
|
use core::vec;
|
||||||
|
|
||||||
// ebml writing
|
// ebml writing
|
||||||
#[cfg(stage0)]
|
|
||||||
pub struct Encoder {
|
|
||||||
writer: @io::Writer,
|
|
||||||
priv mut size_positions: ~[uint],
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))]
|
|
||||||
pub struct Encoder {
|
pub struct Encoder {
|
||||||
writer: @io::Writer,
|
writer: @io::Writer,
|
||||||
priv size_positions: ~[uint],
|
priv size_positions: ~[uint],
|
||||||
|
|
|
@ -94,8 +94,6 @@ total line count).
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#[allow(deprecated_mutable_fields)];
|
|
||||||
|
|
||||||
use core::io::ReaderUtil;
|
use core::io::ReaderUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,8 +210,8 @@ impl FileInput {
|
||||||
pub fn next_file(&self) -> bool {
|
pub fn next_file(&self) -> bool {
|
||||||
// No more files
|
// No more files
|
||||||
|
|
||||||
// Compiler whines about "illegal borrow unless pure" for
|
// unsafe block can be removed after the next snapshot
|
||||||
// files.is_empty()
|
// (next one after 2013-05-03)
|
||||||
if unsafe { self.fi.files.is_empty() } {
|
if unsafe { self.fi.files.is_empty() } {
|
||||||
self.fi.current_reader = None;
|
self.fi.current_reader = None;
|
||||||
return false;
|
return false;
|
||||||
|
@ -337,7 +335,8 @@ impl io::Reader for FileInput {
|
||||||
fn eof(&self) -> bool {
|
fn eof(&self) -> bool {
|
||||||
// we've run out of files, and current_reader is either None or eof.
|
// we've run out of files, and current_reader is either None or eof.
|
||||||
|
|
||||||
// compiler whines about illegal borrows for files.is_empty()
|
// unsafe block can be removed after the next snapshot
|
||||||
|
// (next one after 2013-05-03)
|
||||||
(unsafe { self.fi.files.is_empty() }) &&
|
(unsafe { self.fi.files.is_empty() }) &&
|
||||||
match self.fi.current_reader { None => true, Some(r) => r.eof() }
|
match self.fi.current_reader { None => true, Some(r) => r.eof() }
|
||||||
|
|
||||||
|
@ -380,8 +379,7 @@ Fails when attempting to read from a file that can't be opened.
|
||||||
*/
|
*/
|
||||||
#[cfg(stage0)]
|
#[cfg(stage0)]
|
||||||
pub fn input(f: &fn(&str) -> bool) {
|
pub fn input(f: &fn(&str) -> bool) {
|
||||||
let mut i = FileInput::from_args();
|
FileInput::from_args().each_line(f);
|
||||||
i.each_line(f);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
Iterate directly over the command line arguments (no arguments implies
|
Iterate directly over the command line arguments (no arguments implies
|
||||||
|
@ -391,7 +389,7 @@ Fails when attempting to read from a file that can't be opened.
|
||||||
*/
|
*/
|
||||||
#[cfg(not(stage0))]
|
#[cfg(not(stage0))]
|
||||||
pub fn input(f: &fn(&str) -> bool) -> bool {
|
pub fn input(f: &fn(&str) -> bool) -> bool {
|
||||||
let mut i = FileInput::from_args();
|
let i = FileInput::from_args();
|
||||||
i.each_line(f)
|
i.each_line(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,8 +402,7 @@ Fails when attempting to read from a file that can't be opened.
|
||||||
*/
|
*/
|
||||||
#[cfg(stage0)]
|
#[cfg(stage0)]
|
||||||
pub fn input_state(f: &fn(&str, FileInputState) -> bool) {
|
pub fn input_state(f: &fn(&str, FileInputState) -> bool) {
|
||||||
let mut i = FileInput::from_args();
|
FileInput::from_args().each_line_state(f);
|
||||||
i.each_line_state(f);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
Iterate directly over the command line arguments (no arguments
|
Iterate directly over the command line arguments (no arguments
|
||||||
|
@ -416,7 +413,7 @@ Fails when attempting to read from a file that can't be opened.
|
||||||
*/
|
*/
|
||||||
#[cfg(not(stage0))]
|
#[cfg(not(stage0))]
|
||||||
pub fn input_state(f: &fn(&str, FileInputState) -> bool) -> bool {
|
pub fn input_state(f: &fn(&str, FileInputState) -> bool) -> bool {
|
||||||
let mut i = FileInput::from_args();
|
let i = FileInput::from_args();
|
||||||
i.each_line_state(f)
|
i.each_line_state(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,8 +424,7 @@ Fails when attempting to read from a file that can't be opened.
|
||||||
*/
|
*/
|
||||||
#[cfg(stage0)]
|
#[cfg(stage0)]
|
||||||
pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) {
|
pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) {
|
||||||
let mut i = FileInput::from_vec(files);
|
FileInput::from_vec(files).each_line(f);
|
||||||
i.each_line(f);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
Iterate over a vector of files (an empty vector implies just `stdin`).
|
Iterate over a vector of files (an empty vector implies just `stdin`).
|
||||||
|
@ -437,7 +433,7 @@ Fails when attempting to read from a file that can't be opened.
|
||||||
*/
|
*/
|
||||||
#[cfg(not(stage0))]
|
#[cfg(not(stage0))]
|
||||||
pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) -> bool {
|
pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) -> bool {
|
||||||
let mut i = FileInput::from_vec(files);
|
let i = FileInput::from_vec(files);
|
||||||
i.each_line(f)
|
i.each_line(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,8 +446,7 @@ Fails when attempting to read from a file that can't be opened.
|
||||||
#[cfg(stage0)]
|
#[cfg(stage0)]
|
||||||
pub fn input_vec_state(files: ~[Option<Path>],
|
pub fn input_vec_state(files: ~[Option<Path>],
|
||||||
f: &fn(&str, FileInputState) -> bool) {
|
f: &fn(&str, FileInputState) -> bool) {
|
||||||
let mut i = FileInput::from_vec(files);
|
FileInput::from_vec(files).each_line_state(f);
|
||||||
i.each_line_state(f);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
Iterate over a vector of files (an empty vector implies just `stdin`)
|
Iterate over a vector of files (an empty vector implies just `stdin`)
|
||||||
|
@ -462,7 +457,7 @@ Fails when attempting to read from a file that can't be opened.
|
||||||
#[cfg(not(stage0))]
|
#[cfg(not(stage0))]
|
||||||
pub fn input_vec_state(files: ~[Option<Path>],
|
pub fn input_vec_state(files: ~[Option<Path>],
|
||||||
f: &fn(&str, FileInputState) -> bool) -> bool {
|
f: &fn(&str, FileInputState) -> bool) -> bool {
|
||||||
let mut i = FileInput::from_vec(files);
|
let i = FileInput::from_vec(files);
|
||||||
i.each_line_state(f)
|
i.each_line_state(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,17 +29,12 @@ use core::task;
|
||||||
use core::util::replace;
|
use core::util::replace;
|
||||||
|
|
||||||
#[doc = "The future type"]
|
#[doc = "The future type"]
|
||||||
#[cfg(stage0)]
|
|
||||||
pub struct Future<A> {
|
|
||||||
priv mut state: FutureState<A>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[doc = "The future type"]
|
|
||||||
#[cfg(not(stage0))]
|
|
||||||
pub struct Future<A> {
|
pub struct Future<A> {
|
||||||
priv state: FutureState<A>,
|
priv state: FutureState<A>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// n.b. It should be possible to get rid of this.
|
||||||
|
// Add a test, though -- tjc
|
||||||
// FIXME(#2829) -- futures should not be copyable, because they close
|
// FIXME(#2829) -- futures should not be copyable, because they close
|
||||||
// over ~fn's that have pipes and so forth within!
|
// over ~fn's that have pipes and so forth within!
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
@ -62,37 +57,6 @@ pub impl<A:Copy> Future<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub impl<A> Future<A> {
|
pub impl<A> Future<A> {
|
||||||
#[cfg(stage0)]
|
|
||||||
fn get_ref<'a>(&'a self) -> &'a A {
|
|
||||||
/*!
|
|
||||||
* Executes the future's closure and then returns a borrowed
|
|
||||||
* pointer to the result. The borrowed pointer lasts as long as
|
|
||||||
* the future.
|
|
||||||
*/
|
|
||||||
unsafe {
|
|
||||||
{
|
|
||||||
match self.state {
|
|
||||||
Forced(ref mut v) => { return cast::transmute(v); }
|
|
||||||
Evaluating => fail!(~"Recursive forcing of future!"),
|
|
||||||
Pending(_) => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
let state = replace(&mut self.state, Evaluating);
|
|
||||||
match state {
|
|
||||||
Forced(_) | Evaluating => fail!(~"Logic error."),
|
|
||||||
Pending(f) => {
|
|
||||||
self.state = Forced(f());
|
|
||||||
cast::transmute(self.get_ref())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(stage1)]
|
|
||||||
#[cfg(stage2)]
|
|
||||||
#[cfg(stage3)]
|
|
||||||
fn get_ref<'a>(&'a mut self) -> &'a A {
|
fn get_ref<'a>(&'a mut self) -> &'a A {
|
||||||
/*!
|
/*!
|
||||||
* Executes the future's closure and then returns a borrowed
|
* Executes the future's closure and then returns a borrowed
|
||||||
|
|
|
@ -220,13 +220,6 @@ impl serialize::Encoder for Encoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(stage0)]
|
|
||||||
pub struct PrettyEncoder {
|
|
||||||
priv wr: @io::Writer,
|
|
||||||
priv mut indent: uint,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))]
|
|
||||||
pub struct PrettyEncoder {
|
pub struct PrettyEncoder {
|
||||||
priv wr: @io::Writer,
|
priv wr: @io::Writer,
|
||||||
priv indent: uint,
|
priv indent: uint,
|
||||||
|
@ -845,12 +838,6 @@ pub fn from_str(s: &str) -> Result<Json, Error> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(stage0)]
|
|
||||||
pub struct Decoder {
|
|
||||||
priv mut stack: ~[Json],
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))]
|
|
||||||
pub struct Decoder {
|
pub struct Decoder {
|
||||||
priv stack: ~[Json],
|
priv stack: ~[Json],
|
||||||
}
|
}
|
||||||
|
|
|
@ -972,19 +972,17 @@ impl io::Reader for TcpSocketBuf {
|
||||||
/// Implementation of `io::Reader` trait for a buffered `net::tcp::TcpSocket`
|
/// Implementation of `io::Reader` trait for a buffered `net::tcp::TcpSocket`
|
||||||
impl io::Writer for TcpSocketBuf {
|
impl io::Writer for TcpSocketBuf {
|
||||||
pub fn write(&self, data: &[u8]) {
|
pub fn write(&self, data: &[u8]) {
|
||||||
unsafe {
|
let socket_data_ptr: *TcpSocketData =
|
||||||
let socket_data_ptr: *TcpSocketData =
|
&(*((*(self.data)).sock).socket_data);
|
||||||
&(*((*(self.data)).sock).socket_data);
|
let w_result = write_common_impl(socket_data_ptr,
|
||||||
let w_result = write_common_impl(socket_data_ptr,
|
vec::slice(data,
|
||||||
vec::slice(data,
|
0,
|
||||||
0,
|
data.len()).to_vec());
|
||||||
data.len()).to_vec());
|
if w_result.is_err() {
|
||||||
if w_result.is_err() {
|
let err_data = w_result.get_err();
|
||||||
let err_data = w_result.get_err();
|
debug!(
|
||||||
debug!(
|
"ERROR sock_buf as io::writer.writer err: %? %?",
|
||||||
"ERROR sock_buf as io::writer.writer err: %? %?",
|
err_data.err_name, err_data.err_msg);
|
||||||
err_data.err_name, err_data.err_msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn seek(&self, dist: int, seek: io::SeekStyle) {
|
fn seek(&self, dist: int, seek: io::SeekStyle) {
|
||||||
|
|
|
@ -16,8 +16,6 @@ A BigUint is represented as an array of BigDigits.
|
||||||
A BigInt is a combination of BigUint and Sign.
|
A BigInt is a combination of BigUint and Sign.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#[deny(deprecated_mutable_fields)];
|
|
||||||
|
|
||||||
use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
|
use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
|
||||||
use core::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix};
|
use core::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix};
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,6 @@ not required in or otherwise suitable for the core library.
|
||||||
|
|
||||||
#[deny(non_camel_case_types)];
|
#[deny(non_camel_case_types)];
|
||||||
|
|
||||||
// Allow mutable fields only in stage0.
|
|
||||||
#[warn(deprecated_mutable_fields)];
|
|
||||||
|
|
||||||
pub mod uv_ll;
|
pub mod uv_ll;
|
||||||
|
|
||||||
// General io and system-services modules
|
// General io and system-services modules
|
||||||
|
|
|
@ -410,9 +410,10 @@ type MonitorMsg = (TestDesc, TestResult);
|
||||||
fn run_tests(opts: &TestOpts,
|
fn run_tests(opts: &TestOpts,
|
||||||
tests: ~[TestDescAndFn],
|
tests: ~[TestDescAndFn],
|
||||||
callback: @fn(e: TestEvent)) {
|
callback: @fn(e: TestEvent)) {
|
||||||
let mut filtered_tests = filter_tests(opts, tests);
|
|
||||||
|
|
||||||
|
let filtered_tests = filter_tests(opts, tests);
|
||||||
let filtered_descs = filtered_tests.map(|t| copy t.desc);
|
let filtered_descs = filtered_tests.map(|t| copy t.desc);
|
||||||
|
|
||||||
callback(TeFiltered(filtered_descs));
|
callback(TeFiltered(filtered_descs));
|
||||||
|
|
||||||
let (filtered_tests, filtered_benchs) =
|
let (filtered_tests, filtered_benchs) =
|
||||||
|
|
|
@ -16,7 +16,6 @@ use opt_vec::OptVec;
|
||||||
|
|
||||||
use core::cast;
|
use core::cast;
|
||||||
use core::option::{None, Option, Some};
|
use core::option::{None, Option, Some};
|
||||||
use core::task;
|
|
||||||
use core::to_bytes;
|
use core::to_bytes;
|
||||||
use core::to_str::ToStr;
|
use core::to_str::ToStr;
|
||||||
use std::serialize::{Encodable, Decodable, Encoder, Decoder};
|
use std::serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||||
|
|
|
@ -27,7 +27,6 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
|
||||||
fld: @ast_fold,
|
fld: @ast_fold,
|
||||||
orig: @fn(&expr_, span, @ast_fold) -> (expr_, span))
|
orig: @fn(&expr_, span, @ast_fold) -> (expr_, span))
|
||||||
-> (expr_, span) {
|
-> (expr_, span) {
|
||||||
let mut cx = cx;
|
|
||||||
match *e {
|
match *e {
|
||||||
// expr_mac should really be expr_ext or something; it's the
|
// expr_mac should really be expr_ext or something; it's the
|
||||||
// entry-point for all syntax extensions.
|
// entry-point for all syntax extensions.
|
||||||
|
@ -113,7 +112,6 @@ pub fn expand_mod_items(extsbox: @mut SyntaxEnv,
|
||||||
fld: @ast_fold,
|
fld: @ast_fold,
|
||||||
orig: @fn(&ast::_mod, @ast_fold) -> ast::_mod)
|
orig: @fn(&ast::_mod, @ast_fold) -> ast::_mod)
|
||||||
-> ast::_mod {
|
-> ast::_mod {
|
||||||
let mut cx = cx;
|
|
||||||
|
|
||||||
// Fold the contents first:
|
// Fold the contents first:
|
||||||
let module_ = orig(module_, fld);
|
let module_ = orig(module_, fld);
|
||||||
|
|
|
@ -74,7 +74,7 @@ pub fn expand_proto(cx: @ext_ctxt, _sp: span, id: ast::ident,
|
||||||
let rdr = tt_rdr as @reader;
|
let rdr = tt_rdr as @reader;
|
||||||
let rust_parser = Parser(sess, cfg, rdr.dup());
|
let rust_parser = Parser(sess, cfg, rdr.dup());
|
||||||
|
|
||||||
let mut proto = rust_parser.parse_proto(cx.str_of(id));
|
let proto = rust_parser.parse_proto(cx.str_of(id));
|
||||||
|
|
||||||
// check for errors
|
// check for errors
|
||||||
visit(proto, cx);
|
visit(proto, cx);
|
||||||
|
|
|
@ -247,8 +247,8 @@ pub fn parse(
|
||||||
let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();
|
let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();
|
||||||
|
|
||||||
/* we append new items to this while we go */
|
/* we append new items to this while we go */
|
||||||
while cur_eis.len() > 0u { /* for each Earley Item */
|
while !cur_eis.is_empty() { /* for each Earley Item */
|
||||||
let mut ei = cur_eis.pop();
|
let ei = cur_eis.pop();
|
||||||
|
|
||||||
let idx = ei.idx;
|
let idx = ei.idx;
|
||||||
let len = ei.elts.len();
|
let len = ei.elts.len();
|
||||||
|
|
|
@ -202,15 +202,14 @@ fn all_whitespace(s: ~str, begin: uint, end: uint) -> bool {
|
||||||
|
|
||||||
fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
|
fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
|
||||||
s: ~str, col: CharPos) {
|
s: ~str, col: CharPos) {
|
||||||
let mut s1;
|
let len = s.len();
|
||||||
let len = str::len(s);
|
|
||||||
// FIXME #3961: Doing bytewise comparison and slicing with CharPos
|
// FIXME #3961: Doing bytewise comparison and slicing with CharPos
|
||||||
let col = col.to_uint();
|
let col = col.to_uint();
|
||||||
if all_whitespace(s, 0u, uint::min(len, col)) {
|
let s1 = if all_whitespace(s, 0, uint::min(len, col)) {
|
||||||
if col < len {
|
if col < len {
|
||||||
s1 = str::slice(s, col, len).to_owned();
|
str::slice(s, col, len).to_owned()
|
||||||
} else { s1 = ~""; }
|
} else { ~"" }
|
||||||
} else { s1 = s; }
|
} else { s };
|
||||||
debug!("pushing line: %s", s1);
|
debug!("pushing line: %s", s1);
|
||||||
lines.push(s1);
|
lines.push(s1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue