Skip to content

Warnings #6431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/compiletest/compiletest.rc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#[allow(vecs_implicitly_copyable)];
#[allow(non_camel_case_types)];
#[allow(deprecated_mode)];
#[allow(deprecated_pattern)];

extern mod std(vers = "0.7-pre");
Expand Down
17 changes: 7 additions & 10 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Message passing
*/

use cast::{transmute, transmute_mut};
use cast;
use either::{Either, Left, Right};
use kinds::Owned;
use option::{Option, Some, None};
Expand Down Expand Up @@ -150,7 +149,7 @@ impl<T: Owned> GenericChan<T> for Chan<T> {
#[inline(always)]
fn send(&self, x: T) {
unsafe {
let mut self_endp = transmute_mut(&self.endp);
let self_endp = transmute_mut(&self.endp);
let endp = replace(self_endp, None);
*self_endp = Some(streamp::client::data(endp.unwrap(), x))
}
Expand All @@ -161,7 +160,7 @@ impl<T: Owned> GenericSmartChan<T> for Chan<T> {
#[inline(always)]
fn try_send(&self, x: T) -> bool {
unsafe {
let mut self_endp = transmute_mut(&self.endp);
let self_endp = transmute_mut(&self.endp);
let endp = replace(self_endp, None);
match streamp::client::try_data(endp.unwrap(), x) {
Some(next) => {
Expand All @@ -178,7 +177,7 @@ impl<T: Owned> GenericPort<T> for Port<T> {
#[inline(always)]
fn recv(&self) -> T {
unsafe {
let mut self_endp = transmute_mut(&self.endp);
let self_endp = transmute_mut(&self.endp);
let endp = replace(self_endp, None);
let streamp::data(x, endp) = recv(endp.unwrap());
*self_endp = Some(endp);
Expand All @@ -189,7 +188,7 @@ impl<T: Owned> GenericPort<T> for Port<T> {
#[inline(always)]
fn try_recv(&self) -> Option<T> {
unsafe {
let mut self_endp = transmute_mut(&self.endp);
let self_endp = transmute_mut(&self.endp);
let endp = replace(self_endp, None);
match try_recv(endp.unwrap()) {
Some(streamp::data(x, endp)) => {
Expand All @@ -206,7 +205,7 @@ impl<T: Owned> Peekable<T> for Port<T> {
#[inline(always)]
fn peek(&self) -> bool {
unsafe {
let mut self_endp = transmute_mut(&self.endp);
let self_endp = transmute_mut(&self.endp);
let mut endp = replace(self_endp, None);
let peek = match endp {
Some(ref mut endp) => peek(endp),
Expand All @@ -220,12 +219,10 @@ impl<T: Owned> Peekable<T> for Port<T> {

impl<T: Owned> Selectable for Port<T> {
fn header(&mut self) -> *mut PacketHeader {
unsafe {
match self.endp {
Some(ref mut endp) => endp.header(),
None => fail!(~"peeking empty stream")
}
}
}
}

Expand Down Expand Up @@ -259,7 +256,7 @@ pub impl<T: Owned> PortSet<T> {
impl<T:Owned> GenericPort<T> for PortSet<T> {
fn try_recv(&self) -> Option<T> {
unsafe {
let mut self_ports = transmute_mut(&self.ports);
let self_ports = transmute_mut(&self.ports);
let mut result = None;
// we have to swap the ports array so we aren't borrowing
// aliasable mutable memory.
Expand Down Expand Up @@ -351,7 +348,7 @@ pub mod oneshot {
pub fn init<T: Owned>() -> (client::Oneshot<T>, server::Oneshot<T>) {
pub use core::pipes::HasBuffer;

let mut buffer = ~::core::pipes::Buffer {
let buffer = ~::core::pipes::Buffer {
header: ::core::pipes::BufferHeader(),
data: __Buffer {
Oneshot: ::core::pipes::mk_packet::<Oneshot<T>>()
Expand Down
1 change: 0 additions & 1 deletion src/libcore/condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/*! Condition handling */

use prelude::*;
use task;
use local_data::{local_data_pop, local_data_set};

// helper for transmutation, shown below.
Expand Down
1 change: 0 additions & 1 deletion src/libcore/core.rc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ they contained the following prologue:
#[no_core];

#[deny(non_camel_case_types)];
#[allow(deprecated_mutable_fields)];

// Make core testable by not duplicating lang items. See #2912
#[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");
Expand Down
1 change: 0 additions & 1 deletion src/libcore/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ use option::{Some, None};
use prelude::*;
use ptr;
use str;
use task;
use uint;
use unstable::finally::Finally;
use vec;
Expand Down
8 changes: 3 additions & 5 deletions src/libcore/pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ pub fn send<T,Tbuffer>(mut p: SendPacketBuffered<T,Tbuffer>,
payload: T)
-> bool {
let header = p.header();
let mut p_ = p.unwrap();
let p_ = p.unwrap();
let p = unsafe { &mut *p_ };
assert!(ptr::to_unsafe_ptr(&(p.header)) == header);
assert!(p.payload.is_none());
Expand Down Expand Up @@ -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>)
-> Option<T> {
let mut p_ = p.unwrap();
let mut p = unsafe {
&mut *p_
};
let p_ = p.unwrap();
let p = unsafe { &mut *p_ };

do (|| {
try_recv_(p)
Expand Down
1 change: 0 additions & 1 deletion src/libcore/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ fn main () {
use int;
use prelude::*;
use str;
use task;
use u32;
use uint;
use util;
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
disr_val: int,
n_fields: uint,
name: &str) -> bool {
self.inner.push_ptr(); // NOTE remove after next snapshot
if ! self.inner.visit_enter_enum_variant(variant, disr_val,
n_fields, name) {
return false;
Expand All @@ -433,7 +432,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
n_fields, name) {
return false;
}
self.inner.pop_ptr(); // NOTE remove after next snapshot
true
}

Expand Down
6 changes: 2 additions & 4 deletions src/libcore/rt/uv/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ pub impl StreamWatcher {
extern fn close_cb(handle: *uvll::uv_stream_t) {
let mut stream_watcher: StreamWatcher = NativeHandle::from_native_handle(handle);
{
let mut data = get_watcher_data(&mut stream_watcher);
data.close_cb.swap_unwrap()();
get_watcher_data(&mut stream_watcher).close_cb.swap_unwrap()();
}
drop_watcher_data(&mut stream_watcher);
unsafe { free_handle(handle as *c_void) }
Expand Down Expand Up @@ -214,8 +213,7 @@ pub impl TcpWatcher {
assert!(get_watcher_data(self).connect_cb.is_none());
get_watcher_data(self).connect_cb = Some(cb);

let mut connect_watcher = ConnectRequest::new();
let connect_handle = connect_watcher.native_handle();
let connect_handle = ConnectRequest::new().native_handle();
match address {
Ipv4(*) => {
do ip4_as_uv_ip4(address) |addr| {
Expand Down
8 changes: 3 additions & 5 deletions src/libcore/rt/uvio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ impl Drop for UvEventLoop {
let self = unsafe {
transmute::<&UvEventLoop, &mut UvEventLoop>(self)
};
let mut uv_loop = self.uvio.uv_loop();
uv_loop.close();
self.uvio.uv_loop().close();
}
}

Expand Down Expand Up @@ -189,9 +188,8 @@ impl TcpListener for UvTcpListener {
let maybe_stream = if status.is_none() {
let mut server_stream_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 = client_tcp_watcher.as_stream();
// XXX: Need's to be surfaced in interface
let client_tcp_watcher = TcpWatcher::new(&mut loop_).as_stream();
// XXX: Needs to be surfaced in interface
server_stream_watcher.accept(client_tcp_watcher);
Some(~UvStream::new(client_tcp_watcher))
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/task/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
/*##################################################################*
* 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!()) {
None => {
// Main task, doing first spawn ever. Lazily initialise
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/middle/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

/*! See doc.rs for a thorough explanation of the borrow checker */

use core;
use core::prelude::*;

use mc = middle::mem_categorization;
Expand All @@ -22,6 +21,8 @@ use middle::dataflow::DataFlowOperator;
use util::common::stmt_set;
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::io;
use core::result::{Result};
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
node: N,
base_cmt: cmt,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{Privacy, Public, Private};
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::special_idents;
use syntax::print::pprust::path_to_str;
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ use util::ppaux::Repr;
use util::common::{indenter};
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::to_bytes;
use core::hashmap::{HashMap, HashSet};
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/middle/typeck/infer/region_inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,13 @@ use middle::typeck::infer::cres;
use util::common::indenter;
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::hashmap::{HashMap, HashSet};
use core::to_bytes;
use core::uint;
use core::vec;
use core;
use syntax::codemap::span;
use syntax::ast;

Expand Down
7 changes: 0 additions & 7 deletions src/libstd/ebml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,6 @@ pub mod writer {
use core::vec;

// ebml writing
#[cfg(stage0)]
pub struct Encoder {
writer: @io::Writer,
priv mut size_positions: ~[uint],
}

#[cfg(not(stage0))]
pub struct Encoder {
writer: @io::Writer,
priv size_positions: ~[uint],
Expand Down
29 changes: 12 additions & 17 deletions src/libstd/fileinput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ total line count).
}
*/

#[allow(deprecated_mutable_fields)];

use core::io::ReaderUtil;

/**
Expand Down Expand Up @@ -212,8 +210,8 @@ impl FileInput {
pub fn next_file(&self) -> bool {
// No more files

// Compiler whines about "illegal borrow unless pure" for
// files.is_empty()
// unsafe block can be removed after the next snapshot
// (next one after 2013-05-03)
if unsafe { self.fi.files.is_empty() } {
self.fi.current_reader = None;
return false;
Expand Down Expand Up @@ -337,7 +335,8 @@ impl io::Reader for FileInput {
fn eof(&self) -> bool {
// 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() }) &&
match self.fi.current_reader { None => true, Some(r) => r.eof() }

Expand Down Expand Up @@ -380,8 +379,7 @@ Fails when attempting to read from a file that can't be opened.
*/
#[cfg(stage0)]
pub fn input(f: &fn(&str) -> bool) {
let mut i = FileInput::from_args();
i.each_line(f);
FileInput::from_args().each_line(f);
}
/**
Iterate directly over the command line arguments (no arguments implies
Expand All @@ -391,7 +389,7 @@ Fails when attempting to read from a file that can't be opened.
*/
#[cfg(not(stage0))]
pub fn input(f: &fn(&str) -> bool) -> bool {
let mut i = FileInput::from_args();
let i = FileInput::from_args();
i.each_line(f)
}

Expand All @@ -404,8 +402,7 @@ Fails when attempting to read from a file that can't be opened.
*/
#[cfg(stage0)]
pub fn input_state(f: &fn(&str, FileInputState) -> bool) {
let mut i = FileInput::from_args();
i.each_line_state(f);
FileInput::from_args().each_line_state(f);
}
/**
Iterate directly over the command line arguments (no arguments
Expand All @@ -416,7 +413,7 @@ Fails when attempting to read from a file that can't be opened.
*/
#[cfg(not(stage0))]
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)
}

Expand All @@ -427,8 +424,7 @@ Fails when attempting to read from a file that can't be opened.
*/
#[cfg(stage0)]
pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) {
let mut i = FileInput::from_vec(files);
i.each_line(f);
FileInput::from_vec(files).each_line(f);
}
/**
Iterate over a vector of files (an empty vector implies just `stdin`).
Expand All @@ -437,7 +433,7 @@ Fails when attempting to read from a file that can't be opened.
*/
#[cfg(not(stage0))]
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)
}

Expand All @@ -450,8 +446,7 @@ Fails when attempting to read from a file that can't be opened.
#[cfg(stage0)]
pub fn input_vec_state(files: ~[Option<Path>],
f: &fn(&str, FileInputState) -> bool) {
let mut i = FileInput::from_vec(files);
i.each_line_state(f);
FileInput::from_vec(files).each_line_state(f);
}
/**
Iterate over a vector of files (an empty vector implies just `stdin`)
Expand All @@ -462,7 +457,7 @@ Fails when attempting to read from a file that can't be opened.
#[cfg(not(stage0))]
pub fn input_vec_state(files: ~[Option<Path>],
f: &fn(&str, FileInputState) -> bool) -> bool {
let mut i = FileInput::from_vec(files);
let i = FileInput::from_vec(files);
i.each_line_state(f)
}

Expand Down
Loading