From a33b7441db5c2835d93837725e17dd809309cbe4 Mon Sep 17 00:00:00 2001 From: Adolfo Ochagavía Date: Tue, 28 Oct 2014 15:53:09 +0100 Subject: Add ptr::RawMutPtr to prelude Closes https://github.com/rust-lang/rust/issues/18196 --- src/libstd/prelude.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index db9f3114cda..48be404b0d0 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -76,7 +76,7 @@ #[doc(no_inline)] pub use num::{FloatMath, ToPrimitive, FromPrimitive}; #[doc(no_inline)] pub use boxed::Box; #[doc(no_inline)] pub use path::{GenericPath, Path, PosixPath, WindowsPath}; -#[doc(no_inline)] pub use ptr::RawPtr; +#[doc(no_inline)] pub use ptr::{RawPtr, RawMutPtr}; #[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek}; #[doc(no_inline)] pub use str::{Str, StrVector, StrSlice}; #[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrSlice}; -- cgit 1.4.1-3-g733a5 From 012cc6dd04f18d960e952991c2db929f3b1ff72f Mon Sep 17 00:00:00 2001 From: Adolfo Ochagavía Date: Tue, 28 Oct 2014 16:32:24 +0100 Subject: Remove unnecessary clone in ascii.rs --- src/libstd/ascii.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index c2e88bfdbcf..98445efafd2 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -330,8 +330,7 @@ impl IntoStr for Vec { #[inline] fn into_string(self) -> String { unsafe { - let s: &str = mem::transmute(self.as_slice()); - String::from_str(s) + string::raw::from_utf8(self.into_bytes()) } } } -- cgit 1.4.1-3-g733a5 From e0ad0fcb95f0bd6e69e9032c23b66515a590dfe5 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Mon, 27 Oct 2014 15:37:07 -0700 Subject: Update code with new lint names --- src/libarena/lib.rs | 2 +- src/libcollections/priority_queue.rs | 2 +- src/libcollections/slice.rs | 2 +- src/libcollections/smallintmap.rs | 2 +- src/libcore/failure.rs | 4 +-- src/libcore/fmt/float.rs | 2 +- src/libcore/fmt/mod.rs | 4 +-- src/libcore/fmt/num.rs | 2 +- src/libcore/intrinsics.rs | 2 +- src/libcore/lib.rs | 2 +- src/libcore/num/f32.rs | 2 +- src/libcore/num/f64.rs | 2 +- src/libcore/num/mod.rs | 2 +- src/libcore/raw.rs | 2 +- src/libcore/simd.rs | 2 +- src/libcore/str.rs | 4 +-- src/libcore/tuple/mod.rs | 8 +++--- src/libcoretest/fmt/num.rs | 2 +- src/libgetopts/lib.rs | 4 +-- src/liblibc/lib.rs | 4 +-- src/liblog/lib.rs | 2 +- src/libnative/io/c_windows.rs | 2 +- src/libnative/lib.rs | 2 +- src/librand/isaac.rs | 2 +- src/librbml/lib.rs | 2 +- src/libregex/lib.rs | 2 +- src/libregex_macros/lib.rs | 4 +-- src/librustc/driver/config.rs | 4 +-- src/librustc/lint/builtin.rs | 22 +++++++-------- src/librustc/lint/mod.rs | 2 +- src/librustc/metadata/common.rs | 2 +- src/librustc/metadata/decoder.rs | 4 +-- src/librustc/metadata/encoder.rs | 2 +- src/librustc/middle/borrowck/move_data.rs | 4 +-- src/librustc/middle/const_eval.rs | 2 +- src/librustc/middle/graph.rs | 8 +++--- src/librustc/middle/resolve.rs | 2 +- src/librustc/middle/trans/adt.rs | 6 ++-- src/librustc/middle/trans/cabi_arm.rs | 2 +- src/librustc/middle/trans/cabi_mips.rs | 2 +- src/librustc/middle/trans/cabi_x86_64.rs | 2 +- src/librustc/middle/trans/debuginfo.rs | 14 +++++----- src/librustc/middle/trans/intrinsic.rs | 2 +- src/librustc/middle/trans/type_.rs | 2 +- src/librustc/middle/ty.rs | 4 +-- src/librustc/middle/typeck/infer/resolve.rs | 2 +- src/librustc_back/abi.rs | 2 +- src/librustc_llvm/lib.rs | 2 +- src/librustdoc/test.rs | 2 +- src/librustrt/libunwind.rs | 2 +- src/librustrt/local_data.rs | 2 +- src/librustrt/util.rs | 4 +-- src/libserialize/json.rs | 2 +- src/libstd/bitflags.rs | 2 +- src/libstd/dynamic_lib.rs | 2 +- src/libstd/io/extensions.rs | 2 +- src/libstd/io/mod.rs | 32 +++++++++++----------- src/libstd/io/net/addrinfo.rs | 4 +-- src/libstd/io/net/ip.rs | 2 +- src/libstd/io/net/pipe.rs | 2 +- src/libstd/io/pipe.rs | 2 +- src/libstd/io/process.rs | 2 +- src/libstd/lib.rs | 2 +- src/libstd/macros.rs | 4 +-- src/libstd/num/f32.rs | 4 +-- src/libstd/num/f64.rs | 2 +- src/libstd/num/mod.rs | 2 +- src/libstd/num/strconv.rs | 2 +- src/libstd/num/uint_macros.rs | 2 +- src/libstd/os.rs | 2 +- src/libstd/path/posix.rs | 4 +-- src/libstd/rand/os.rs | 2 +- src/libstd/rt/mod.rs | 2 +- src/libstd/sync/future.rs | 2 +- src/libsync/lib.rs | 2 +- src/libsync/mpmc_bounded_queue.rs | 2 +- src/libsyntax/abi.rs | 6 ++-- src/libsyntax/ast_util.rs | 2 +- src/libsyntax/parse/token.rs | 4 +-- src/libsyntax/print/pprust.rs | 4 +-- src/libterm/lib.rs | 2 +- src/libterm/terminfo/parm.rs | 2 +- src/libterm/terminfo/parser/compiled.rs | 2 +- src/libtest/stats.rs | 4 +-- src/libunicode/tables.rs | 2 +- .../syntax-extension-regex-unused-static.rs | 4 +-- .../syntax-extension-regex-unused.rs | 2 +- src/test/compile-fail/asm-misplaced-option.rs | 2 +- src/test/compile-fail/borrowck-lend-flow-match.rs | 4 +-- src/test/compile-fail/issue-10656.rs | 2 +- src/test/compile-fail/issue-14309.rs | 2 +- src/test/compile-fail/issue-17999.rs | 2 +- src/test/compile-fail/issue-2150.rs | 2 +- src/test/compile-fail/lint-ctypes-enum.rs | 2 +- src/test/compile-fail/lint-ctypes.rs | 2 +- src/test/compile-fail/lint-dead-code-1.rs | 4 +-- src/test/compile-fail/lint-dead-code-2.rs | 2 +- src/test/compile-fail/lint-dead-code-3.rs | 2 +- src/test/compile-fail/lint-dead-code-4.rs | 2 +- src/test/compile-fail/lint-dead-code-5.rs | 2 +- .../lint-directives-on-use-items-issue-10534.rs | 2 +- src/test/compile-fail/lint-misplaced-attr.rs | 2 +- src/test/compile-fail/lint-missing-doc.rs | 18 ++++++------ .../compile-fail/lint-non-uppercase-statics.rs | 2 +- src/test/compile-fail/lint-obsolete-attr.rs | 2 +- src/test/compile-fail/lint-owned-heap-memory.rs | 2 +- src/test/compile-fail/lint-qualification.rs | 2 +- src/test/compile-fail/lint-type-overflow.rs | 4 +-- src/test/compile-fail/lint-unknown-attr.rs | 2 +- src/test/compile-fail/lint-unnecessary-casts.rs | 2 +- .../compile-fail/lint-unnecessary-import-braces.rs | 2 +- src/test/compile-fail/lint-unnecessary-parens.rs | 2 +- src/test/compile-fail/lint-unsafe-block.rs | 4 +-- src/test/compile-fail/lint-unused-extern-crate.rs | 4 +-- src/test/compile-fail/lint-unused-mut-self.rs | 4 +-- src/test/compile-fail/lint-unused-mut-variables.rs | 4 +-- src/test/compile-fail/liveness-dead.rs | 2 +- src/test/compile-fail/liveness-unused.rs | 12 ++++---- src/test/compile-fail/match-static-const-lc.rs | 6 ++-- .../regions-fn-subtyping-return-static.rs | 2 +- src/test/compile-fail/unreachable-code.rs | 2 +- src/test/compile-fail/unused-attr.rs | 2 +- src/test/compile-fail/unused-result.rs | 6 ++-- src/test/compile-fail/warn-foreign-int-types.rs | 2 +- src/test/debuginfo/basic-types-globals-metadata.rs | 2 +- src/test/debuginfo/basic-types-globals.rs | 2 +- src/test/debuginfo/basic-types-metadata.rs | 2 +- src/test/debuginfo/basic-types-mut-globals.rs | 2 +- src/test/debuginfo/basic-types.rs | 2 +- src/test/debuginfo/borrowed-basic.rs | 2 +- src/test/debuginfo/borrowed-c-style-enum.rs | 2 +- src/test/debuginfo/borrowed-enum.rs | 2 +- src/test/debuginfo/borrowed-struct.rs | 2 +- src/test/debuginfo/borrowed-tuple.rs | 2 +- src/test/debuginfo/borrowed-unique-basic.rs | 2 +- src/test/debuginfo/box.rs | 2 +- src/test/debuginfo/boxed-struct.rs | 2 +- src/test/debuginfo/c-style-enum-in-composite.rs | 2 +- src/test/debuginfo/c-style-enum.rs | 2 +- src/test/debuginfo/destructured-fn-argument.rs | 2 +- src/test/debuginfo/destructured-local.rs | 2 +- src/test/debuginfo/evec-in-struct.rs | 2 +- src/test/debuginfo/function-arg-initialization.rs | 2 +- .../function-prologue-stepping-no-stack-check.rs | 2 +- .../function-prologue-stepping-regular.rs | 2 +- src/test/debuginfo/include_string.rs | 2 +- .../lexical-scopes-in-block-expression.rs | 4 +-- src/test/debuginfo/limited-debuginfo.rs | 2 +- .../multiple-functions-equal-var-names.rs | 2 +- src/test/debuginfo/multiple-functions.rs | 2 +- src/test/debuginfo/nil-enum.rs | 2 +- src/test/debuginfo/no-debug-attribute.rs | 2 +- .../debuginfo/packed-struct-with-destructor.rs | 2 +- src/test/debuginfo/packed-struct.rs | 2 +- src/test/debuginfo/recursive-enum.rs | 2 +- src/test/debuginfo/recursive-struct.rs | 2 +- src/test/debuginfo/simd.rs | 2 +- src/test/debuginfo/simple-struct.rs | 2 +- src/test/debuginfo/simple-tuple.rs | 2 +- src/test/debuginfo/struct-in-enum.rs | 2 +- src/test/debuginfo/struct-in-struct.rs | 2 +- src/test/debuginfo/struct-style-enum.rs | 2 +- src/test/debuginfo/struct-with-destructor.rs | 2 +- src/test/debuginfo/trait-pointers.rs | 2 +- src/test/debuginfo/tuple-in-struct.rs | 2 +- src/test/debuginfo/tuple-in-tuple.rs | 2 +- src/test/debuginfo/tuple-style-enum.rs | 2 +- src/test/debuginfo/unique-enum.rs | 2 +- .../debuginfo/var-captured-in-nested-closure.rs | 2 +- .../debuginfo/var-captured-in-sendable-closure.rs | 2 +- .../debuginfo/var-captured-in-stack-closure.rs | 2 +- src/test/debuginfo/vec-slices.rs | 2 +- src/test/debuginfo/vec.rs | 2 +- src/test/run-fail/explicit-fail-msg.rs | 4 +-- src/test/run-fail/issue-3029.rs | 4 +-- src/test/run-fail/issue-948.rs | 2 +- src/test/run-fail/match-bot-fail.rs | 2 +- src/test/run-fail/rhs-type.rs | 2 +- 178 files changed, 265 insertions(+), 265 deletions(-) (limited to 'src/libstd') diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 1cd6f7f6685..fc1ff259051 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -29,7 +29,7 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(unsafe_destructor)] -#![allow(missing_doc)] +#![allow(missing_docs)] use std::cell::{Cell, RefCell}; use std::cmp; diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs index 16e04b93777..9de2c20c03f 100644 --- a/src/libcollections/priority_queue.rs +++ b/src/libcollections/priority_queue.rs @@ -151,7 +151,7 @@ //! } //! ``` -#![allow(missing_doc)] +#![allow(missing_docs)] use core::prelude::*; diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index d4115df7da4..8c165b52df4 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -108,7 +108,7 @@ pub use core::slice::{Found, NotFound}; // Functional utilities -#[allow(missing_doc)] +#[allow(missing_docs)] pub trait VectorVector { // FIXME #5898: calling these .concat and .connect conflicts with // StrVector::con{cat,nect}, since they have generic contents. diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs index 498f86a8bf1..aba07513dd7 100644 --- a/src/libcollections/smallintmap.rs +++ b/src/libcollections/smallintmap.rs @@ -11,7 +11,7 @@ //! A simple map based on a vector for small integer keys. Space requirements //! are O(highest integer key). -#![allow(missing_doc)] +#![allow(missing_docs)] use core::prelude::*; diff --git a/src/libcore/failure.rs b/src/libcore/failure.rs index 9b63d325bc8..7bc7795e193 100644 --- a/src/libcore/failure.rs +++ b/src/libcore/failure.rs @@ -28,7 +28,7 @@ //! one function. Currently, the actual symbol is declared in the standard //! library, but the location of this may change over time. -#![allow(dead_code, missing_doc)] +#![allow(dead_code, missing_docs)] use fmt; use intrinsics; @@ -57,7 +57,7 @@ fn fail_bounds_check(file_line: &(&'static str, uint), #[cold] #[inline(never)] pub fn fail_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! { - #[allow(ctypes)] + #[allow(improper_ctypes)] extern { #[lang = "fail_fmt"] fn fail_impl(fmt: &fmt::Arguments, file: &'static str, diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 343ab7cfd28..2e5f9aee213 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(missing_doc)] +#![allow(missing_docs)] use char; use collections::Collection; diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 093f5896aad..65107d6ab7d 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -10,7 +10,7 @@ //! Utilities for formatting and printing strings -#![allow(unused_variable)] +#![allow(unused_variables)] use any; use cell::{Cell, Ref, RefMut}; @@ -733,7 +733,7 @@ macro_rules! tuple ( () => (); ( $($name:ident,)+ ) => ( impl<$($name:Show),*> Show for ($($name,)*) { - #[allow(non_snake_case, dead_assignment)] + #[allow(non_snake_case, unused_assignments)] fn fmt(&self, f: &mut Formatter) -> Result { try!(write!(f, "(")); let ($(ref $name,)*) = *self; diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index e57c4999483..66f5f5921fc 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -12,7 +12,7 @@ // FIXME: #6220 Implement floating point formatting -#![allow(unsigned_negate)] +#![allow(unsigned_negation)] use collections::Collection; use fmt; diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 8486535d188..609706183a6 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -42,7 +42,7 @@ A quick refresher on memory ordering: */ #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] pub type GlueFn = extern "Rust" fn(*const i8); diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 62a4fbd2e08..0c4a41fbf65 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -60,7 +60,7 @@ #![allow(unknown_features)] #![feature(globs, intrinsics, lang_items, macro_rules, phase)] #![feature(simd, unsafe_destructor, slicing_syntax)] -#![deny(missing_doc)] +#![deny(missing_docs)] mod macros; diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index bf362928f61..521085bca76 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -12,7 +12,7 @@ #![doc(primitive = "f32")] // FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353 -#![allow(type_overflow)] +#![allow(overflowing_literals)] use intrinsics; use mem; diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 5ad2e2f9f8b..78065d7803e 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -12,7 +12,7 @@ #![doc(primitive = "f64")] // FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353 -#![allow(type_overflow)] +#![allow(overflowing_literals)] use intrinsics; use mem; diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 3dceb42e206..eae0f5f7d29 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -12,7 +12,7 @@ //! Numeric traits and functions for generic mathematics -#![allow(missing_doc)] +#![allow(missing_docs)] use intrinsics; use {int, i8, i16, i32, i64}; diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index fe365b43ca6..be15115baeb 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(missing_doc)] +#![allow(missing_docs)] #![experimental] //! Contains struct definitions for the layout of compiler built-in types. diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs index 42418ccbc1a..2b6f97cf6a5 100644 --- a/src/libcore/simd.rs +++ b/src/libcore/simd.rs @@ -35,7 +35,7 @@ //! warning. #![allow(non_camel_case_types)] -#![allow(missing_doc)] +#![allow(missing_docs)] #[experimental] #[simd] diff --git a/src/libcore/str.rs b/src/libcore/str.rs index e8cd93ba7dc..82e0d530269 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -767,7 +767,7 @@ Section: Comparing strings /// to compare &[u8] byte slices that are not necessarily valid UTF-8. #[inline] fn eq_slice_(a: &str, b: &str) -> bool { - #[allow(ctypes)] + #[allow(improper_ctypes)] extern { fn memcmp(s1: *const i8, s2: *const i8, n: uint) -> i32; } a.len() == b.len() && unsafe { memcmp(a.as_ptr() as *const i8, @@ -1117,7 +1117,7 @@ pub mod raw { Section: Trait implementations */ -#[allow(missing_doc)] +#[allow(missing_docs)] pub mod traits { use cmp::{Ord, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, Eq}; use collections::Collection; diff --git a/src/libcore/tuple/mod.rs b/src/libcore/tuple/mod.rs index ead35647180..56ea7a4e7a1 100644 --- a/src/libcore/tuple/mod.rs +++ b/src/libcore/tuple/mod.rs @@ -81,7 +81,7 @@ macro_rules! tuple_impls { } )+) => { $( - #[allow(missing_doc)] + #[allow(missing_docs)] #[stable] pub trait $Tuple<$($T),+> { $( @@ -97,21 +97,21 @@ macro_rules! tuple_impls { impl<$($T),+> $Tuple<$($T),+> for ($($T,)+) { $( #[inline] - #[allow(unused_variable)] + #[allow(unused_variables)] #[unstable = "may rename pending accessor naming conventions"] fn $valN(self) -> $T { let ($($x,)+) = self; $ret } #[inline] - #[allow(unused_variable)] + #[allow(unused_variables)] #[unstable = "may rename pending accessor naming conventions"] fn $refN<'a>(&'a self) -> &'a $T { let ($(ref $x,)+) = *self; $ret } #[inline] - #[allow(unused_variable)] + #[allow(unused_variables)] #[unstable = "may rename pending accessor naming conventions"] fn $mutN<'a>(&'a mut self) -> &'a mut $T { let ($(ref mut $x,)+) = *self; $ret diff --git a/src/libcoretest/fmt/num.rs b/src/libcoretest/fmt/num.rs index baef7e3a11e..868e14b928a 100644 --- a/src/libcoretest/fmt/num.rs +++ b/src/libcoretest/fmt/num.rs @@ -7,7 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unsigned_negate)] +#![allow(unsigned_negation)] use core::fmt::radix; diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index a73f7ddf7f7..7ddbb911b08 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -89,7 +89,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![feature(globs, phase)] #![feature(import_shadowing)] -#![deny(missing_doc)] +#![deny(missing_docs)] #[cfg(test)] #[phase(plugin, link)] extern crate log; @@ -201,7 +201,7 @@ pub enum Fail_ { /// The type of failure that occurred. #[deriving(PartialEq, Eq)] -#[allow(missing_doc)] +#[allow(missing_docs)] pub enum FailType { ArgumentMissing_, UnrecognizedOption_, diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index d1a08660cb9..6756d4b21ff 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -75,8 +75,8 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -#![allow(non_uppercase_statics)] -#![allow(missing_doc)] +#![allow(non_upper_case_globals)] +#![allow(missing_docs)] #![allow(non_snake_case)] extern crate core; diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 9d5080522c2..587be9547ae 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -167,7 +167,7 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] #![feature(macro_rules)] -#![deny(missing_doc)] +#![deny(missing_docs)] extern crate regex; diff --git a/src/libnative/io/c_windows.rs b/src/libnative/io/c_windows.rs index eed3df28b8f..ee6aa26ede2 100644 --- a/src/libnative/io/c_windows.rs +++ b/src/libnative/io/c_windows.rs @@ -10,7 +10,7 @@ //! C definitions used by libnative that don't belong in liblibc -#![allow(type_overflow)] +#![allow(overflowing_literals)] use libc; diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index c99143f0a5d..0104ac1f2bb 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -55,7 +55,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![deny(unused_result, unused_must_use)] +#![deny(unused_results, unused_must_use)] #![allow(non_camel_case_types)] #![allow(unknown_features)] #![feature(default_type_params, lang_items, slicing_syntax)] diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs index 3d83012cecb..49d60a98b64 100644 --- a/src/librand/isaac.rs +++ b/src/librand/isaac.rs @@ -118,7 +118,7 @@ impl IsaacRng { /// Refills the output buffer (`self.rsl`) #[inline] - #[allow(unsigned_negate)] + #[allow(unsigned_negation)] fn isaac(&mut self) { self.c += 1; // abbreviations diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 07474a9f105..dead09c2186 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -26,7 +26,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] #![feature(macro_rules, phase, slicing_syntax)] -#![allow(missing_doc)] +#![allow(missing_docs)] extern crate serialize; diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs index bb6df26dab4..97265a74c67 100644 --- a/src/libregex/lib.rs +++ b/src/libregex/lib.rs @@ -370,7 +370,7 @@ #![allow(unknown_features)] #![feature(macro_rules, phase, slicing_syntax)] -#![deny(missing_doc)] +#![deny(missing_docs)] #[cfg(test)] extern crate "test" as stdtest; diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs index 04c0e7cc21f..71b71599245 100644 --- a/src/libregex_macros/lib.rs +++ b/src/libregex_macros/lib.rs @@ -179,7 +179,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, } impl<'t> Nfa<'t> { - #[allow(unused_variable)] + #[allow(unused_variables)] fn run(&mut self, start: uint, end: uint) -> Vec> { let mut matched = false; let prefix_bytes: &[u8] = $prefix_bytes; @@ -226,7 +226,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, } // Sometimes `nlist` is never used (for empty regexes). - #[allow(unused_variable)] + #[allow(unused_variables)] #[inline] fn step(&self, groups: &mut Captures, nlist: &mut Threads, caps: &mut Captures, pc: uint) -> StepState { diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index d6798d59ecb..864eb603611 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -498,7 +498,7 @@ pub fn get_os(triple: &str) -> Option { } None } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static os_names : &'static [(&'static str, abi::Os)] = &[ ("mingw32", abi::OsWindows), ("win32", abi::OsWindows), @@ -516,7 +516,7 @@ pub fn get_arch(triple: &str) -> Option { } None } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static architecture_abis : &'static [(&'static str, abi::Architecture)] = &[ ("i386", abi::X86), ("i486", abi::X86), diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 8c44adc55d2..4b63b2537ed 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -1021,7 +1021,7 @@ declare_lint!(UNUSED_PARENS, Warn, pub struct UnusedParens; impl UnusedParens { - fn check_unnecessary_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str, + fn check_unused_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str, struct_lit_needs_parens: bool) { match value.node { ast::ExprParen(ref inner) => { @@ -1090,7 +1090,7 @@ impl LintPass for UnusedParens { ast::ExprAssignOp(_, _, ref value) => (value, "assigned value", false), _ => return }; - self.check_unnecessary_parens_core(cx, &**value, msg, struct_lit_needs_parens); + self.check_unused_parens_core(cx, &**value, msg, struct_lit_needs_parens); } fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) { @@ -1104,7 +1104,7 @@ impl LintPass for UnusedParens { }, _ => return }; - self.check_unnecessary_parens_core(cx, &**value, msg, false); + self.check_unused_parens_core(cx, &**value, msg, false); } } @@ -1364,7 +1364,7 @@ impl MissingDoc { *self.doc_hidden_stack.last().expect("empty doc_hidden_stack") } - fn check_missing_doc_attrs(&self, + fn check_missing_docs_attrs(&self, cx: &Context, id: Option, attrs: &[ast::Attribute], @@ -1374,7 +1374,7 @@ impl MissingDoc { // documentation is probably not really relevant right now. if cx.sess().opts.test { return } - // `#[doc(hidden)]` disables missing_doc check. + // `#[doc(hidden)]` disables missing_docs check. if self.doc_hidden() { return } // Only check publicly-visible items, using the result from the privacy pass. @@ -1429,7 +1429,7 @@ impl LintPass for MissingDoc { } fn check_crate(&mut self, cx: &Context, krate: &ast::Crate) { - self.check_missing_doc_attrs(cx, None, krate.attrs.as_slice(), + self.check_missing_docs_attrs(cx, None, krate.attrs.as_slice(), krate.span, "crate"); } @@ -1442,7 +1442,7 @@ impl LintPass for MissingDoc { ast::ItemTrait(..) => "a trait", _ => return }; - self.check_missing_doc_attrs(cx, Some(it.id), it.attrs.as_slice(), + self.check_missing_docs_attrs(cx, Some(it.id), it.attrs.as_slice(), it.span, desc); } @@ -1456,7 +1456,7 @@ impl LintPass for MissingDoc { // Otherwise, doc according to privacy. This will also check // doc for default methods defined on traits. - self.check_missing_doc_attrs(cx, Some(m.id), m.attrs.as_slice(), + self.check_missing_docs_attrs(cx, Some(m.id), m.attrs.as_slice(), m.span, "a method"); } _ => {} @@ -1464,7 +1464,7 @@ impl LintPass for MissingDoc { } fn check_ty_method(&mut self, cx: &Context, tm: &ast::TypeMethod) { - self.check_missing_doc_attrs(cx, Some(tm.id), tm.attrs.as_slice(), + self.check_missing_docs_attrs(cx, Some(tm.id), tm.attrs.as_slice(), tm.span, "a type method"); } @@ -1473,7 +1473,7 @@ impl LintPass for MissingDoc { ast::NamedField(_, vis) if vis == ast::Public => { let cur_struct_def = *self.struct_def_stack.last() .expect("empty struct_def_stack"); - self.check_missing_doc_attrs(cx, Some(cur_struct_def), + self.check_missing_docs_attrs(cx, Some(cur_struct_def), sf.node.attrs.as_slice(), sf.span, "a struct field") } @@ -1482,7 +1482,7 @@ impl LintPass for MissingDoc { } fn check_variant(&mut self, cx: &Context, v: &ast::Variant, _: &ast::Generics) { - self.check_missing_doc_attrs(cx, Some(v.node.id), v.node.attrs.as_slice(), + self.check_missing_docs_attrs(cx, Some(v.node.id), v.node.attrs.as_slice(), v.span, "a variant"); } } diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 5afe5326171..0202aa18558 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -98,7 +98,7 @@ macro_rules! declare_lint ( #[macro_export] macro_rules! lint_array ( ($( $lint:expr ),*) => ( { - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] static array: LintArray = &[ $( &$lint ),* ]; array } diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index 492feee6f84..bc58097b860 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_camel_case_types, non_uppercase_statics)] +#![allow(non_camel_case_types, non_upper_case_globals)] use std::mem; use back::svh::Svh; diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index fd71e4f7b1f..23a7c8f3d8a 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -1330,9 +1330,9 @@ pub fn get_missing_lang_items(cdata: Cmd) { let items = reader::get_doc(rbml::Doc::new(cdata.data()), tag_lang_items); let mut result = Vec::new(); - reader::tagged_docs(items, tag_lang_items_missing, |missing_doc| { + reader::tagged_docs(items, tag_lang_items_missing, |missing_docs| { let item: lang_items::LangItem = - FromPrimitive::from_u32(reader::doc_as_u32(missing_doc)).unwrap(); + FromPrimitive::from_u32(reader::doc_as_u32(missing_docs)).unwrap(); result.push(item); true }); diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 6fe14a2d12a..ad53560a4c2 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -2028,7 +2028,7 @@ fn encode_dylib_dependency_formats(rbml_w: &mut Encoder, ecx: &EncodeContext) { } // NB: Increment this as you change the metadata encoding version. -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't', 0, 0, 0, 1 ]; pub fn encode_metadata(parms: EncodeParams, krate: &Crate) -> Vec { diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index 5f3c46fcf4c..9ebbdab03ca 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -83,7 +83,7 @@ impl Clone for MovePathIndex { } } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static InvalidMovePathIndex: MovePathIndex = MovePathIndex(uint::MAX); @@ -97,7 +97,7 @@ impl MoveIndex { } } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static InvalidMoveIndex: MoveIndex = MoveIndex(uint::MAX); diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 3d6b319ac0d..ad0040608ec 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -9,7 +9,7 @@ // except according to those terms. #![allow(non_camel_case_types)] -#![allow(unsigned_negate)] +#![allow(unsigned_negation)] use metadata::csearch; use middle::astencode; diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs index 4775f945f5c..5f9d57488f4 100644 --- a/src/librustc/middle/graph.rs +++ b/src/librustc/middle/graph.rs @@ -66,20 +66,20 @@ impl Show for Edge { #[deriving(Clone, PartialEq, Show)] pub struct NodeIndex(pub uint); -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX); #[deriving(PartialEq, Show)] pub struct EdgeIndex(pub uint); -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX); // Use a private field here to guarantee no more instances are created: #[deriving(Show)] pub struct Direction { repr: uint } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const Outgoing: Direction = Direction { repr: 0 }; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const Incoming: Direction = Direction { repr: 1 }; impl NodeIndex { diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index fad4ef4f15f..49d1f307d9a 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -3158,7 +3158,7 @@ impl<'a> Resolver<'a> { (_, _) => { search_module = module_def.clone(); - // track extern crates for unused_extern_crate lint + // track extern crates for unused_extern_crates lint match module_def.def_id.get() { Some(did) => { self.used_crates.insert(did.krate); diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs index 2525da8863f..804d2b71046 100644 --- a/src/librustc/middle/trans/adt.rs +++ b/src/librustc/middle/trans/adt.rs @@ -43,7 +43,7 @@ * taken to it, implementing them for Rust seems difficult. */ -#![allow(unsigned_negate)] +#![allow(unsigned_negation)] use std::collections::Map; use std::num::Int; @@ -393,12 +393,12 @@ fn mk_cenum(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> Repr { fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntType { debug!("range_to_inttype: {} {}", hint, bounds); // Lists of sizes to try. u64 is always allowed as a fallback. - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] static choose_shortest: &'static[IntType] = &[ attr::UnsignedInt(ast::TyU8), attr::SignedInt(ast::TyI8), attr::UnsignedInt(ast::TyU16), attr::SignedInt(ast::TyI16), attr::UnsignedInt(ast::TyU32), attr::SignedInt(ast::TyI32)]; - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] static at_least_32: &'static[IntType] = &[ attr::UnsignedInt(ast::TyU32), attr::SignedInt(ast::TyI32)]; diff --git a/src/librustc/middle/trans/cabi_arm.rs b/src/librustc/middle/trans/cabi_arm.rs index ccfc79ac0c5..0e760ec05ca 100644 --- a/src/librustc/middle/trans/cabi_arm.rs +++ b/src/librustc/middle/trans/cabi_arm.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] use llvm; use llvm::{Integer, Pointer, Float, Double, Struct, Array}; diff --git a/src/librustc/middle/trans/cabi_mips.rs b/src/librustc/middle/trans/cabi_mips.rs index 90bd1521705..4fa2fc0edc7 100644 --- a/src/librustc/middle/trans/cabi_mips.rs +++ b/src/librustc/middle/trans/cabi_mips.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] use libc::c_uint; use std::cmp; diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index 1b8a354259a..2adf4ce455a 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -11,7 +11,7 @@ // The classification code for the x86_64 ABI is taken from the clay language // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] use llvm; use llvm::{Integer, Pointer, Float, Double}; diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 3368b2b7765..653141f31f4 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -218,20 +218,20 @@ use syntax::parse::token::special_idents; static DW_LANG_RUST: c_uint = 0x9000; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static DW_TAG_auto_variable: c_uint = 0x100; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static DW_TAG_arg_variable: c_uint = 0x101; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static DW_ATE_boolean: c_uint = 0x02; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static DW_ATE_float: c_uint = 0x04; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static DW_ATE_signed: c_uint = 0x05; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static DW_ATE_unsigned: c_uint = 0x07; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static DW_ATE_unsigned_char: c_uint = 0x08; static UNKNOWN_LINE_NUMBER: c_uint = 0; diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs index 3e75b0772fb..5798691188f 100644 --- a/src/librustc/middle/trans/intrinsic.rs +++ b/src/librustc/middle/trans/intrinsic.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] use llvm; use llvm::{SequentiallyConsistent, Acquire, Release, AtomicXchg, ValueRef}; diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs index 6acbde3b2ad..8c6dcbba54d 100644 --- a/src/librustc/middle/trans/type_.rs +++ b/src/librustc/middle/trans/type_.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] use llvm; use llvm::{TypeRef, Bool, False, True, TypeKind, ValueRef}; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 7fedea67f79..f33996d6d8e 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -2212,7 +2212,7 @@ macro_rules! def_type_content_sets( mod $mname { use middle::ty::TypeContents; $( - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] pub const $name: TypeContents = TypeContents { bits: $bits }; )+ } @@ -4661,7 +4661,7 @@ pub fn unboxed_closure_upvars(tcx: &ctxt, closure_id: ast::DefId, substs: &Subst } pub fn is_binopable(cx: &ctxt, ty: t, op: ast::BinOp) -> bool { - #![allow(non_uppercase_statics)] + #![allow(non_upper_case_globals)] static tycat_other: int = 0; static tycat_bool: int = 1; static tycat_char: int = 2; diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index 87f3fd98787..0016a80b500 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -46,7 +46,7 @@ // future). If you want to resolve everything but one type, you are // probably better off writing `resolve_all - resolve_ivar`. -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] use middle::ty::{FloatVar, FloatVid, IntVar, IntVid, RegionVid, TyVar, TyVid}; use middle::ty::{IntType, UintType}; diff --git a/src/librustc_back/abi.rs b/src/librustc_back/abi.rs index aa07b9a5034..19dd6b8459f 100644 --- a/src/librustc_back/abi.rs +++ b/src/librustc_back/abi.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] pub const box_field_refcnt: uint = 0u; pub const box_field_drop_glue: uint = 1u; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 03399e73908..06456a91e03 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 685d76bb520..0643caa7610 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -212,7 +212,7 @@ pub fn maketest(s: &str, cratename: Option<&str>, lints: bool, dont_insert_main: if lints { prog.push_str(r" #![deny(warnings)] -#![allow(unused_variable, dead_assignment, unused_mut, unused_attribute, dead_code)] +#![allow(unused_variables, unused_assignments, unused_mut, unused_attributes, dead_code)] "); } diff --git a/src/librustrt/libunwind.rs b/src/librustrt/libunwind.rs index 6867cb2e76b..2932a3dd4a8 100644 --- a/src/librustrt/libunwind.rs +++ b/src/librustrt/libunwind.rs @@ -10,7 +10,7 @@ //! Unwind library interface -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] // these are just bindings diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs index 8d5c49d767f..2f15f33c7d4 100644 --- a/src/librustrt/local_data.rs +++ b/src/librustrt/local_data.rs @@ -66,7 +66,7 @@ use task::{Task, LocalStorage}; */ pub type Key = &'static KeyValue; -#[allow(missing_doc)] +#[allow(missing_docs)] pub enum KeyValue { KeyValueKey } // The task-local-map stores all TLD information for the currently running diff --git a/src/librustrt/util.rs b/src/librustrt/util.rs index a94da33e543..06d1efdcd70 100644 --- a/src/librustrt/util.rs +++ b/src/librustrt/util.rs @@ -28,9 +28,9 @@ pub const ENFORCE_SANITY: bool = true || !cfg!(rtopt) || cfg!(rtdebug) || pub struct Stdio(libc::c_int); -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const Stdout: Stdio = Stdio(libc::STDOUT_FILENO); -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const Stderr: Stdio = Stdio(libc::STDERR_FILENO); impl fmt::FormatWriter for Stdio { diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 73b4773fb3f..1bc90ea688b 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -12,7 +12,7 @@ // Copyright (c) 2011 Google Inc. #![forbid(non_camel_case_types)] -#![allow(missing_doc)] +#![allow(missing_docs)] /*! JSON parsing and serialization diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs index fb5934c6af6..97a1f68606f 100644 --- a/src/libstd/bitflags.rs +++ b/src/libstd/bitflags.rs @@ -258,7 +258,7 @@ macro_rules! bitflags { } #[cfg(test)] -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] mod tests { use hash; use option::{Some, None}; diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index ed8ff821f5c..b873c9ef671 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -17,7 +17,7 @@ A simple wrapper over the platform's dynamic library facilities */ #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] use clone::Clone; use collections::MutableSeq; diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index 57741db5ae2..88c69cee5ce 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -10,7 +10,7 @@ //! Utility mixins that apply to all Readers and Writers -#![allow(missing_doc)] +#![allow(missing_docs)] // FIXME: Not sure how this should be structured // FIXME: Iteration should probably be considered separately diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 8592d48974a..b2c1791fd05 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1834,60 +1834,60 @@ bitflags! { const ALL_PERMISSIONS = USER_RWX.bits | GROUP_RWX.bits | OTHER_RWX.bits, // Deprecated names - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_READ instead"] const UserRead = USER_READ.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_WRITE instead"] const UserWrite = USER_WRITE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_EXECUTE instead"] const UserExecute = USER_EXECUTE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use GROUP_READ instead"] const GroupRead = GROUP_READ.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use GROUP_WRITE instead"] const GroupWrite = GROUP_WRITE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use GROUP_EXECUTE instead"] const GroupExecute = GROUP_EXECUTE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use OTHER_READ instead"] const OtherRead = OTHER_READ.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use OTHER_WRITE instead"] const OtherWrite = OTHER_WRITE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use OTHER_EXECUTE instead"] const OtherExecute = OTHER_EXECUTE.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_RWX instead"] const UserRWX = USER_RWX.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use GROUP_RWX instead"] const GroupRWX = GROUP_RWX.bits, - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use OTHER_RWX instead"] const OtherRWX = OTHER_RWX.bits, #[doc = "Deprecated: use `USER_FILE` instead."] - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_FILE instead"] const UserFile = USER_FILE.bits, #[doc = "Deprecated: use `USER_DIR` instead."] - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_DIR instead"] const UserDir = USER_DIR.bits, #[doc = "Deprecated: use `USER_EXEC` instead."] - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use USER_EXEC instead"] const UserExec = USER_EXEC.bits, #[doc = "Deprecated: use `ALL_PERMISSIONS` instead"] - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] #[deprecated = "use ALL_PERMISSIONS instead"] const AllPermissions = ALL_PERMISSIONS.bits, } diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index 9d85701eb29..7cdb2669030 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -17,7 +17,7 @@ getaddrinfo() */ -#![allow(missing_doc)] +#![allow(missing_docs)] use iter::Iterator; use io::{IoResult, IoError}; @@ -91,7 +91,7 @@ pub fn get_host_addresses(host: &str) -> IoResult> { /// /// FIXME: this is not public because the `Hint` structure is not ready for public /// consumption just yet. -#[allow(unused_variable)] +#[allow(unused_variables)] fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option) -> IoResult> { let hint = hint.map(|Hint { family, socktype, protocol, flags }| { diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 5140159e4ea..e93af744699 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -13,7 +13,7 @@ //! This module contains functions useful for parsing, formatting, and //! manipulating IP addresses. -#![allow(missing_doc)] +#![allow(missing_docs)] use collections::Collection; use fmt; diff --git a/src/libstd/io/net/pipe.rs b/src/libstd/io/net/pipe.rs index e0cf761fdbd..577b8a9f6ef 100644 --- a/src/libstd/io/net/pipe.rs +++ b/src/libstd/io/net/pipe.rs @@ -22,7 +22,7 @@ instances as clients. */ -#![allow(missing_doc)] +#![allow(missing_docs)] use prelude::*; diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs index 9362a48a6f0..c77cffd561e 100644 --- a/src/libstd/io/pipe.rs +++ b/src/libstd/io/pipe.rs @@ -13,7 +13,7 @@ //! Currently these aren't particularly useful, there only exists bindings //! enough so that pipes can be created to child processes. -#![allow(missing_doc)] +#![allow(missing_docs)] use prelude::*; diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 88f8434b957..3c68b1b3b32 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -11,7 +11,7 @@ //! Bindings for executing child processes #![allow(experimental)] -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] use prelude::*; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index c47cd025994..1d83994da4f 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -113,7 +113,7 @@ // Don't link to std. We are std. #![no_std] -#![deny(missing_doc)] +#![deny(missing_docs)] #![reexport_test_harness_main = "test_main"] diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 1ad3d6eed94..d1d8fa3a0a7 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -304,11 +304,11 @@ macro_rules! println( #[macro_export] macro_rules! local_data_key( ($name:ident: $ty:ty) => ( - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] static $name: ::std::local_data::Key<$ty> = &::std::local_data::KeyValueKey; ); (pub $name:ident: $ty:ty) => ( - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] pub static $name: ::std::local_data::Key<$ty> = &::std::local_data::KeyValueKey; ); ) diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 3fa181b8478..0b2f17b8f93 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -11,8 +11,8 @@ //! Operations and constants for 32-bits floats (`f32` type) #![experimental] -#![allow(missing_doc)] -#![allow(unsigned_negate)] +#![allow(missing_docs)] +#![allow(unsigned_negation)] #![doc(primitive = "f32")] use prelude::*; diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index b9d54ba182b..35555b14081 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -11,7 +11,7 @@ //! Operations and constants for 64-bits floats (`f64` type) #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] #![doc(primitive = "f64")] use prelude::*; diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 564b6a25f7f..ffe162cbc64 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -14,7 +14,7 @@ //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`. #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] use option::Option; diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index af66e6ca934..5fc3be4839c 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -10,7 +10,7 @@ // // ignore-lexer-test FIXME #15679 -#![allow(missing_doc)] +#![allow(missing_docs)] use char; use clone::Clone; diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index f9bc9eb539a..c69c3ffa41c 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -11,7 +11,7 @@ #![experimental] #![macro_escape] #![doc(hidden)] -#![allow(unsigned_negate)] +#![allow(unsigned_negation)] macro_rules! uint_module (($T:ty) => ( diff --git a/src/libstd/os.rs b/src/libstd/os.rs index e758dec6bff..488f5b84698 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -28,7 +28,7 @@ #![experimental] -#![allow(missing_doc)] +#![allow(missing_docs)] #![allow(non_snake_case)] use clone::Clone; diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 69b6dd76676..eba9b9005cc 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -457,9 +457,9 @@ fn normalize_helper<'a>(v: &'a [u8], is_abs: bool) -> Option> { } } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static dot_static: &'static [u8] = b"."; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static dot_dot_static: &'static [u8] = b".."; #[cfg(test)] diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 91308be21ed..c4ee6baea46 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -88,7 +88,7 @@ mod imp { #[repr(C)] struct SecRandom; - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] static kSecRandomDefault: *const SecRandom = 0 as *const SecRandom; #[link(name = "Security", kind = "framework")] diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index a91c6c572e6..f6ca5152e1b 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -52,7 +52,7 @@ Several modules in `core` are clients of `rt`: #![experimental] // FIXME: this should not be here. -#![allow(missing_doc)] +#![allow(missing_docs)] use failure; use rustrt; diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index 621c08fe7bc..626aed4670d 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -24,7 +24,7 @@ * ``` */ -#![allow(missing_doc)] +#![allow(missing_docs)] use core::prelude::*; use core::mem::replace; diff --git a/src/libsync/lib.rs b/src/libsync/lib.rs index a33e8a57137..ffff32f04c4 100644 --- a/src/libsync/lib.rs +++ b/src/libsync/lib.rs @@ -29,7 +29,7 @@ #![feature(phase, globs, macro_rules, unsafe_destructor)] #![feature(import_shadowing)] -#![deny(missing_doc)] +#![deny(missing_docs)] #![no_std] #[phase(plugin, link)] extern crate core; diff --git a/src/libsync/mpmc_bounded_queue.rs b/src/libsync/mpmc_bounded_queue.rs index b3b504f49ca..f75511ecbc2 100644 --- a/src/libsync/mpmc_bounded_queue.rs +++ b/src/libsync/mpmc_bounded_queue.rs @@ -26,7 +26,7 @@ */ #![experimental] -#![allow(missing_doc, dead_code)] +#![allow(missing_docs, dead_code)] // http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 03325ad4706..dc41f3d9279 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -47,9 +47,9 @@ pub enum Architecture { Mipsel } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] const IntelBits: u32 = (1 << (X86 as uint)) | (1 << (X86_64 as uint)); -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] const ArmBits: u32 = (1 << (Arm as uint)); pub struct AbiData { @@ -72,7 +72,7 @@ pub enum AbiArchitecture { Archs(u32) } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] static AbiDatas: &'static [AbiData] = &[ // Platform-specific ABIs AbiData {abi: Cdecl, name: "cdecl", abi_arch: Archs(IntelBits)}, diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index d5a460dc9db..25a3a4ea3a2 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -291,7 +291,7 @@ pub fn operator_prec(op: ast::BinOp) -> uint { /// Precedence of the `as` operator, which is a binary operator /// not appearing in the prior table. -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub static as_prec: uint = 12u; pub fn empty_generics() -> Generics { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index fa6b0c5ad4a..769652bd23b 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -384,14 +384,14 @@ macro_rules! declare_special_idents_and_keywords {( pub mod special_idents { use ast::{Ident, Name}; $( - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] pub const $si_static: Ident = Ident { name: Name($si_name), ctxt: 0 }; )* } pub mod special_names { use ast::Name; - $( #[allow(non_uppercase_statics)] pub const $si_static: Name = Name($si_name); )* + $( #[allow(non_upper_case_globals)] pub const $si_static: Name = Name($si_name); )* } /** diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 69e6d78d16a..e26848f5bb1 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -89,10 +89,10 @@ pub fn rust_printer_annotated<'a>(writer: Box, } } -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const indent_unit: uint = 4u; -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const default_columns: uint = 78u; /// Requires you to pass an input filename and reader so that diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index fbf17b76d62..2943ff99a91 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -52,7 +52,7 @@ #![allow(unknown_features)] #![feature(macro_rules, phase, slicing_syntax)] -#![deny(missing_doc)] +#![deny(missing_docs)] #[phase(plugin, link)] extern crate log; diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 586f420dc3e..b893d69858c 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -38,7 +38,7 @@ enum FormatState { } /// Types of parameters a capability can use -#[allow(missing_doc)] +#[allow(missing_docs)] #[deriving(Clone)] pub enum Param { Words(String), diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 6b921144144..9eb7216fba0 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] //! ncurses-compatible compiled terminfo format parsing (term(5)) diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 72c61f3afc7..a39769d0fa4 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(missing_doc)] +#![allow(missing_docs)] use std::collections::hashmap; use std::collections::hashmap::{Occupied, Vacant}; @@ -128,7 +128,7 @@ pub trait Stats { /// Extracted collection of all the summary statistics of a sample set. #[deriving(Clone, PartialEq)] -#[allow(missing_doc)] +#[allow(missing_docs)] pub struct Summary { pub sum: T, pub min: T, diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index 3f15abcad6d..5fe91a87056 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -10,7 +10,7 @@ // NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly -#![allow(missing_doc, non_uppercase_statics, non_snake_case)] +#![allow(missing_docs, non_upper_case_globals, non_snake_case)] /// The version of [Unicode](http://www.unicode.org/) /// that the `UnicodeChar` and `UnicodeStrSlice` traits are based on. diff --git a/src/test/compile-fail-fulldeps/syntax-extension-regex-unused-static.rs b/src/test/compile-fail-fulldeps/syntax-extension-regex-unused-static.rs index 1d14da73b7e..8f83c9ec94f 100644 --- a/src/test/compile-fail-fulldeps/syntax-extension-regex-unused-static.rs +++ b/src/test/compile-fail-fulldeps/syntax-extension-regex-unused-static.rs @@ -15,9 +15,9 @@ extern crate regex; #[phase(plugin)] extern crate regex_macros; -#[deny(unused_variable)] +#[deny(unused_variables)] #[deny(dead_code)] -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] // Tests to make sure that extraneous dead code warnings aren't emitted from // the code generated by regex!. diff --git a/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs b/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs index c17f3c6da50..b4dda05f42d 100644 --- a/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs +++ b/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs @@ -15,7 +15,7 @@ extern crate regex; #[phase(plugin)] extern crate regex_macros; -#[deny(unused_variable)] +#[deny(unused_variables)] #[deny(dead_code)] // Tests to make sure that extraneous dead code warnings aren't emitted from diff --git a/src/test/compile-fail/asm-misplaced-option.rs b/src/test/compile-fail/asm-misplaced-option.rs index 74bfc6e6ffc..b29899e1940 100644 --- a/src/test/compile-fail/asm-misplaced-option.rs +++ b/src/test/compile-fail/asm-misplaced-option.rs @@ -12,7 +12,7 @@ #![feature(asm)] -#![allow(dead_code, non_uppercase_statics)] +#![allow(dead_code, non_upper_case_globals)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] diff --git a/src/test/compile-fail/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck-lend-flow-match.rs index 049bec3d37b..0b40a78425f 100644 --- a/src/test/compile-fail/borrowck-lend-flow-match.rs +++ b/src/test/compile-fail/borrowck-lend-flow-match.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_variable)] -#![allow(dead_assignment)] +#![allow(unused_variables)] +#![allow(unused_assignments)] fn separate_arms() { // Here both arms perform assignments, but only is illegal. diff --git a/src/test/compile-fail/issue-10656.rs b/src/test/compile-fail/issue-10656.rs index 5a4ed1d3df8..0b335a526a4 100644 --- a/src/test/compile-fail/issue-10656.rs +++ b/src/test/compile-fail/issue-10656.rs @@ -10,5 +10,5 @@ // error-pattern: missing documentation for crate -#![deny(missing_doc)] +#![deny(missing_docs)] #![crate_type="lib"] diff --git a/src/test/compile-fail/issue-14309.rs b/src/test/compile-fail/issue-14309.rs index d4a40ade72c..9225889ef63 100644 --- a/src/test/compile-fail/issue-14309.rs +++ b/src/test/compile-fail/issue-14309.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(ctypes)] +#![deny(improper_ctypes)] #![allow(dead_code)] struct A { diff --git a/src/test/compile-fail/issue-17999.rs b/src/test/compile-fail/issue-17999.rs index 4d4b40ed12d..e3ad2dd1b06 100644 --- a/src/test/compile-fail/issue-17999.rs +++ b/src/test/compile-fail/issue-17999.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unused_variable)] +#![deny(unused_variables)] fn main() { for _ in range(1i, 101) { diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs index 7457a1020ce..6bbba3b30b8 100644 --- a/src/test/compile-fail/issue-2150.rs +++ b/src/test/compile-fail/issue-2150.rs @@ -9,7 +9,7 @@ // except according to those terms. #![deny(unreachable_code)] -#![allow(unused_variable)] +#![allow(unused_variables)] #![allow(dead_code)] fn fail_len(v: Vec ) -> uint { diff --git a/src/test/compile-fail/lint-ctypes-enum.rs b/src/test/compile-fail/lint-ctypes-enum.rs index d45a3b027a7..dea933085de 100644 --- a/src/test/compile-fail/lint-ctypes-enum.rs +++ b/src/test/compile-fail/lint-ctypes-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(ctypes)] +#![deny(improper_ctypes)] #![allow(dead_code)] enum Z { } diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs index 9e609814c8b..1755a9a2481 100644 --- a/src/test/compile-fail/lint-ctypes.rs +++ b/src/test/compile-fail/lint-ctypes.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(ctypes)] +#![deny(improper_ctypes)] extern crate libc; diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs index 96d40c52657..1283c61e41a 100644 --- a/src/test/compile-fail/lint-dead-code-1.rs +++ b/src/test/compile-fail/lint-dead-code-1.rs @@ -9,9 +9,9 @@ // except according to those terms. #![no_std] -#![allow(unused_variable)] +#![allow(unused_variables)] #![allow(non_camel_case_types)] -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] #![deny(dead_code)] #![crate_type="lib"] diff --git a/src/test/compile-fail/lint-dead-code-2.rs b/src/test/compile-fail/lint-dead-code-2.rs index eb284c4d054..c7199eec8a3 100644 --- a/src/test/compile-fail/lint-dead-code-2.rs +++ b/src/test/compile-fail/lint-dead-code-2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_variable)] +#![allow(unused_variables)] #![deny(dead_code)] struct Foo; diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/compile-fail/lint-dead-code-3.rs index f73c19b5fc9..4ef76030bcc 100644 --- a/src/test/compile-fail/lint-dead-code-3.rs +++ b/src/test/compile-fail/lint-dead-code-3.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_variable)] +#![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs index ac8b9c3821e..a698bf61f58 100644 --- a/src/test/compile-fail/lint-dead-code-4.rs +++ b/src/test/compile-fail/lint-dead-code-4.rs @@ -9,7 +9,7 @@ // except according to those terms. #![feature(struct_variant)] -#![allow(unused_variable)] +#![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] diff --git a/src/test/compile-fail/lint-dead-code-5.rs b/src/test/compile-fail/lint-dead-code-5.rs index 62afa089bbe..1f0d91dcb3c 100644 --- a/src/test/compile-fail/lint-dead-code-5.rs +++ b/src/test/compile-fail/lint-dead-code-5.rs @@ -9,7 +9,7 @@ // except according to those terms. #![feature(struct_variant)] -#![allow(unused_variable)] +#![allow(unused_variables)] #![deny(dead_code)] enum Enum1 { diff --git a/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs b/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs index bbd88f1f0aa..efb28449564 100644 --- a/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs +++ b/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs @@ -9,7 +9,7 @@ // except according to those terms. #![deny(unused_imports)] -#![allow(non_uppercase_statics)] +#![allow(non_upper_case_globals)] // The aim of this test is to ensure that deny/allow/warn directives // are applied to individual "use" statements instead of silently diff --git a/src/test/compile-fail/lint-misplaced-attr.rs b/src/test/compile-fail/lint-misplaced-attr.rs index dea712e976b..18ea5a383f6 100644 --- a/src/test/compile-fail/lint-misplaced-attr.rs +++ b/src/test/compile-fail/lint-misplaced-attr.rs @@ -11,7 +11,7 @@ // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. -#![deny(unused_attribute)] +#![deny(unused_attributes)] mod a { #![crate_type = "bin"] //~ ERROR unused attribute diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs index a63a3a61f68..f0b6abe28d3 100644 --- a/src/test/compile-fail/lint-missing-doc.rs +++ b/src/test/compile-fail/lint-missing-doc.rs @@ -12,7 +12,7 @@ // injected intrinsics by the compiler. #![feature(struct_variant)] #![feature(globs)] -#![deny(missing_doc)] +#![deny(missing_docs)] #![allow(dead_code)] //! Some garbage docs for the crate here @@ -28,7 +28,7 @@ pub struct PubFoo { //~ ERROR: missing documentation b: int, } -#[allow(missing_doc)] +#[allow(missing_docs)] pub struct PubFoo2 { pub a: int, pub c: int, @@ -41,7 +41,7 @@ pub mod pub_module_no_dox {} //~ ERROR: missing documentation pub fn foo() {} pub fn foo2() {} //~ ERROR: missing documentation fn foo3() {} -#[allow(missing_doc)] pub fn foo4() {} +#[allow(missing_docs)] pub fn foo4() {} /// dox pub trait A { @@ -50,7 +50,7 @@ pub trait A { /// dox fn foo_with_impl() {} } -#[allow(missing_doc)] +#[allow(missing_docs)] trait B { fn foo(); fn foo_with_impl() {} @@ -59,7 +59,7 @@ pub trait C { //~ ERROR: missing documentation fn foo(); //~ ERROR: missing documentation fn foo_with_impl() {} //~ ERROR: missing documentation } -#[allow(missing_doc)] pub trait D {} +#[allow(missing_docs)] pub trait D {} impl Foo { pub fn foo() {} @@ -71,10 +71,10 @@ impl PubFoo { /// dox pub fn foo1() {} fn foo2() {} - #[allow(missing_doc)] pub fn foo3() {} + #[allow(missing_docs)] pub fn foo3() {} } -#[allow(missing_doc)] +#[allow(missing_docs)] trait F { fn a(); fn b(&self); @@ -86,7 +86,7 @@ impl F for Foo { fn b(&self) {} } -// It sure is nice if doc(hidden) implies allow(missing_doc), and that it +// It sure is nice if doc(hidden) implies allow(missing_docs), and that it // applies recursively #[doc(hidden)] mod a { @@ -121,7 +121,7 @@ pub enum PubBaz2 { }, } -#[allow(missing_doc)] +#[allow(missing_docs)] pub enum PubBaz3 { PubBaz3A { pub a: int, diff --git a/src/test/compile-fail/lint-non-uppercase-statics.rs b/src/test/compile-fail/lint-non-uppercase-statics.rs index 2d9f2d8fc1c..7ff5cafd097 100644 --- a/src/test/compile-fail/lint-non-uppercase-statics.rs +++ b/src/test/compile-fail/lint-non-uppercase-statics.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![forbid(non_uppercase_statics)] +#![forbid(non_upper_case_globals)] #![allow(dead_code)] static foo: int = 1; //~ ERROR static constant `foo` should have an uppercase name such as `FOO` diff --git a/src/test/compile-fail/lint-obsolete-attr.rs b/src/test/compile-fail/lint-obsolete-attr.rs index 6b46a0c19bd..e4fd042d098 100644 --- a/src/test/compile-fail/lint-obsolete-attr.rs +++ b/src/test/compile-fail/lint-obsolete-attr.rs @@ -11,7 +11,7 @@ // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. -#![deny(unused_attribute)] +#![deny(unused_attributes)] #![allow(dead_code)] #[abi="stdcall"] extern {} //~ ERROR unused attribute diff --git a/src/test/compile-fail/lint-owned-heap-memory.rs b/src/test/compile-fail/lint-owned-heap-memory.rs index 8f20999a56c..5ee16f0aa26 100644 --- a/src/test/compile-fail/lint-owned-heap-memory.rs +++ b/src/test/compile-fail/lint-owned-heap-memory.rs @@ -9,7 +9,7 @@ // except according to those terms. #![allow(dead_code)] -#![forbid(owned_heap_memory)] +#![forbid(box_pointers)] struct Foo { diff --git a/src/test/compile-fail/lint-qualification.rs b/src/test/compile-fail/lint-qualification.rs index 7006a283750..18a5a8ecc5d 100644 --- a/src/test/compile-fail/lint-qualification.rs +++ b/src/test/compile-fail/lint-qualification.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unnecessary_qualification)] +#![deny(unused_qualifications)] mod foo { pub fn bar() {} diff --git a/src/test/compile-fail/lint-type-overflow.rs b/src/test/compile-fail/lint-type-overflow.rs index 81b186a2998..47dc93dae13 100644 --- a/src/test/compile-fail/lint-type-overflow.rs +++ b/src/test/compile-fail/lint-type-overflow.rs @@ -9,13 +9,13 @@ // except according to those terms. // -#![deny(type_overflow)] +#![deny(overflowing_literals)] fn test(x: i8) { println!("x {}", x); } -#[allow(unused_variable)] +#[allow(unused_variables)] fn main() { let x1: u8 = 255; // should be OK let x1: u8 = 256; //~ error: literal out of range for its type diff --git a/src/test/compile-fail/lint-unknown-attr.rs b/src/test/compile-fail/lint-unknown-attr.rs index 020ed80c0fb..e4cb92477c2 100644 --- a/src/test/compile-fail/lint-unknown-attr.rs +++ b/src/test/compile-fail/lint-unknown-attr.rs @@ -11,7 +11,7 @@ // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. -#![deny(unused_attribute)] +#![deny(unused_attributes)] #![mutable_doc] //~ ERROR unused attribute diff --git a/src/test/compile-fail/lint-unnecessary-casts.rs b/src/test/compile-fail/lint-unnecessary-casts.rs index 644c5d9fb3d..b3cf8257b8f 100644 --- a/src/test/compile-fail/lint-unnecessary-casts.rs +++ b/src/test/compile-fail/lint-unnecessary-casts.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![forbid(unnecessary_typecast)] +#![forbid(unused_typecasts)] fn foo_i32(_: i32) {} diff --git a/src/test/compile-fail/lint-unnecessary-import-braces.rs b/src/test/compile-fail/lint-unnecessary-import-braces.rs index c44918d9879..1c0401ec56b 100644 --- a/src/test/compile-fail/lint-unnecessary-import-braces.rs +++ b/src/test/compile-fail/lint-unnecessary-import-braces.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unnecessary_import_braces)] +#![deny(unused_import_braces)] #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/compile-fail/lint-unnecessary-parens.rs b/src/test/compile-fail/lint-unnecessary-parens.rs index 6c766dec9a3..826a4ea5a80 100644 --- a/src/test/compile-fail/lint-unnecessary-parens.rs +++ b/src/test/compile-fail/lint-unnecessary-parens.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unnecessary_parens)] +#![deny(unused_parens)] #![feature(if_let,while_let)] #[deriving(Eq, PartialEq)] diff --git a/src/test/compile-fail/lint-unsafe-block.rs b/src/test/compile-fail/lint-unsafe-block.rs index a4c50781a77..8899d06804f 100644 --- a/src/test/compile-fail/lint-unsafe-block.rs +++ b/src/test/compile-fail/lint-unsafe-block.rs @@ -10,12 +10,12 @@ #![allow(unused_unsafe)] #![allow(dead_code)] -#![deny(unsafe_block)] +#![deny(unsafe_blocks)] #![feature(macro_rules)] unsafe fn allowed() {} -#[allow(unsafe_block)] fn also_allowed() { unsafe {} } +#[allow(unsafe_blocks)] fn also_allowed() { unsafe {} } macro_rules! unsafe_in_macro { () => { diff --git a/src/test/compile-fail/lint-unused-extern-crate.rs b/src/test/compile-fail/lint-unused-extern-crate.rs index a4dfdbdaeae..a63e8e913f4 100644 --- a/src/test/compile-fail/lint-unused-extern-crate.rs +++ b/src/test/compile-fail/lint-unused-extern-crate.rs @@ -9,8 +9,8 @@ // except according to those terms. #![feature(globs)] -#![deny(unused_extern_crate)] -#![allow(unused_variable)] +#![deny(unused_extern_crates)] +#![allow(unused_variables)] extern crate libc; //~ ERROR: unused extern crate diff --git a/src/test/compile-fail/lint-unused-mut-self.rs b/src/test/compile-fail/lint-unused-mut-self.rs index fc19a1ba06f..370f664e430 100644 --- a/src/test/compile-fail/lint-unused-mut-self.rs +++ b/src/test/compile-fail/lint-unused-mut-self.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(dead_assignment)] -#![allow(unused_variable)] +#![allow(unused_assignments)] +#![allow(unused_variables)] #![allow(dead_code)] #![deny(unused_mut)] diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs index c5281bf6781..29b4686198b 100644 --- a/src/test/compile-fail/lint-unused-mut-variables.rs +++ b/src/test/compile-fail/lint-unused-mut-variables.rs @@ -10,8 +10,8 @@ // Exercise the unused_mut attribute in some positive and negative cases -#![allow(dead_assignment)] -#![allow(unused_variable)] +#![allow(unused_assignments)] +#![allow(unused_variables)] #![allow(dead_code)] #![deny(unused_mut)] diff --git a/src/test/compile-fail/liveness-dead.rs b/src/test/compile-fail/liveness-dead.rs index cba0a1da7e6..18baf7a9c3f 100644 --- a/src/test/compile-fail/liveness-dead.rs +++ b/src/test/compile-fail/liveness-dead.rs @@ -9,7 +9,7 @@ // except according to those terms. #![allow(dead_code)] -#![deny(dead_assignment)] +#![deny(unused_assignments)] fn f1(x: &mut int) { *x = 1; // no error diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index 41a30e23b22..a747615199e 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unused_variable)] -#![deny(dead_assignment)] +#![deny(unused_variables)] +#![deny(unused_assignments)] #![allow(dead_code, non_camel_case_types)] fn f1(x: int) { @@ -20,7 +20,7 @@ fn f1b(x: &mut int) { //~^ ERROR unused variable: `x` } -#[allow(unused_variable)] +#[allow(unused_variables)] fn f1c(x: int) {} fn f1d() { @@ -48,14 +48,14 @@ fn f3b() { } } -#[allow(unused_variable)] +#[allow(unused_variables)] fn f3c() { let mut z = 3i; loop { z += 4i; } } -#[allow(unused_variable)] -#[allow(dead_assignment)] +#[allow(unused_variables)] +#[allow(unused_assignments)] fn f3d() { let mut x = 3i; x += 4i; diff --git a/src/test/compile-fail/match-static-const-lc.rs b/src/test/compile-fail/match-static-const-lc.rs index af7938948a7..15a832aad89 100644 --- a/src/test/compile-fail/match-static-const-lc.rs +++ b/src/test/compile-fail/match-static-const-lc.rs @@ -11,9 +11,9 @@ // Issue #7526: lowercase static constants in patterns look like bindings #![allow(dead_code)] -#![deny(non_uppercase_statics)] +#![deny(non_upper_case_globals)] -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const a : int = 97; fn f() { @@ -26,7 +26,7 @@ fn f() { } mod m { - #[allow(non_uppercase_statics)] + #[allow(non_upper_case_globals)] pub const aha : int = 7; } diff --git a/src/test/compile-fail/regions-fn-subtyping-return-static.rs b/src/test/compile-fail/regions-fn-subtyping-return-static.rs index 2d20634cdc4..714abc23c61 100644 --- a/src/test/compile-fail/regions-fn-subtyping-return-static.rs +++ b/src/test/compile-fail/regions-fn-subtyping-return-static.rs @@ -17,7 +17,7 @@ // lifetimes are sublifetimes of 'static. #![allow(dead_code)] -#![allow(unused_variable)] +#![allow(unused_variables)] struct S; diff --git a/src/test/compile-fail/unreachable-code.rs b/src/test/compile-fail/unreachable-code.rs index fb9a6b52018..87342352e9a 100644 --- a/src/test/compile-fail/unreachable-code.rs +++ b/src/test/compile-fail/unreachable-code.rs @@ -9,7 +9,7 @@ // except according to those terms. #![deny(unreachable_code)] -#![allow(unused_variable)] +#![allow(unused_variables)] fn main() { loop{} diff --git a/src/test/compile-fail/unused-attr.rs b/src/test/compile-fail/unused-attr.rs index 0a5a9db8fa8..e797c7eec5f 100644 --- a/src/test/compile-fail/unused-attr.rs +++ b/src/test/compile-fail/unused-attr.rs @@ -7,7 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unused_attribute)] +#![deny(unused_attributes)] #![allow(dead_code, unused_imports)] #![foo] //~ ERROR unused attribute diff --git a/src/test/compile-fail/unused-result.rs b/src/test/compile-fail/unused-result.rs index ecc52c0ee7d..b5d253c5923 100644 --- a/src/test/compile-fail/unused-result.rs +++ b/src/test/compile-fail/unused-result.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unused_result, unused_must_use)] +#![deny(unused_results, unused_must_use)] #![allow(dead_code)] #[must_use] @@ -23,14 +23,14 @@ fn bar() -> int { return foo::(); } fn baz() -> MustUse { return foo::(); } fn qux() -> MustUseMsg { return foo::(); } -#[allow(unused_result)] +#[allow(unused_results)] fn test() { foo::(); foo::(); //~ ERROR: unused result which must be used foo::(); //~ ERROR: unused result which must be used: some message } -#[allow(unused_result, unused_must_use)] +#[allow(unused_results, unused_must_use)] fn test2() { foo::(); foo::(); diff --git a/src/test/compile-fail/warn-foreign-int-types.rs b/src/test/compile-fail/warn-foreign-int-types.rs index cfa6623176c..5f7a2f69c4f 100644 --- a/src/test/compile-fail/warn-foreign-int-types.rs +++ b/src/test/compile-fail/warn-foreign-int-types.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![forbid(ctypes)] +#![forbid(improper_ctypes)] #![allow(dead_code)] mod xx { diff --git a/src/test/debuginfo/basic-types-globals-metadata.rs b/src/test/debuginfo/basic-types-globals-metadata.rs index 66631f7efba..b2f82493fa7 100644 --- a/src/test/debuginfo/basic-types-globals-metadata.rs +++ b/src/test/debuginfo/basic-types-globals-metadata.rs @@ -46,7 +46,7 @@ // gdb-check:type = f64 // gdb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] #![allow(dead_code)] diff --git a/src/test/debuginfo/basic-types-globals.rs b/src/test/debuginfo/basic-types-globals.rs index 9755c8711ae..d08feadefda 100644 --- a/src/test/debuginfo/basic-types-globals.rs +++ b/src/test/debuginfo/basic-types-globals.rs @@ -52,7 +52,7 @@ // gdb-check:$14 = 3.5 // gdb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] static B: bool = false; static I: int = -1; diff --git a/src/test/debuginfo/basic-types-metadata.rs b/src/test/debuginfo/basic-types-metadata.rs index d67a6b1e200..35d70dd2f10 100644 --- a/src/test/debuginfo/basic-types-metadata.rs +++ b/src/test/debuginfo/basic-types-metadata.rs @@ -49,7 +49,7 @@ // gdb-check:[...]![...]_yyy([...])([...]); // gdb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] fn main() { let unit: () = (); diff --git a/src/test/debuginfo/basic-types-mut-globals.rs b/src/test/debuginfo/basic-types-mut-globals.rs index 9fb3644d75d..241bfcd7510 100644 --- a/src/test/debuginfo/basic-types-mut-globals.rs +++ b/src/test/debuginfo/basic-types-mut-globals.rs @@ -87,7 +87,7 @@ // gdb-command:detach // gdb-command:quit -#![allow(unused_variable)] +#![allow(unused_variables)] static mut B: bool = false; static mut I: int = -1; diff --git a/src/test/debuginfo/basic-types.rs b/src/test/debuginfo/basic-types.rs index b9e9b03c41b..525d71b560f 100644 --- a/src/test/debuginfo/basic-types.rs +++ b/src/test/debuginfo/basic-types.rs @@ -89,7 +89,7 @@ // lldb-command:print f64 // lldb-check:[...]$12 = 3.5 -#![allow(unused_variable)] +#![allow(unused_variables)] fn main() { let b: bool = false; diff --git a/src/test/debuginfo/borrowed-basic.rs b/src/test/debuginfo/borrowed-basic.rs index aad9e40e040..eac3652f163 100644 --- a/src/test/debuginfo/borrowed-basic.rs +++ b/src/test/debuginfo/borrowed-basic.rs @@ -110,7 +110,7 @@ // lldb-command:print *f64_ref // lldb-check:[...]$12 = 3.5 -#![allow(unused_variable)] +#![allow(unused_variables)] fn main() { let bool_val: bool = true; diff --git a/src/test/debuginfo/borrowed-c-style-enum.rs b/src/test/debuginfo/borrowed-c-style-enum.rs index e7a90780f57..b2431d7221f 100644 --- a/src/test/debuginfo/borrowed-c-style-enum.rs +++ b/src/test/debuginfo/borrowed-c-style-enum.rs @@ -42,7 +42,7 @@ // lldb-command:print *the_c_ref // lldb-check:[...]$2 = TheC -#![allow(unused_variable)] +#![allow(unused_variables)] enum ABC { TheA, TheB, TheC } diff --git a/src/test/debuginfo/borrowed-enum.rs b/src/test/debuginfo/borrowed-enum.rs index fa3fff9fdbc..8b72f2538c5 100644 --- a/src/test/debuginfo/borrowed-enum.rs +++ b/src/test/debuginfo/borrowed-enum.rs @@ -41,7 +41,7 @@ // lldb-command:print *univariant_ref // lldb-check:[...]$2 = TheOnlyCase(4820353753753434) -#![allow(unused_variable)] +#![allow(unused_variables)] #![feature(struct_variant)] // The first element is to ensure proper alignment, irrespective of the machines word size. Since diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs index a784fef2cb9..a9c5a59488f 100644 --- a/src/test/debuginfo/borrowed-struct.rs +++ b/src/test/debuginfo/borrowed-struct.rs @@ -65,7 +65,7 @@ // lldb-command:print *unique_val_interior_ref_2 // lldb-check:[...]$6 = 26.5 -#![allow(unused_variable)] +#![allow(unused_variables)] struct SomeStruct { x: int, diff --git a/src/test/debuginfo/borrowed-tuple.rs b/src/test/debuginfo/borrowed-tuple.rs index a41a24b53b5..f5afa008d2e 100644 --- a/src/test/debuginfo/borrowed-tuple.rs +++ b/src/test/debuginfo/borrowed-tuple.rs @@ -43,7 +43,7 @@ // lldb-check:[...]$2 = (-17, -22) -#![allow(unused_variable)] +#![allow(unused_variables)] fn main() { let stack_val: (i16, f32) = (-14, -19f32); diff --git a/src/test/debuginfo/borrowed-unique-basic.rs b/src/test/debuginfo/borrowed-unique-basic.rs index 9fcb49927f6..2592b166256 100644 --- a/src/test/debuginfo/borrowed-unique-basic.rs +++ b/src/test/debuginfo/borrowed-unique-basic.rs @@ -112,7 +112,7 @@ // lldb-command:print *f64_ref // lldb-check:[...]$12 = 3.5 -#![allow(unused_variable)] +#![allow(unused_variables)] fn main() { diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs index 6acd94743c2..8075d9ab69d 100644 --- a/src/test/debuginfo/box.rs +++ b/src/test/debuginfo/box.rs @@ -33,7 +33,7 @@ // lldb-command:print *b // lldb-check:[...]$1 = (2, 3.5) -#![allow(unused_variable)] +#![allow(unused_variables)] fn main() { let a = box 1i; diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs index 348e03c04a6..87eea49dd0c 100644 --- a/src/test/debuginfo/boxed-struct.rs +++ b/src/test/debuginfo/boxed-struct.rs @@ -36,7 +36,7 @@ // lldb-command:print *unique_dtor // lldb-check:[...]$1 = StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 } -#![allow(unused_variable)] +#![allow(unused_variables)] struct StructWithSomePadding { x: i16, diff --git a/src/test/debuginfo/c-style-enum-in-composite.rs b/src/test/debuginfo/c-style-enum-in-composite.rs index cea1840e3a3..ec385840d1d 100644 --- a/src/test/debuginfo/c-style-enum-in-composite.rs +++ b/src/test/debuginfo/c-style-enum-in-composite.rs @@ -66,7 +66,7 @@ // lldb-command:print struct_with_drop // lldb-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9) -#![allow(unused_variable)] +#![allow(unused_variables)] enum AnEnum { OneHundred = 100, diff --git a/src/test/debuginfo/c-style-enum.rs b/src/test/debuginfo/c-style-enum.rs index 5f4521b6504..9f80f6475e2 100644 --- a/src/test/debuginfo/c-style-enum.rs +++ b/src/test/debuginfo/c-style-enum.rs @@ -101,7 +101,7 @@ // lldb-command:print single_variant // lldb-check:[...]$6 = TheOnlyVariant -#![allow(unused_variable)] +#![allow(unused_variables)] #![allow(dead_code)] enum AutoDiscriminant { diff --git a/src/test/debuginfo/destructured-fn-argument.rs b/src/test/debuginfo/destructured-fn-argument.rs index 81ff0bb6d4f..993a1a55012 100644 --- a/src/test/debuginfo/destructured-fn-argument.rs +++ b/src/test/debuginfo/destructured-fn-argument.rs @@ -333,7 +333,7 @@ // lldb-check:[...]$48 = 62 // lldb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] struct Struct { diff --git a/src/test/debuginfo/destructured-local.rs b/src/test/debuginfo/destructured-local.rs index 0bce797a36f..a16298349ed 100644 --- a/src/test/debuginfo/destructured-local.rs +++ b/src/test/debuginfo/destructured-local.rs @@ -245,7 +245,7 @@ // lldb-check:[...]$42 = 56 -#![allow(unused_variable)] +#![allow(unused_variables)] struct Struct { a: i64, diff --git a/src/test/debuginfo/evec-in-struct.rs b/src/test/debuginfo/evec-in-struct.rs index 48d4dd26b00..66407d68aa6 100644 --- a/src/test/debuginfo/evec-in-struct.rs +++ b/src/test/debuginfo/evec-in-struct.rs @@ -53,7 +53,7 @@ // lldb-command:print struct_padded_at_end // lldb-check:[...]$4 = StructPaddedAtEnd { x: [22, 23], y: [24, 25] } -#![allow(unused_variable)] +#![allow(unused_variables)] struct NoPadding1 { x: [u32, ..3], diff --git a/src/test/debuginfo/function-arg-initialization.rs b/src/test/debuginfo/function-arg-initialization.rs index 602cca979f2..ea9802afe94 100644 --- a/src/test/debuginfo/function-arg-initialization.rs +++ b/src/test/debuginfo/function-arg-initialization.rs @@ -236,7 +236,7 @@ -#![allow(unused_variable)] +#![allow(unused_variables)] diff --git a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs index 1814eca0f7d..359d14d2a50 100644 --- a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs +++ b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs @@ -245,7 +245,7 @@ // lldb-check:[...]$31 = 45 // lldb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] #[no_stack_check] fn immediate_args(a: int, b: bool, c: f64) { diff --git a/src/test/debuginfo/function-prologue-stepping-regular.rs b/src/test/debuginfo/function-prologue-stepping-regular.rs index 060ba4a4932..dbeb87fd44a 100644 --- a/src/test/debuginfo/function-prologue-stepping-regular.rs +++ b/src/test/debuginfo/function-prologue-stepping-regular.rs @@ -125,7 +125,7 @@ // lldb-check:[...]$31 = 45 // lldb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] fn immediate_args(a: int, b: bool, c: f64) { () diff --git a/src/test/debuginfo/include_string.rs b/src/test/debuginfo/include_string.rs index 179bbf7dfe4..378b27b3597 100644 --- a/src/test/debuginfo/include_string.rs +++ b/src/test/debuginfo/include_string.rs @@ -37,7 +37,7 @@ // lldb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] // This test case makes sure that debug info does not ICE when include_str is // used multiple times (see issue #11322). diff --git a/src/test/debuginfo/lexical-scopes-in-block-expression.rs b/src/test/debuginfo/lexical-scopes-in-block-expression.rs index 99032ca078c..191b1d2a09c 100644 --- a/src/test/debuginfo/lexical-scopes-in-block-expression.rs +++ b/src/test/debuginfo/lexical-scopes-in-block-expression.rs @@ -373,8 +373,8 @@ // lldb-check:[...]$47 = 10 // lldb-command:continue -#![allow(unused_variable)] -#![allow(dead_assignment)] +#![allow(unused_variables)] +#![allow(unused_assignments)] static mut MUT_INT: int = 0; diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs index 6c71971a0f8..292e42ba30b 100644 --- a/src/test/debuginfo/limited-debuginfo.rs +++ b/src/test/debuginfo/limited-debuginfo.rs @@ -31,7 +31,7 @@ // gdb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] struct Struct { a: i64, diff --git a/src/test/debuginfo/multiple-functions-equal-var-names.rs b/src/test/debuginfo/multiple-functions-equal-var-names.rs index 3490b12d15a..6bb2313100f 100644 --- a/src/test/debuginfo/multiple-functions-equal-var-names.rs +++ b/src/test/debuginfo/multiple-functions-equal-var-names.rs @@ -48,7 +48,7 @@ // lldb-command:print abc // lldb-check:[...]$2 = 30303 -#![allow(unused_variable)] +#![allow(unused_variables)] fn function_one() { let abc = 10101i; diff --git a/src/test/debuginfo/multiple-functions.rs b/src/test/debuginfo/multiple-functions.rs index 06a2d2e5d11..58fe9d250c9 100644 --- a/src/test/debuginfo/multiple-functions.rs +++ b/src/test/debuginfo/multiple-functions.rs @@ -48,7 +48,7 @@ // lldb-command:print c // lldb-check:[...]$2 = 30303 -#![allow(unused_variable)] +#![allow(unused_variables)] fn function_one() { let a = 10101i; diff --git a/src/test/debuginfo/nil-enum.rs b/src/test/debuginfo/nil-enum.rs index 511786999ab..a0c72615753 100644 --- a/src/test/debuginfo/nil-enum.rs +++ b/src/test/debuginfo/nil-enum.rs @@ -24,7 +24,7 @@ // gdb-command:print second // gdb-check:$2 = {} -#![allow(unused_variable)] +#![allow(unused_variables)] enum ANilEnum {} enum AnotherNilEnum {} diff --git a/src/test/debuginfo/no-debug-attribute.rs b/src/test/debuginfo/no-debug-attribute.rs index e61ded4ee26..a739c9ee5fa 100644 --- a/src/test/debuginfo/no-debug-attribute.rs +++ b/src/test/debuginfo/no-debug-attribute.rs @@ -25,7 +25,7 @@ // gdb-check:abc = 10 // gdb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] fn function_with_debuginfo() { let abc = 10u; diff --git a/src/test/debuginfo/packed-struct-with-destructor.rs b/src/test/debuginfo/packed-struct-with-destructor.rs index 9af6130e5a9..438a771b7be 100644 --- a/src/test/debuginfo/packed-struct-with-destructor.rs +++ b/src/test/debuginfo/packed-struct-with-destructor.rs @@ -76,7 +76,7 @@ // lldb-check:[...]$7 = DeeplyNested { a: PackedInPacked { a: 1, b: Packed { x: 2, y: 3, z: 4 }, c: 5, d: Packed { x: 6, y: 7, z: 8 } }, b: UnpackedInPackedWithDrop { a: 9, b: Unpacked { x: 10, y: 11, z: 12 }, c: Unpacked { x: 13, y: 14, z: 15 }, d: 16 }, c: PackedInUnpacked { a: 17, b: Packed { x: 18, y: 19, z: 20 }, c: 21, d: Packed { x: 22, y: 23, z: 24 } }, d: PackedInUnpackedWithDrop { a: 25, b: Packed { x: 26, y: 27, z: 28 }, c: 29, d: Packed { x: 30, y: 31, z: 32 } }, e: UnpackedInPacked { a: 33, b: Unpacked { x: 34, y: 35, z: 36 }, c: Unpacked { x: 37, y: 38, z: 39 }, d: 40 }, f: PackedInPackedWithDrop { a: 41, b: Packed { x: 42, y: 43, z: 44 }, c: 45, d: Packed { x: 46, y: 47, z: 48 } } } -#![allow(unused_variable)] +#![allow(unused_variables)] #[repr(packed)] struct Packed { diff --git a/src/test/debuginfo/packed-struct.rs b/src/test/debuginfo/packed-struct.rs index 3e29efd7f8d..906a1f4685b 100644 --- a/src/test/debuginfo/packed-struct.rs +++ b/src/test/debuginfo/packed-struct.rs @@ -62,7 +62,7 @@ // lldb-command:print sizeof(packedInPacked) // lldb-check:[...]$5 = 40 -#![allow(unused_variable)] +#![allow(unused_variables)] #[repr(packed)] struct Packed { diff --git a/src/test/debuginfo/recursive-enum.rs b/src/test/debuginfo/recursive-enum.rs index 4eb251c6084..6d26e2eff7a 100644 --- a/src/test/debuginfo/recursive-enum.rs +++ b/src/test/debuginfo/recursive-enum.rs @@ -18,7 +18,7 @@ // Test whether compiling a recursive enum definition crashes debug info generation. The test case // is taken from issue #11083. -#![allow(unused_variable)] +#![allow(unused_variables)] pub struct Window<'a> { callbacks: WindowCallbacks<'a> diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs index 40c056f5cd2..1e64dc3a031 100644 --- a/src/test/debuginfo/recursive-struct.rs +++ b/src/test/debuginfo/recursive-struct.rs @@ -72,7 +72,7 @@ // gdb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] #![feature(struct_variant)] enum Opt { diff --git a/src/test/debuginfo/simd.rs b/src/test/debuginfo/simd.rs index e355327a5ef..d8854eb9084 100644 --- a/src/test/debuginfo/simd.rs +++ b/src/test/debuginfo/simd.rs @@ -44,7 +44,7 @@ // gdb-command:continue #![allow(experimental)] -#![allow(unused_variable)] +#![allow(unused_variables)] use std::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2}; diff --git a/src/test/debuginfo/simple-struct.rs b/src/test/debuginfo/simple-struct.rs index 66e03f81aa6..83f77b08b68 100644 --- a/src/test/debuginfo/simple-struct.rs +++ b/src/test/debuginfo/simple-struct.rs @@ -99,7 +99,7 @@ // lldb-command:print padding_at_end // lldb-check:[...]$5 = PaddingAtEnd { x: -10014, y: 10015 } -#![allow(unused_variable)]; +#![allow(unused_variables)]; #![allow(dead_code)]; struct NoPadding16 { diff --git a/src/test/debuginfo/simple-tuple.rs b/src/test/debuginfo/simple-tuple.rs index b0cdf5991e8..26239f7f62b 100644 --- a/src/test/debuginfo/simple-tuple.rs +++ b/src/test/debuginfo/simple-tuple.rs @@ -95,7 +95,7 @@ // lldb-command:print paddingAtEnd // lldb-check:[...]$6 = (15, 16) -#![allow(unused_variable)] +#![allow(unused_variables)] #![allow(dead_code)] static mut NO_PADDING_8: (i8, u8) = (-50, 50); diff --git a/src/test/debuginfo/struct-in-enum.rs b/src/test/debuginfo/struct-in-enum.rs index 52b44457dc0..5e2ae478d7d 100644 --- a/src/test/debuginfo/struct-in-enum.rs +++ b/src/test/debuginfo/struct-in-enum.rs @@ -43,7 +43,7 @@ // lldb-command:print univariant // lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) -#![allow(unused_variable)] +#![allow(unused_variables)] struct Struct { x: u32, diff --git a/src/test/debuginfo/struct-in-struct.rs b/src/test/debuginfo/struct-in-struct.rs index eafeaeb5297..1e0b84f1ef1 100644 --- a/src/test/debuginfo/struct-in-struct.rs +++ b/src/test/debuginfo/struct-in-struct.rs @@ -59,7 +59,7 @@ // lldb-command:print tree // lldb-check:[...]$7 = Tree { x: Simple { x: 25 }, y: InternalPaddingParent { x: InternalPadding { x: 26, y: 27 }, y: InternalPadding { x: 28, y: 29 }, z: InternalPadding { x: 30, y: 31 } }, z: BagInBag { x: Bag { x: Simple { x: 32 } } } } -#![allow(unused_variable)] +#![allow(unused_variables)] struct Simple { x: i32 diff --git a/src/test/debuginfo/struct-style-enum.rs b/src/test/debuginfo/struct-style-enum.rs index 924b3743989..d23c65e71a0 100644 --- a/src/test/debuginfo/struct-style-enum.rs +++ b/src/test/debuginfo/struct-style-enum.rs @@ -50,7 +50,7 @@ // lldb-command:print univariant // lldb-check:[...]$3 = TheOnlyCase { a: -1 } -#![allow(unused_variable)] +#![allow(unused_variables)] #![feature(struct_variant)] // The first element is to ensure proper alignment, irrespective of the machines word size. Since diff --git a/src/test/debuginfo/struct-with-destructor.rs b/src/test/debuginfo/struct-with-destructor.rs index 32ff9f3f148..c2372da35aa 100644 --- a/src/test/debuginfo/struct-with-destructor.rs +++ b/src/test/debuginfo/struct-with-destructor.rs @@ -46,7 +46,7 @@ // lldb-command:print nested // lldb-check:[...]$3 = NestedOuter { a: NestedInner { a: WithDestructor { x: 7890, y: 9870 } } } -#![allow(unused_variable)] +#![allow(unused_variables)] struct NoDestructor { x: i32, diff --git a/src/test/debuginfo/trait-pointers.rs b/src/test/debuginfo/trait-pointers.rs index ca407aef1a4..de74a4d8f91 100644 --- a/src/test/debuginfo/trait-pointers.rs +++ b/src/test/debuginfo/trait-pointers.rs @@ -15,7 +15,7 @@ // compile-flags:-g // gdb-command:run -#![allow(unused_variable)] +#![allow(unused_variables)] trait Trait { diff --git a/src/test/debuginfo/tuple-in-struct.rs b/src/test/debuginfo/tuple-in-struct.rs index 9ac66f8300f..5a47b164648 100644 --- a/src/test/debuginfo/tuple-in-struct.rs +++ b/src/test/debuginfo/tuple-in-struct.rs @@ -42,7 +42,7 @@ // gdb-command:print mixed_padding // gdb-check:$10 = {x = {{40, 41, 42}, {43, 44}}, y = {45, 46, 47, 48}} -#![allow(unused_variable)] +#![allow(unused_variables)] struct NoPadding1 { x: (i32, i32), diff --git a/src/test/debuginfo/tuple-in-tuple.rs b/src/test/debuginfo/tuple-in-tuple.rs index 70344bd3d5e..b7f4b0efe0c 100644 --- a/src/test/debuginfo/tuple-in-tuple.rs +++ b/src/test/debuginfo/tuple-in-tuple.rs @@ -59,7 +59,7 @@ // lldb-command:print padding_at_end2 // lldb-check:[...]$6 = ((21, 22), 23) -#![allow(unused_variable)] +#![allow(unused_variables)] fn main() { let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3); diff --git a/src/test/debuginfo/tuple-style-enum.rs b/src/test/debuginfo/tuple-style-enum.rs index 1527c6a8e31..1c933637e3e 100644 --- a/src/test/debuginfo/tuple-style-enum.rs +++ b/src/test/debuginfo/tuple-style-enum.rs @@ -50,7 +50,7 @@ // lldb-command:print univariant // lldb-check:[...]$3 = TheOnlyCase(-1) -#![allow(unused_variable)] +#![allow(unused_variables)] // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs index 12a63614ba4..33382542ef2 100644 --- a/src/test/debuginfo/unique-enum.rs +++ b/src/test/debuginfo/unique-enum.rs @@ -43,7 +43,7 @@ // lldb-command:print *univariant // lldb-check:[...]$2 = TheOnlyCase(123234) -#![allow(unused_variable)] +#![allow(unused_variables)] #![feature(struct_variant)] // The first element is to ensure proper alignment, irrespective of the machines word size. Since diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs index c200b310a36..8f128c428e7 100644 --- a/src/test/debuginfo/var-captured-in-nested-closure.rs +++ b/src/test/debuginfo/var-captured-in-nested-closure.rs @@ -81,7 +81,7 @@ // lldb-check:[...]$11 = 8 // lldb-command:continue -#![allow(unused_variable)] +#![allow(unused_variables)] struct Struct { a: int, diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs index 9b8718d085a..da2726782e9 100644 --- a/src/test/debuginfo/var-captured-in-sendable-closure.rs +++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs @@ -38,7 +38,7 @@ // lldb-command:print *owned // lldb-check:[...]$2 = 5 -#![allow(unused_variable)] +#![allow(unused_variables)] struct Struct { a: int, diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index dc586c266b6..5d484bbacc8 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -46,7 +46,7 @@ // lldb-command:print *owned // lldb-check:[...]$4 = 6 -#![allow(unused_variable)] +#![allow(unused_variables)] struct Struct { a: int, diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index 688d2a595dc..6d56ed32c31 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -80,7 +80,7 @@ // lldb-command:print padded_struct // lldb-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }] -#![allow(unused_variable)] +#![allow(unused_variables)] #![feature(slicing_syntax)] struct AStruct { diff --git a/src/test/debuginfo/vec.rs b/src/test/debuginfo/vec.rs index f3761e4b54a..872d66fdc88 100644 --- a/src/test/debuginfo/vec.rs +++ b/src/test/debuginfo/vec.rs @@ -32,7 +32,7 @@ // lldb-command:print a // lldb-check:[...]$0 = [1, 2, 3] -#![allow(unused_variable)] +#![allow(unused_variables)] static mut VECT: [i32, ..3] = [1, 2, 3]; diff --git a/src/test/run-fail/explicit-fail-msg.rs b/src/test/run-fail/explicit-fail-msg.rs index 4af9b82ec7e..abc608a7957 100644 --- a/src/test/run-fail/explicit-fail-msg.rs +++ b/src/test/run-fail/explicit-fail-msg.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(dead_assignment)] -#![allow(unused_variable)] +#![allow(unused_assignments)] +#![allow(unused_variables)] // error-pattern:wooooo fn main() { diff --git a/src/test/run-fail/issue-3029.rs b/src/test/run-fail/issue-3029.rs index 539d2adc7d4..adbb4d9ab03 100644 --- a/src/test/run-fail/issue-3029.rs +++ b/src/test/run-fail/issue-3029.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unnecessary_allocation)] +#![allow(unused_allocation)] #![allow(unreachable_code)] -#![allow(unused_variable)] +#![allow(unused_variables)] // error-pattern:so long diff --git a/src/test/run-fail/issue-948.rs b/src/test/run-fail/issue-948.rs index 5669131aeee..0e67cd1ebc8 100644 --- a/src/test/run-fail/issue-948.rs +++ b/src/test/run-fail/issue-948.rs @@ -10,7 +10,7 @@ // error-pattern:beep boop -#![allow(unused_variable)] +#![allow(unused_variables)] struct Point { x: int, y: int } diff --git a/src/test/run-fail/match-bot-fail.rs b/src/test/run-fail/match-bot-fail.rs index 9d80f07de0a..d87dbc65e50 100644 --- a/src/test/run-fail/match-bot-fail.rs +++ b/src/test/run-fail/match-bot-fail.rs @@ -11,7 +11,7 @@ // error-pattern:explicit failure #![allow(unreachable_code)] -#![allow(unused_variable)] +#![allow(unused_variables)] fn foo(s: String) { } diff --git a/src/test/run-fail/rhs-type.rs b/src/test/run-fail/rhs-type.rs index d607ec76c35..d4485596aa7 100644 --- a/src/test/run-fail/rhs-type.rs +++ b/src/test/run-fail/rhs-type.rs @@ -13,7 +13,7 @@ // error-pattern:bye #![allow(unreachable_code)] -#![allow(unused_variable)] +#![allow(unused_variables)] struct T { t: String } -- cgit 1.4.1-3-g733a5 From 8e9f8f924cda8193ce1416c45cdcfce35fa6b8d1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 29 Oct 2014 15:26:29 -0700 Subject: collections: impl Deref for Vec/String This commit adds the following impls: impl Deref<[T]> for Vec impl DerefMut<[T]> for Vec impl Deref for String This commit also removes all duplicated inherent methods from vectors and strings as implementations will now silently call through to the slice implementation. Some breakage occurred at std and beneath due to inherent methods removed in favor of those in the slice traits and std doesn't use its own prelude, cc #18424 --- src/libcollections/str.rs | 69 ------ src/libcollections/string.rs | 5 + src/libcollections/vec.rs | 383 ++------------------------------ src/libcoretest/str.rs | 69 ++++++ src/libgraphviz/maybe_owned_vec.rs | 2 +- src/libstd/io/comm_adapters.rs | 2 +- src/libstd/io/net/addrinfo.rs | 1 + src/test/compile-fail/unique-vec-res.rs | 8 +- 8 files changed, 102 insertions(+), 437 deletions(-) (limited to 'src/libstd') diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 9cd8bde4a95..7e59111607e 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1677,40 +1677,6 @@ mod tests { assert_eq!(pos, p.len()); } - #[test] - fn test_split_char_iterator() { - let data = "\nMäry häd ä little lämb\nLittle lämb\n"; - - let split: Vec<&str> = data.split(' ').collect(); - assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); - - let mut rsplit: Vec<&str> = data.split(' ').rev().collect(); - rsplit.reverse(); - assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); - - let split: Vec<&str> = data.split(|c: char| c == ' ').collect(); - assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); - - let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect(); - rsplit.reverse(); - assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); - - // Unicode - let split: Vec<&str> = data.split('ä').collect(); - assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); - - let mut rsplit: Vec<&str> = data.split('ä').rev().collect(); - rsplit.reverse(); - assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); - - let split: Vec<&str> = data.split(|c: char| c == 'ä').collect(); - assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); - - let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect(); - rsplit.reverse(); - assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); - } - #[test] fn test_splitn_char_iterator() { let data = "\nMäry häd ä little lämb\nLittle lämb\n"; @@ -1729,28 +1695,6 @@ mod tests { assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]); } - #[test] - fn test_rsplitn_char_iterator() { - let data = "\nMäry häd ä little lämb\nLittle lämb\n"; - - let mut split: Vec<&str> = data.rsplitn(3, ' ').collect(); - split.reverse(); - assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]); - - let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == ' ').collect(); - split.reverse(); - assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]); - - // Unicode - let mut split: Vec<&str> = data.rsplitn(3, 'ä').collect(); - split.reverse(); - assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]); - - let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == 'ä').collect(); - split.reverse(); - assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]); - } - #[test] fn test_split_char_iterator_no_trailing() { let data = "\nMäry häd ä little lämb\nLittle lämb\n"; @@ -1762,19 +1706,6 @@ mod tests { assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb"]); } - #[test] - fn test_rev_split_char_iterator_no_trailing() { - let data = "\nMäry häd ä little lämb\nLittle lämb\n"; - - let mut split: Vec<&str> = data.split('\n').rev().collect(); - split.reverse(); - assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb", ""]); - - let mut split: Vec<&str> = data.split_terminator('\n').rev().collect(); - split.reverse(); - assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb"]); - } - #[test] fn test_words() { let data = "\n \tMäry häd\tä little lämb\nLittle lämb\n"; diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index c44a03b05cd..efe00975f9e 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -744,6 +744,11 @@ impl ops::Slice for String { } } +#[experimental = "waiting on Deref stabilization"] +impl ops::Deref for String { + fn deref<'a>(&'a self) -> &'a str { self.as_slice() } +} + /// Wrapper type providing a `&String` reference via `Deref`. #[experimental] pub struct DerefString<'a> { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index dd9883ecaae..173f39a3151 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -28,8 +28,7 @@ use core::raw::Slice as RawSlice; use core::uint; use {Mutable, MutableSeq}; -use slice::{MutableOrdSlice, MutableSliceAllocating, CloneableVector}; -use slice::{Items, MutItems}; +use slice::{CloneableVector}; /// An owned, growable vector. /// @@ -464,6 +463,16 @@ impl ops::SliceMut for Vec { } } +#[experimental = "waiting on Deref stability"] +impl ops::Deref<[T]> for Vec { + fn deref<'a>(&'a self) -> &'a [T] { self.as_slice() } +} + +#[experimental = "waiting on DerefMut stability"] +impl ops::DerefMut<[T]> for Vec { + fn deref_mut<'a>(&'a mut self) -> &'a mut [T] { self.as_mut_slice() } +} + #[experimental = "waiting on FromIterator stability"] impl FromIterator for Vec { #[inline] @@ -717,7 +726,7 @@ impl Vec { #[deprecated = "use .extend(other.into_iter())"] #[cfg(stage0)] pub fn push_all_move(&mut self, other: Vec) { - self.extend(other.into_iter()); + self.extend(other.into_iter()); } /// Returns a mutable slice of the elements of `self`. @@ -735,7 +744,7 @@ impl Vec { pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] { unsafe { mem::transmute(RawSlice { - data: self.as_mut_ptr() as *const T, + data: self.ptr as *const T, len: self.len, }) } @@ -809,124 +818,6 @@ impl Vec { &mut self.as_mut_slice()[index] } - /// Returns an iterator over references to the elements of the vector in - /// order. - /// - /// # Example - /// - /// ``` - /// let vec = vec![1i, 2, 3]; - /// for num in vec.iter() { - /// println!("{}", *num); - /// } - /// ``` - #[inline] - pub fn iter<'a>(&'a self) -> Items<'a,T> { - self.as_slice().iter() - } - - /// Returns an iterator over mutable references to the elements of the - /// vector in order. - /// - /// # Example - /// - /// ``` - /// let mut vec = vec![1i, 2, 3]; - /// for num in vec.iter_mut() { - /// *num = 0; - /// } - /// assert_eq!(vec, vec![0i, 0, 0]); - /// ``` - #[inline] - pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a,T> { - self.as_mut_slice().iter_mut() - } - - /// Sorts the vector, in place, using `compare` to compare elements. - /// - /// This sort is `O(n log n)` worst-case and stable, but allocates - /// approximately `2 * n`, where `n` is the length of `self`. - /// - /// # Example - /// - /// ``` - /// let mut v = vec![5i, 4, 1, 3, 2]; - /// v.sort_by(|a, b| a.cmp(b)); - /// assert_eq!(v, vec![1i, 2, 3, 4, 5]); - /// - /// // reverse sorting - /// v.sort_by(|a, b| b.cmp(a)); - /// assert_eq!(v, vec![5i, 4, 3, 2, 1]); - /// ``` - #[inline] - pub fn sort_by(&mut self, compare: |&T, &T| -> Ordering) { - self.as_mut_slice().sort_by(compare) - } - - /// Returns a slice of self spanning the interval [`start`, `end`). - /// - /// # Failure - /// - /// Fails when the slice (or part of it) is outside the bounds of self, or when - /// `start` > `end`. - /// - /// # Example - /// - /// ``` - /// let vec = vec![1i, 2, 3, 4]; - /// assert!(vec[0..2] == [1, 2]); - /// ``` - #[inline] - pub fn slice<'a>(&'a self, start: uint, end: uint) -> &'a [T] { - self[start..end] - } - - /// Returns a slice containing all but the first element of the vector. - /// - /// # Failure - /// - /// Fails when the vector is empty. - /// - /// # Example - /// - /// ``` - /// let vec = vec![1i, 2, 3]; - /// assert!(vec.tail() == [2, 3]); - /// ``` - #[inline] - pub fn tail<'a>(&'a self) -> &'a [T] { - self[].tail() - } - - /// Returns a reference to the last element of a vector, or `None` if it is - /// empty. - /// - /// # Example - /// - /// ``` - /// let vec = vec![1i, 2, 3]; - /// assert!(vec.last() == Some(&3)); - /// ``` - #[inline] - pub fn last<'a>(&'a self) -> Option<&'a T> { - self[].last() - } - - /// Returns a mutable reference to the last element of a vector, or `None` - /// if it is empty. - /// - /// # Example - /// - /// ``` - /// let mut vec = vec![1i, 2, 3]; - /// *vec.last_mut().unwrap() = 4; - /// assert_eq!(vec, vec![1i, 2, 4]); - /// ``` - #[inline] - pub fn last_mut<'a>(&'a mut self) -> Option<&'a mut T> { - self.as_mut_slice().last_mut() - } - /// Removes an element from anywhere in the vector and return it, replacing /// it with the last element. This does not preserve ordering, but is O(1). /// @@ -1035,215 +926,6 @@ impl Vec { } } - /// Returns a mutable slice of `self` between `start` and `end`. - /// - /// # Failure - /// - /// Fails when `start` or `end` point outside the bounds of `self`, or when - /// `start` > `end`. - /// - /// # Example - /// - /// ``` - /// let mut vec = vec![1i, 2, 3, 4]; - /// assert!(vec[mut 0..2] == [1, 2]); - /// ``` - #[inline] - pub fn slice_mut<'a>(&'a mut self, start: uint, end: uint) - -> &'a mut [T] { - self[mut start..end] - } - - /// Returns a mutable slice of `self` from `start` to the end of the `Vec`. - /// - /// # Failure - /// - /// Fails when `start` points outside the bounds of self. - /// - /// # Example - /// - /// ``` - /// let mut vec = vec![1i, 2, 3, 4]; - /// assert!(vec[mut 2..] == [3, 4]); - /// ``` - #[inline] - pub fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] { - self[mut start..] - } - - /// Returns a mutable slice of `self` from the start of the `Vec` to `end`. - /// - /// # Failure - /// - /// Fails when `end` points outside the bounds of self. - /// - /// # Example - /// - /// ``` - /// let mut vec = vec![1i, 2, 3, 4]; - /// assert!(vec[mut ..2] == [1, 2]); - /// ``` - #[inline] - pub fn slice_to_mut<'a>(&'a mut self, end: uint) -> &'a mut [T] { - self[mut ..end] - } - - /// Returns a pair of mutable slices that divides the `Vec` at an index. - /// - /// The first will contain all indices from `[0, mid)` (excluding - /// the index `mid` itself) and the second will contain all - /// indices from `[mid, len)` (excluding the index `len` itself). - /// - /// # Failure - /// - /// Fails if `mid > len`. - /// - /// # Example - /// - /// ``` - /// let mut vec = vec![1i, 2, 3, 4, 5, 6]; - /// - /// // scoped to restrict the lifetime of the borrows - /// { - /// let (left, right) = vec.split_at_mut(0); - /// assert!(left == &mut []); - /// assert!(right == &mut [1, 2, 3, 4, 5, 6]); - /// } - /// - /// { - /// let (left, right) = vec.split_at_mut(2); - /// assert!(left == &mut [1, 2]); - /// assert!(right == &mut [3, 4, 5, 6]); - /// } - /// - /// { - /// let (left, right) = vec.split_at_mut(6); - /// assert!(left == &mut [1, 2, 3, 4, 5, 6]); - /// assert!(right == &mut []); - /// } - /// ``` - #[inline] - pub fn split_at_mut<'a>(&'a mut self, mid: uint) -> (&'a mut [T], &'a mut [T]) { - self[mut].split_at_mut(mid) - } - - /// Reverses the order of elements in a vector, in place. - /// - /// # Example - /// - /// ``` - /// let mut v = vec![1i, 2, 3]; - /// v.reverse(); - /// assert_eq!(v, vec![3i, 2, 1]); - /// ``` - #[inline] - pub fn reverse(&mut self) { - self[mut].reverse() - } - - /// Returns a slice of `self` from `start` to the end of the vec. - /// - /// # Failure - /// - /// Fails when `start` points outside the bounds of self. - /// - /// # Example - /// - /// ``` - /// let vec = vec![1i, 2, 3]; - /// assert!(vec[1..] == [2, 3]); - /// ``` - #[inline] - pub fn slice_from<'a>(&'a self, start: uint) -> &'a [T] { - self[start..] - } - - /// Returns a slice of self from the start of the vec to `end`. - /// - /// # Failure - /// - /// Fails when `end` points outside the bounds of self. - /// - /// # Example - /// - /// ``` - /// let vec = vec![1i, 2, 3, 4]; - /// assert!(vec[..2] == [1, 2]); - /// ``` - #[inline] - pub fn slice_to<'a>(&'a self, end: uint) -> &'a [T] { - self[..end] - } - - /// Returns a slice containing all but the last element of the vector. - /// - /// # Failure - /// - /// Fails if the vector is empty - /// - /// # Example - /// - /// ``` - /// let vec = vec![1i, 2, 3]; - /// assert!(vec.init() == [1, 2]); - /// ``` - #[inline] - pub fn init<'a>(&'a self) -> &'a [T] { - self[0..self.len() - 1] - } - - - /// Returns an unsafe pointer to the vector's buffer. - /// - /// The caller must ensure that the vector outlives the pointer this - /// function returns, or else it will end up pointing to garbage. - /// - /// Modifying the vector may cause its buffer to be reallocated, which - /// would also make any pointers to it invalid. - /// - /// # Example - /// - /// ``` - /// let v = vec![1i, 2, 3]; - /// let p = v.as_ptr(); - /// unsafe { - /// // Examine each element manually - /// assert_eq!(*p, 1i); - /// assert_eq!(*p.offset(1), 2i); - /// assert_eq!(*p.offset(2), 3i); - /// } - /// ``` - #[inline] - pub fn as_ptr(&self) -> *const T { - self.ptr as *const T - } - - /// Returns a mutable unsafe pointer to the vector's buffer. - /// - /// The caller must ensure that the vector outlives the pointer this - /// function returns, or else it will end up pointing to garbage. - /// - /// Modifying the vector may cause its buffer to be reallocated, which - /// would also make any pointers to it invalid. - /// - /// # Example - /// - /// ``` - /// use std::ptr; - /// - /// let mut v = vec![1i, 2, 3]; - /// let p = v.as_mut_ptr(); - /// unsafe { - /// ptr::write(p, 9i); - /// ptr::write(p.offset(2), 5i); - /// } - /// assert_eq!(v, vec![9i, 2, 5]); - /// ``` - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self.ptr - } - /// Retains only the elements specified by the predicate. /// /// In other words, remove all elements `e` such that `f(&e)` returns false. @@ -1297,24 +979,6 @@ impl Vec { } } -impl Vec { - /// Sorts the vector in place. - /// - /// This sort is `O(n log n)` worst-case and stable, but allocates - /// approximately `2 * n`, where `n` is the length of `self`. - /// - /// # Example - /// - /// ``` - /// let mut vec = vec![3i, 1, 2]; - /// vec.sort(); - /// assert_eq!(vec, vec![1, 2, 3]); - /// ``` - pub fn sort(&mut self) { - self.as_mut_slice().sort() - } -} - #[experimental = "waiting on Mutable stability"] impl Mutable for Vec { #[inline] @@ -1325,19 +989,6 @@ impl Mutable for Vec { } impl Vec { - /// Returns true if a vector contains an element equal to the given value. - /// - /// # Example - /// - /// ``` - /// let vec = vec![1i, 2, 3]; - /// assert!(vec.contains(&1)); - /// ``` - #[inline] - pub fn contains(&self, x: &T) -> bool { - self.as_slice().contains(x) - } - /// Removes consecutive repeated elements in the vector. /// /// If the vector is sorted, this removes all duplicates. @@ -1449,7 +1100,12 @@ impl AsSlice for Vec { #[inline] #[stable] fn as_slice<'a>(&'a self) -> &'a [T] { - unsafe { mem::transmute(RawSlice { data: self.as_ptr(), len: self.len }) } + unsafe { + mem::transmute(RawSlice { + data: self.ptr as *const T, + len: self.len + }) + } } } @@ -1697,6 +1353,7 @@ pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> { pub mod raw { use super::Vec; use core::ptr; + use core::slice::MutableSlice; /// Constructs a vector from an unsafe pointer to a buffer. /// diff --git a/src/libcoretest/str.rs b/src/libcoretest/str.rs index 51bd72ec014..d3f77c47c44 100644 --- a/src/libcoretest/str.rs +++ b/src/libcoretest/str.rs @@ -38,3 +38,72 @@ fn test_strslice_contains() { let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'"; check_contains_all_substrings(x); } + +#[test] +fn test_rsplitn_char_iterator() { + let data = "\nMäry häd ä little lämb\nLittle lämb\n"; + + let mut split: Vec<&str> = data.rsplitn(3, ' ').collect(); + split.reverse(); + assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]); + + let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == ' ').collect(); + split.reverse(); + assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]); + + // Unicode + let mut split: Vec<&str> = data.rsplitn(3, 'ä').collect(); + split.reverse(); + assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]); + + let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == 'ä').collect(); + split.reverse(); + assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]); +} + +#[test] +fn test_split_char_iterator() { + let data = "\nMäry häd ä little lämb\nLittle lämb\n"; + + let split: Vec<&str> = data.split(' ').collect(); + assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); + + let mut rsplit: Vec<&str> = data.split(' ').rev().collect(); + rsplit.reverse(); + assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); + + let split: Vec<&str> = data.split(|c: char| c == ' ').collect(); + assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); + + let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect(); + rsplit.reverse(); + assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); + + // Unicode + let split: Vec<&str> = data.split('ä').collect(); + assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); + + let mut rsplit: Vec<&str> = data.split('ä').rev().collect(); + rsplit.reverse(); + assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); + + let split: Vec<&str> = data.split(|c: char| c == 'ä').collect(); + assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); + + let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect(); + rsplit.reverse(); + assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); +} + +#[test] +fn test_rev_split_char_iterator_no_trailing() { + let data = "\nMäry häd ä little lämb\nLittle lämb\n"; + + let mut split: Vec<&str> = data.split('\n').rev().collect(); + split.reverse(); + assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb", ""]); + + let mut split: Vec<&str> = data.split_terminator('\n').rev().collect(); + split.reverse(); + assert_eq!(split, vec!["", "Märy häd ä little lämb", "Little lämb"]); +} diff --git a/src/libgraphviz/maybe_owned_vec.rs b/src/libgraphviz/maybe_owned_vec.rs index c7659dc1b9f..a4d794d1f99 100644 --- a/src/libgraphviz/maybe_owned_vec.rs +++ b/src/libgraphviz/maybe_owned_vec.rs @@ -58,7 +58,7 @@ impl<'a,T> IntoMaybeOwnedVector<'a,T> for &'a [T] { impl<'a,T> MaybeOwnedVector<'a,T> { pub fn iter(&'a self) -> slice::Items<'a,T> { match self { - &Growable(ref v) => v.iter(), + &Growable(ref v) => v.as_slice().iter(), &Borrowed(ref v) => v.iter(), } } diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs index bd9577c8cfc..338d293fa0a 100644 --- a/src/libstd/io/comm_adapters.rs +++ b/src/libstd/io/comm_adapters.rs @@ -15,7 +15,7 @@ use comm::{Sender, Receiver}; use io; use option::{None, Some}; use result::{Ok, Err}; -use slice::{bytes, CloneableVector}; +use slice::{bytes, CloneableVector, ImmutableSlice}; use super::{Buffer, Reader, Writer, IoResult}; use vec::Vec; diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index 9d85701eb29..eaf47bb004c 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -125,6 +125,7 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option) // permission without help of apk #[cfg(all(test, not(target_os = "android")))] mod test { + use prelude::*; use super::*; use io::net::ip::*; diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index 62fabc0b33f..ba39f3e0d17 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -29,14 +29,16 @@ impl<'a> Drop for r<'a> { fn f(_i: Vec , _j: Vec ) { } +fn clone(t: &T) -> T { t.clone() } + fn main() { let i1 = &Cell::new(0); let i2 = &Cell::new(1); let r1 = vec!(box r { i: i1 }); let r2 = vec!(box r { i: i2 }); - f(r1.clone(), r2.clone()); - //~^ ERROR does not implement any method in scope named `clone` - //~^^ ERROR does not implement any method in scope named `clone` + f(clone(&r1), clone(&r2)); + //~^ ERROR the trait `core::clone::Clone` is not implemented for the type + //~^^ ERROR the trait `core::clone::Clone` is not implemented for the type println!("{}", (r2, i1.get())); println!("{}", (r1, i2.get())); } -- cgit 1.4.1-3-g733a5 From 1d356624a1c03363be37886ffdad7dcf25ee81f6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 23 Oct 2014 08:42:21 -0700 Subject: collections: Enable IndexMut for some collections This commit enables implementations of IndexMut for a number of collections, including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same time this deprecates the `get_mut` methods on vectors in favor of using the indexing notation. cc #18424 --- src/compiletest/runtest.rs | 2 +- src/libcollections/bitv.rs | 21 ++--- src/libcollections/btree/map.rs | 6 ++ src/libcollections/priority_queue.rs | 26 +++--- src/libcollections/ringbuf.rs | 33 ++++---- src/libcollections/smallintmap.rs | 11 ++- src/libcollections/str.rs | 8 +- src/libcollections/treemap.rs | 4 +- src/libcollections/trie.rs | 5 +- src/libcollections/vec.rs | 16 +--- src/libcore/intrinsics.rs | 97 ---------------------- src/libgetopts/lib.rs | 12 +-- src/libregex/compile.rs | 6 +- src/libregex/parse.rs | 2 +- src/libregex/vm.rs | 10 +-- src/librustc/metadata/encoder.rs | 2 +- src/librustc/middle/borrowck/move_data.rs | 4 +- src/librustc/middle/dependency_format.rs | 2 +- src/librustc/middle/graph.rs | 8 +- src/librustc/middle/liveness.rs | 18 ++-- src/librustc/middle/resolve.rs | 4 +- src/librustc/middle/trans/_match.rs | 2 +- src/librustc/middle/trans/cleanup.rs | 2 +- src/librustc/middle/trans/expr.rs | 2 +- src/librustc/middle/trans/type_.rs | 2 +- src/librustc/middle/typeck/check/method.rs | 2 +- src/librustc/middle/typeck/check/mod.rs | 2 +- src/librustc/middle/typeck/check/regionck.rs | 4 +- .../middle/typeck/infer/region_inference/mod.rs | 2 +- src/librustc/middle/typeck/infer/type_variable.rs | 6 +- src/librustc/middle/typeck/variance.rs | 2 +- src/librustc/util/snapshot_vec.rs | 8 +- src/libserialize/json.rs | 2 +- src/libstd/collections/hashmap/map.rs | 32 ++++--- src/libstd/io/fs.rs | 2 +- src/libstd/num/strconv.rs | 4 +- src/libstd/path/windows.rs | 6 +- src/libstd/rand/mod.rs | 2 +- src/libsync/comm/sync.rs | 4 +- src/libsync/raw.rs | 2 +- src/libsyntax/ast_map/mod.rs | 2 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/format.rs | 4 +- src/libsyntax/ext/tt/macro_parser.rs | 10 +-- src/libsyntax/print/pp.rs | 29 ++++--- src/libtest/stats.rs | 4 +- 46 files changed, 165 insertions(+), 271 deletions(-) (limited to 'src/libstd') diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index a9edad3add6..a40913a5db2 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -1013,7 +1013,7 @@ fn check_expected_errors(expected_errors: Vec , if prefix_matches(line, prefixes[i].as_slice()) && line.contains(ee.kind.as_slice()) && line.contains(ee.msg.as_slice()) { - *found_flags.get_mut(i) = true; + found_flags[i] = true; was_expected = true; break; } diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs index 1e081ae8a4b..1b12fdcb8dc 100644 --- a/src/libcollections/bitv.rs +++ b/src/libcollections/bitv.rs @@ -243,7 +243,7 @@ impl Bitv { let used_bits = bitv.nbits % u32::BITS; if init && used_bits != 0 { let largest_used_word = (bitv.nbits + u32::BITS - 1) / u32::BITS - 1; - *bitv.storage.get_mut(largest_used_word) &= (1 << used_bits) - 1; + bitv.storage[largest_used_word] &= (1 << used_bits) - 1; } bitv @@ -297,8 +297,9 @@ impl Bitv { let w = i / u32::BITS; let b = i % u32::BITS; let flag = 1 << b; - *self.storage.get_mut(w) = if x { self.storage[w] | flag } - else { self.storage[w] & !flag }; + let val = if x { self.storage[w] | flag } + else { self.storage[w] & !flag }; + self.storage[w] = val; } /// Sets all bits to 1. @@ -617,7 +618,7 @@ impl Bitv { self.storage.truncate(word_len); if len % u32::BITS > 0 { let mask = (1 << len % u32::BITS) - 1; - *self.storage.get_mut(word_len - 1) &= mask; + self.storage[word_len - 1] &= mask; } } } @@ -681,15 +682,15 @@ impl Bitv { let overhang = self.nbits % u32::BITS; // # of already-used bits let mask = !((1 << overhang) - 1); // e.g. 5 unused bits => 111110....0 if value { - *self.storage.get_mut(old_last_word) |= mask; + self.storage[old_last_word] |= mask; } else { - *self.storage.get_mut(old_last_word) &= !mask; + self.storage[old_last_word] &= !mask; } } // Fill in words after the old tail word let stop_idx = cmp::min(self.storage.len(), new_nwords); for idx in range(old_last_word + 1, stop_idx) { - *self.storage.get_mut(idx) = full_value; + self.storage[idx] = full_value; } // Allocate new words, if needed if new_nwords > self.storage.len() { @@ -700,7 +701,7 @@ impl Bitv { if value { let tail_word = new_nwords - 1; let used_bits = new_nbits % u32::BITS; - *self.storage.get_mut(tail_word) &= (1 << used_bits) - 1; + self.storage[tail_word] &= (1 << used_bits) - 1; } } // Adjust internal bit count @@ -728,7 +729,7 @@ impl Bitv { let ret = self.get(self.nbits - 1); // If we are unusing a whole word, make sure it is zeroed out if self.nbits % u32::BITS == 1 { - *self.storage.get_mut(self.nbits / u32::BITS) = 0; + self.storage[self.nbits / u32::BITS] = 0; } self.nbits -= 1; ret @@ -1184,7 +1185,7 @@ impl BitvSet { for (i, w) in other_words { let old = self_bitv.storage[i]; let new = f(old, w); - *self_bitv.storage.get_mut(i) = new; + self_bitv.storage[i] = new; } } diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 77fb6d4a120..dc7d935619f 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -690,6 +690,12 @@ impl Index for BTreeMap { } } +impl IndexMut for BTreeMap { + fn index_mut(&mut self, key: &K) -> &mut V { + self.find_mut(key).expect("no entry found for key") + } +} + /// Genericises over how to get the correct type of iterator from the correct type /// of Node ownership. trait Traverse { diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs index 16e04b93777..fbadbb0ffc9 100644 --- a/src/libcollections/priority_queue.rs +++ b/src/libcollections/priority_queue.rs @@ -71,7 +71,7 @@ //! let mut pq = PriorityQueue::new(); //! //! // We're at `start`, with a zero cost -//! *dist.get_mut(start) = 0u; +//! dist[start] = 0u; //! pq.push(State { cost: 0u, position: start }); //! //! // Examine the frontier with lower cost nodes first (min-heap) @@ -96,7 +96,7 @@ //! if next.cost < dist[next.position] { //! pq.push(next); //! // Relaxation, we have now found a better way -//! *dist.get_mut(next.position) = next.cost; +//! dist[next.position] = next.cost; //! } //! } //! } @@ -330,7 +330,7 @@ impl PriorityQueue { None => { None } Some(mut item) => { if !self.is_empty() { - swap(&mut item, self.data.get_mut(0)); + swap(&mut item, &mut self.data[0]); self.siftdown(0); } Some(item) @@ -378,7 +378,7 @@ impl PriorityQueue { /// ``` pub fn push_pop(&mut self, mut item: T) -> T { if !self.is_empty() && *self.top().unwrap() > item { - swap(&mut item, self.data.get_mut(0)); + swap(&mut item, &mut self.data[0]); self.siftdown(0); } item @@ -402,7 +402,7 @@ impl PriorityQueue { /// ``` pub fn replace(&mut self, mut item: T) -> Option { if !self.is_empty() { - swap(&mut item, self.data.get_mut(0)); + swap(&mut item, &mut self.data[0]); self.siftdown(0); Some(item) } else { @@ -462,26 +462,26 @@ impl PriorityQueue { // compared to using swaps, which involves twice as many moves. fn siftup(&mut self, start: uint, mut pos: uint) { unsafe { - let new = replace(self.data.get_mut(pos), zeroed()); + let new = replace(&mut self.data[pos], zeroed()); while pos > start { let parent = (pos - 1) >> 1; if new > self.data[parent] { - let x = replace(self.data.get_mut(parent), zeroed()); - ptr::write(self.data.get_mut(pos), x); + let x = replace(&mut self.data[parent], zeroed()); + ptr::write(&mut self.data[pos], x); pos = parent; continue } break } - ptr::write(self.data.get_mut(pos), new); + ptr::write(&mut self.data[pos], new); } } fn siftdown_range(&mut self, mut pos: uint, end: uint) { unsafe { let start = pos; - let new = replace(self.data.get_mut(pos), zeroed()); + let new = replace(&mut self.data[pos], zeroed()); let mut child = 2 * pos + 1; while child < end { @@ -489,13 +489,13 @@ impl PriorityQueue { if right < end && !(self.data[child] > self.data[right]) { child = right; } - let x = replace(self.data.get_mut(child), zeroed()); - ptr::write(self.data.get_mut(pos), x); + let x = replace(&mut self.data[child], zeroed()); + ptr::write(&mut self.data[pos], x); pos = child; child = 2 * pos + 1; } - ptr::write(self.data.get_mut(pos), new); + ptr::write(&mut self.data[pos], new); self.siftup(start, pos); } } diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs index 5f05ab7a906..81e4361ec39 100644 --- a/src/libcollections/ringbuf.rs +++ b/src/libcollections/ringbuf.rs @@ -58,7 +58,7 @@ impl Deque for RingBuf { /// Returns a mutable reference to the first element in the `RingBuf`. fn front_mut<'a>(&'a mut self) -> Option<&'a mut T> { - if self.nelts > 0 { Some(self.get_mut(0)) } else { None } + if self.nelts > 0 { Some(&mut self[0]) } else { None } } /// Returns a reference to the last element in the `RingBuf`. @@ -69,13 +69,13 @@ impl Deque for RingBuf { /// Returns a mutable reference to the last element in the `RingBuf`. fn back_mut<'a>(&'a mut self) -> Option<&'a mut T> { let nelts = self.nelts; - if nelts > 0 { Some(self.get_mut(nelts - 1)) } else { None } + if nelts > 0 { Some(&mut self[nelts - 1]) } else { None } } /// Removes and returns the first element in the `RingBuf`, or `None` if it /// is empty. fn pop_front(&mut self) -> Option { - let result = self.elts.get_mut(self.lo).take(); + let result = self.elts[self.lo].take(); if result.is_some() { self.lo = (self.lo + 1u) % self.elts.len(); self.nelts -= 1u; @@ -91,7 +91,7 @@ impl Deque for RingBuf { if self.lo == 0u { self.lo = self.elts.len() - 1u; } else { self.lo -= 1u; } - *self.elts.get_mut(self.lo) = Some(t); + self.elts[self.lo] = Some(t); self.nelts += 1u; } } @@ -102,14 +102,14 @@ impl MutableSeq for RingBuf { grow(self.nelts, &mut self.lo, &mut self.elts); } let hi = self.raw_index(self.nelts); - *self.elts.get_mut(hi) = Some(t); + self.elts[hi] = Some(t); self.nelts += 1u; } fn pop(&mut self) -> Option { if self.nelts > 0 { self.nelts -= 1; let hi = self.raw_index(self.nelts); - self.elts.get_mut(hi).take() + self.elts[hi].take() } else { None } @@ -140,6 +140,7 @@ impl RingBuf { /// # Example /// /// ```rust + /// # #![allow(deprecated)] /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); @@ -149,12 +150,9 @@ impl RingBuf { /// *buf.get_mut(1) = 7; /// assert_eq!(buf[1], 7); /// ``` + #[deprecated = "use indexing instead: `buf[index] = value`"] pub fn get_mut<'a>(&'a mut self, i: uint) -> &'a mut T { - let idx = self.raw_index(i); - match *self.elts.get_mut(idx) { - None => panic!(), - Some(ref mut v) => v - } + &mut self[i] } /// Swaps elements at indices `i` and `j`. @@ -466,13 +464,16 @@ impl Index for RingBuf { } } -// FIXME(#12825) Indexing will always try IndexMut first and that causes issues. -/*impl IndexMut for RingBuf { +impl IndexMut for RingBuf { #[inline] - fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut A { - self.get_mut(*index) + fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut A { + let idx = self.raw_index(*i); + match *(&mut self.elts[idx]) { + None => panic!(), + Some(ref mut v) => v + } } -}*/ +} impl FromIterator for RingBuf { fn from_iter>(iterator: T) -> RingBuf { diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs index 3b509f37c47..22bb4574f9c 100644 --- a/src/libcollections/smallintmap.rs +++ b/src/libcollections/smallintmap.rs @@ -100,7 +100,7 @@ impl MutableMap for SmallIntMap { /// Returns a mutable reference to the value corresponding to the key. fn find_mut<'a>(&'a mut self, key: &uint) -> Option<&'a mut V> { if *key < self.v.len() { - match *self.v.get_mut(*key) { + match *self.v.index_mut(key) { Some(ref mut value) => Some(value), None => None } @@ -118,7 +118,7 @@ impl MutableMap for SmallIntMap { if len <= key { self.v.grow_fn(key - len + 1, |_| None); } - *self.v.get_mut(key) = Some(value); + self.v[key] = Some(value); !exists } @@ -145,7 +145,7 @@ impl MutableMap for SmallIntMap { if *key >= self.v.len() { return None; } - self.v.get_mut(*key).take() + self.v[*key].take() } } @@ -405,13 +405,12 @@ impl Index for SmallIntMap { } } -// FIXME(#12825) Indexing will always try IndexMut first and that causes issues. -/*impl IndexMut for SmallIntMap { +impl IndexMut for SmallIntMap { #[inline] fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut V { self.find_mut(i).expect("key not present") } -}*/ +} macro_rules! iterator { (impl $name:ident -> $elem:ty, $($getter:ident),+) => { diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 5dd3be4ec8f..7d882ae5383 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -692,17 +692,17 @@ pub trait StrAllocating: Str { for (i, sc) in me.chars().enumerate() { let mut current = i; - *dcol.get_mut(0) = current + 1; + dcol[0] = current + 1; for (j, tc) in t.chars().enumerate() { let next = dcol[j + 1]; if sc == tc { - *dcol.get_mut(j + 1) = current; + dcol[j + 1] = current; } else { - *dcol.get_mut(j + 1) = cmp::min(current, next); - *dcol.get_mut(j + 1) = cmp::min(dcol[j + 1], dcol[j]) + 1; + dcol[j + 1] = cmp::min(current, next); + dcol[j + 1] = cmp::min(dcol[j + 1], dcol[j]) + 1; } current = next; diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs index feb4c11a061..ea4d541aab9 100644 --- a/src/libcollections/treemap.rs +++ b/src/libcollections/treemap.rs @@ -257,12 +257,12 @@ impl Index for TreeMap { } } -/*impl IndexMut for TreeMap { +impl IndexMut for TreeMap { #[inline] fn index_mut<'a>(&'a mut self, i: &K) -> &'a mut V { self.find_mut(i).expect("no entry found for key") } -}*/ +} impl TreeMap { /// Creates an empty `TreeMap`. diff --git a/src/libcollections/trie.rs b/src/libcollections/trie.rs index d02190e0824..8c18a6488ba 100644 --- a/src/libcollections/trie.rs +++ b/src/libcollections/trie.rs @@ -515,13 +515,12 @@ impl Index for TrieMap { } } -// FIXME(#12825) Indexing will always try IndexMut first and that causes issues. -/*impl IndexMut for TrieMap { +impl IndexMut for TrieMap { #[inline] fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut T { self.find_mut(i).expect("key not present") } -}*/ +} /// A set implemented as a radix trie. /// diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 759f9ec7d3f..ea03873ee83 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -46,7 +46,7 @@ use slice::{Items, MutItems}; /// assert_eq!(vec.pop(), Some(2)); /// assert_eq!(vec.len(), 1); /// -/// *vec.get_mut(0) = 7i; +/// vec[0] = 7i; /// assert_eq!(vec[0], 7); /// /// vec.push_all([1, 2, 3]); @@ -414,11 +414,10 @@ impl Index for Vec { } } -#[cfg(not(stage0))] impl IndexMut for Vec { #[inline] fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut T { - self.get_mut(*index) + &mut self.as_mut_slice()[*index] } } @@ -712,14 +711,6 @@ impl Vec { } } - /// Deprecated, use `.extend(other.into_iter())` - #[inline] - #[deprecated = "use .extend(other.into_iter())"] - #[cfg(stage0)] - pub fn push_all_move(&mut self, other: Vec) { - self.extend(other.into_iter()); - } - /// Returns a mutable slice of the elements of `self`. /// /// # Example @@ -799,12 +790,13 @@ impl Vec { /// # Example /// /// ``` + /// # #![allow(deprecated)] /// let mut vec = vec![1i, 2, 3]; /// *vec.get_mut(1) = 4; /// assert_eq!(vec, vec![1i, 4, 3]); /// ``` #[inline] - #[unstable = "this is likely to be moved to actual indexing"] + #[deprecated = "use `foo[index] = bar` instead"] pub fn get_mut<'a>(&'a mut self, index: uint) -> &'a mut T { &mut self.as_mut_slice()[index] } diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 68b3ca96de1..cd0b72d50c9 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -57,107 +57,10 @@ pub struct TyDesc { // Called when a value of type `T` is no longer needed pub drop_glue: GlueFn, - // Called by reflection visitor to visit a value of type `T` - #[cfg(stage0)] - pub visit_glue: GlueFn, - // Name corresponding to the type pub name: &'static str, } -#[cfg(stage0)] -#[lang="opaque"] -pub enum Opaque { } - -#[cfg(stage0)] -pub type Disr = u64; - -#[cfg(stage0)] -#[lang="ty_visitor"] -pub trait TyVisitor { - fn visit_bot(&mut self) -> bool; - fn visit_nil(&mut self) -> bool; - fn visit_bool(&mut self) -> bool; - - fn visit_int(&mut self) -> bool; - fn visit_i8(&mut self) -> bool; - fn visit_i16(&mut self) -> bool; - fn visit_i32(&mut self) -> bool; - fn visit_i64(&mut self) -> bool; - - fn visit_uint(&mut self) -> bool; - fn visit_u8(&mut self) -> bool; - fn visit_u16(&mut self) -> bool; - fn visit_u32(&mut self) -> bool; - fn visit_u64(&mut self) -> bool; - - fn visit_f32(&mut self) -> bool; - fn visit_f64(&mut self) -> bool; - - fn visit_char(&mut self) -> bool; - - fn visit_estr_slice(&mut self) -> bool; - - fn visit_box(&mut self, mtbl: uint, inner: *const TyDesc) -> bool; - fn visit_uniq(&mut self, mtbl: uint, inner: *const TyDesc) -> bool; - fn visit_ptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool; - fn visit_rptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool; - - fn visit_evec_slice(&mut self, mtbl: uint, inner: *const TyDesc) -> bool; - fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint, - inner: *const TyDesc) -> bool; - - fn visit_enter_rec(&mut self, n_fields: uint, - sz: uint, align: uint) -> bool; - fn visit_rec_field(&mut self, i: uint, name: &str, - mtbl: uint, inner: *const TyDesc) -> bool; - fn visit_leave_rec(&mut self, n_fields: uint, - sz: uint, align: uint) -> bool; - - fn visit_enter_class(&mut self, name: &str, named_fields: bool, n_fields: uint, - sz: uint, align: uint) -> bool; - fn visit_class_field(&mut self, i: uint, name: &str, named: bool, - mtbl: uint, inner: *const TyDesc) -> bool; - fn visit_leave_class(&mut self, name: &str, named_fields: bool, n_fields: uint, - sz: uint, align: uint) -> bool; - - fn visit_enter_tup(&mut self, n_fields: uint, - sz: uint, align: uint) -> bool; - fn visit_tup_field(&mut self, i: uint, inner: *const TyDesc) -> bool; - fn visit_leave_tup(&mut self, n_fields: uint, - sz: uint, align: uint) -> bool; - - fn visit_enter_enum(&mut self, n_variants: uint, - get_disr: unsafe extern fn(ptr: *const Opaque) -> Disr, - sz: uint, align: uint) -> bool; - fn visit_enter_enum_variant(&mut self, variant: uint, - disr_val: Disr, - n_fields: uint, - name: &str) -> bool; - fn visit_enum_variant_field(&mut self, i: uint, offset: uint, - inner: *const TyDesc) -> bool; - fn visit_leave_enum_variant(&mut self, variant: uint, - disr_val: Disr, - n_fields: uint, - name: &str) -> bool; - fn visit_leave_enum(&mut self, n_variants: uint, - get_disr: unsafe extern fn(ptr: *const Opaque) -> Disr, - sz: uint, align: uint) -> bool; - - fn visit_enter_fn(&mut self, purity: uint, proto: uint, - n_inputs: uint, retstyle: uint) -> bool; - fn visit_fn_input(&mut self, i: uint, mode: uint, - inner: *const TyDesc) -> bool; - fn visit_fn_output(&mut self, retstyle: uint, variadic: bool, - converging: bool, inner: *const TyDesc) -> bool; - fn visit_leave_fn(&mut self, purity: uint, proto: uint, - n_inputs: uint, retstyle: uint) -> bool; - - fn visit_trait(&mut self, name: &str) -> bool; - fn visit_param(&mut self, i: uint) -> bool; - fn visit_self(&mut self) -> bool; -} - extern "rust-intrinsic" { // NB: These intrinsics take unsafe pointers because they mutate aliased diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 24b78020974..12851713af2 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -614,29 +614,29 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result { if name_pos == names.len() && !i_arg.is_none() { return Err(UnexpectedArgument(nm.to_string())); } - vals.get_mut(optid).push(Given); + vals[optid].push(Given); } Maybe => { if !i_arg.is_none() { - vals.get_mut(optid) + vals[optid] .push(Val((i_arg.clone()) .unwrap())); } else if name_pos < names.len() || i + 1 == l || is_arg(args[i + 1].as_slice()) { - vals.get_mut(optid).push(Given); + vals[optid].push(Given); } else { i += 1; - vals.get_mut(optid).push(Val(args[i].clone())); + vals[optid].push(Val(args[i].clone())); } } Yes => { if !i_arg.is_none() { - vals.get_mut(optid).push(Val(i_arg.clone().unwrap())); + vals[optid].push(Val(i_arg.clone().unwrap())); } else if i + 1 == l { return Err(ArgumentMissing(nm.to_string())); } else { i += 1; - vals.get_mut(optid).push(Val(args[i].clone())); + vals[optid].push(Val(args[i].clone())); } } } diff --git a/src/libregex/compile.rs b/src/libregex/compile.rs index 53d2ea62a2a..2b82b620e39 100644 --- a/src/libregex/compile.rs +++ b/src/libregex/compile.rs @@ -157,7 +157,7 @@ impl<'r> Compiler<'r> { if cap >= len { self.names.grow(10 + cap - len, None) } - *self.names.get_mut(cap) = name; + self.names[cap] = name; self.push(Save(2 * cap)); self.compile(*x); @@ -243,7 +243,7 @@ impl<'r> Compiler<'r> { /// `panic!` is called. #[inline] fn set_split(&mut self, i: InstIdx, pc1: InstIdx, pc2: InstIdx) { - let split = self.insts.get_mut(i); + let split = &mut self.insts[i]; match *split { Split(_, _) => *split = Split(pc1, pc2), _ => panic!("BUG: Invalid split index."), @@ -263,7 +263,7 @@ impl<'r> Compiler<'r> { /// `panic!` is called. #[inline] fn set_jump(&mut self, i: InstIdx, pc: InstIdx) { - let jmp = self.insts.get_mut(i); + let jmp = &mut self.insts[i]; match *jmp { Jump(_) => *jmp = Jump(pc), _ => panic!("BUG: Invalid jump index."), diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs index d71cc9cb511..3115161682f 100644 --- a/src/libregex/parse.rs +++ b/src/libregex/parse.rs @@ -978,7 +978,7 @@ fn combine_ranges(unordered: Vec<(char, char)>) -> Vec<(char, char)> { } match which { None => ordered.push((us, ue)), - Some(i) => *ordered.get_mut(i) = (us, ue), + Some(i) => ordered[i] = (us, ue), } } ordered.sort(); diff --git a/src/libregex/vm.rs b/src/libregex/vm.rs index 0a4dca9125a..ce06828e764 100644 --- a/src/libregex/vm.rs +++ b/src/libregex/vm.rs @@ -461,13 +461,13 @@ impl Threads { } fn add(&mut self, pc: uint, groups: &[Option], empty: bool) { - let t = self.queue.get_mut(self.size); + let t = &mut self.queue[self.size]; t.pc = pc; match (empty, self.which) { (_, Exists) | (true, _) => {}, (false, Location) => { - *t.groups.get_mut(0) = groups[0]; - *t.groups.get_mut(1) = groups[1]; + t.groups[0] = groups[0]; + t.groups[1] = groups[1]; } (false, Submatches) => { for (slot, val) in t.groups.iter_mut().zip(groups.iter()) { @@ -475,7 +475,7 @@ impl Threads { } } } - *self.sparse.get_mut(pc) = self.size; + self.sparse[pc] = self.size; self.size += 1; } @@ -497,7 +497,7 @@ impl Threads { #[inline] fn groups<'r>(&'r mut self, i: uint) -> &'r mut [Option] { - self.queue.get_mut(i).groups.as_mut_slice() + self.queue[i].groups.as_mut_slice() } } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 6fe14a2d12a..6f5d5f6925c 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1619,7 +1619,7 @@ fn encode_index(rbml_w: &mut Encoder, index: Vec>, let mut buckets: Vec>> = Vec::from_fn(256, |_| Vec::new()); for elt in index.into_iter() { let h = hash::hash(&elt.val) as uint; - buckets.get_mut(h % 256).push(elt); + buckets[h % 256].push(elt); } rbml_w.start_tag(tag_index); diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index 5f3c46fcf4c..dbdac39a6aa 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -214,13 +214,13 @@ impl MoveData { fn set_path_first_move(&self, index: MovePathIndex, first_move: MoveIndex) { - self.paths.borrow_mut().get_mut(index.get()).first_move = first_move + (*self.paths.borrow_mut())[index.get()].first_move = first_move } fn set_path_first_child(&self, index: MovePathIndex, first_child: MovePathIndex) { - self.paths.borrow_mut().get_mut(index.get()).first_child = first_child + (*self.paths.borrow_mut())[index.get()].first_child = first_child } fn move_next_move(&self, index: MoveIndex) -> MoveIndex { diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index 8e2d4d0dc5a..3baa8eb0cc0 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -161,7 +161,7 @@ fn calculate_type(sess: &session::Session, if src.dylib.is_none() && !formats.contains_key(&cnum) { assert!(src.rlib.is_some()); add_library(sess, cnum, cstore::RequireStatic, &mut formats); - *ret.get_mut(cnum as uint - 1) = Some(cstore::RequireStatic); + ret[cnum as uint - 1] = Some(cstore::RequireStatic); debug!("adding staticlib: {}", data.name); } }); diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs index 4775f945f5c..783b94238e2 100644 --- a/src/librustc/middle/graph.rs +++ b/src/librustc/middle/graph.rs @@ -142,7 +142,7 @@ impl Graph { } pub fn mut_node_data<'a>(&'a mut self, idx: NodeIndex) -> &'a mut N { - &mut self.nodes.get_mut(idx.get()).data + &mut self.nodes[idx.get()].data } pub fn node_data<'a>(&'a self, idx: NodeIndex) -> &'a N { @@ -182,14 +182,14 @@ impl Graph { }); // adjust the firsts for each node target be the next object. - self.nodes.get_mut(source.get()).first_edge[Outgoing.repr] = idx; - self.nodes.get_mut(target.get()).first_edge[Incoming.repr] = idx; + self.nodes[source.get()].first_edge[Outgoing.repr] = idx; + self.nodes[target.get()].first_edge[Incoming.repr] = idx; return idx; } pub fn mut_edge_data<'a>(&'a mut self, idx: EdgeIndex) -> &'a mut E { - &mut self.edges.get_mut(idx.get()).data + &mut self.edges[idx.get()].data } pub fn edge_data<'a>(&'a self, idx: EdgeIndex) -> &'a E { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index f9810120d21..80eba56ea6c 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -756,7 +756,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } fn init_empty(&mut self, ln: LiveNode, succ_ln: LiveNode) { - *self.successors.get_mut(ln.get()) = succ_ln; + self.successors[ln.get()] = succ_ln; // It is not necessary to initialize the // values to empty because this is the value @@ -770,10 +770,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn init_from_succ(&mut self, ln: LiveNode, succ_ln: LiveNode) { // more efficient version of init_empty() / merge_from_succ() - *self.successors.get_mut(ln.get()) = succ_ln; + self.successors[ln.get()] = succ_ln; self.indices2(ln, succ_ln, |this, idx, succ_idx| { - *this.users.get_mut(idx) = this.users[succ_idx] + this.users[idx] = this.users[succ_idx] }); debug!("init_from_succ(ln={}, succ={})", self.ln_str(ln), self.ln_str(succ_ln)); @@ -789,11 +789,11 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { let mut changed = false; self.indices2(ln, succ_ln, |this, idx, succ_idx| { changed |= copy_if_invalid(this.users[succ_idx].reader, - &mut this.users.get_mut(idx).reader); + &mut this.users[idx].reader); changed |= copy_if_invalid(this.users[succ_idx].writer, - &mut this.users.get_mut(idx).writer); + &mut this.users[idx].writer); if this.users[succ_idx].used && !this.users[idx].used { - this.users.get_mut(idx).used = true; + this.users[idx].used = true; changed = true; } }); @@ -817,8 +817,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { // this) so we just clear out all the data. fn define(&mut self, writer: LiveNode, var: Variable) { let idx = self.idx(writer, var); - self.users.get_mut(idx).reader = invalid_node(); - self.users.get_mut(idx).writer = invalid_node(); + self.users[idx].reader = invalid_node(); + self.users[idx].writer = invalid_node(); debug!("{} defines {} (idx={}): {}", writer.to_string(), var.to_string(), idx, self.ln_str(writer)); @@ -830,7 +830,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { ln.to_string(), acc, var.to_string(), self.ln_str(ln)); let idx = self.idx(ln, var); - let user = self.users.get_mut(idx); + let user = &mut self.users[idx]; if (acc & ACC_WRITE) != 0 { user.reader = invalid_node(); diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 7af4739d409..63b5e52f8b8 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -2596,7 +2596,7 @@ impl<'a> Resolver<'a> { // We've successfully resolved the import. Write the results in. let mut import_resolutions = module_.import_resolutions.borrow_mut(); - let import_resolution = import_resolutions.get_mut(&target); + let import_resolution = &mut (*import_resolutions)[target]; match value_result { BoundResult(ref target_module, ref name_bindings) => { @@ -5697,7 +5697,7 @@ impl<'a> Resolver<'a> { let mut smallest = 0; for (i, other) in maybes.iter().enumerate() { - *values.get_mut(i) = name.lev_distance(other.get()); + values[i] = name.lev_distance(other.get()); if values[i] <= values[smallest] { smallest = i; diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index f53b5331edd..70aef4504f0 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -403,7 +403,7 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>, } let mut pats = br.pats.clone(); - *pats.get_mut(col) = pat; + pats[col] = pat; Match { pats: pats, data: &*br.data, diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs index e5825d7a38f..5a4979d9dcd 100644 --- a/src/librustc/middle/trans/cleanup.rs +++ b/src/librustc/middle/trans/cleanup.rs @@ -469,7 +469,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> { assert!(self.is_valid_custom_scope(custom_scope)); let mut scopes = self.scopes.borrow_mut(); - let scope = scopes.get_mut(custom_scope.index); + let scope = &mut (*scopes)[custom_scope.index]; scope.cleanups.push(cleanup); scope.clear_cached_exits(); } diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 4d004c85f6e..24c03cb5d42 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -1331,7 +1331,7 @@ fn trans_struct<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, field_ty.name == field.ident.node.name); match opt_pos { Some(i) => { - *need_base.get_mut(i) = false; + need_base[i] = false; (i, &*field.expr) } None => { diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs index f08fd20314a..d53fb8dfcf1 100644 --- a/src/librustc/middle/trans/type_.rs +++ b/src/librustc/middle/trans/type_.rs @@ -284,7 +284,7 @@ impl Type { return Vec::new(); } let mut elts = Vec::from_elem(n_elts, 0 as TypeRef); - llvm::LLVMGetStructElementTypes(self.to_ref(), elts.get_mut(0)); + llvm::LLVMGetStructElementTypes(self.to_ref(), &mut elts[0]); mem::transmute(elts) } } diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 7527160c825..6ae1bc82bb4 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -650,7 +650,7 @@ impl<'a, 'tcx> LookupContext<'a, 'tcx> { ByValueExplicitSelfCategory => { let mut n = (*m).clone(); let self_ty = n.fty.sig.inputs[0]; - *n.fty.sig.inputs.get_mut(0) = ty::mk_uniq(tcx, self_ty); + n.fty.sig.inputs[0] = ty::mk_uniq(tcx, self_ty); m = Rc::new(n); } _ => { } diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 8843be3cf81..4d4ac114937 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -5455,7 +5455,7 @@ pub fn check_bounds_are_used(ccx: &CrateCtxt, match ty::get(t).sty { ty::ty_param(ParamTy {idx, ..}) => { debug!("Found use of ty param num {}", idx); - *tps_used.get_mut(idx) = true; + tps_used[idx] = true; } _ => () } diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index bcade1e74ca..d0338333bad 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -1757,7 +1757,7 @@ fn adjust_upvar_borrow_kind_for_mut(rcx: &Rcx, // is inferred to mutable if necessary let mut upvar_borrow_map = rcx.fcx.inh.upvar_borrow_map.borrow_mut(); - let ub = upvar_borrow_map.get_mut(upvar_id); + let ub = &mut (*upvar_borrow_map)[*upvar_id]; return adjust_upvar_borrow_kind(rcx, *upvar_id, ub, ty::MutBorrow); } @@ -1807,7 +1807,7 @@ fn adjust_upvar_borrow_kind_for_unique(rcx: &Rcx, cmt: mc::cmt) { // borrow_kind of the upvar to make sure it // is inferred to unique if necessary let mut ub = rcx.fcx.inh.upvar_borrow_map.borrow_mut(); - let ub = ub.get_mut(upvar_id); + let ub = &mut (*ub)[*upvar_id]; return adjust_upvar_borrow_kind(rcx, *upvar_id, ub, ty::UniqueImmBorrow); } diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs index 80213d43ec4..ff1ded726c5 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs @@ -261,7 +261,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { if snapshot.length == 0 { undo_log.truncate(0); } else { - *undo_log.get_mut(snapshot.length) = CommitedSnapshot; + (*undo_log)[snapshot.length] = CommitedSnapshot; } } diff --git a/src/librustc/middle/typeck/infer/type_variable.rs b/src/librustc/middle/typeck/infer/type_variable.rs index 63094ceaabd..1383f7aa4dc 100644 --- a/src/librustc/middle/typeck/infer/type_variable.rs +++ b/src/librustc/middle/typeck/infer/type_variable.rs @@ -159,12 +159,12 @@ impl sv::SnapshotVecDelegate for Delegate { action: UndoEntry) { match action { SpecifyVar(vid, relations) => { - values.get_mut(vid.index).value = Bounded(relations); + values[vid.index].value = Bounded(relations); } Relate(a, b) => { - relations(values.get_mut(a.index)).pop(); - relations(values.get_mut(b.index)).pop(); + relations(&mut (*values)[a.index]).pop(); + relations(&mut (*values)[b.index]).pop(); } } } diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs index c8214a743de..21bd876a5c9 100644 --- a/src/librustc/middle/typeck/variance.rs +++ b/src/librustc/middle/typeck/variance.rs @@ -994,7 +994,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> { new_value, term.to_string()); - *self.solutions.get_mut(inferred) = new_value; + self.solutions[inferred] = new_value; changed = true; } } diff --git a/src/librustc/util/snapshot_vec.rs b/src/librustc/util/snapshot_vec.rs index 8885d86d4da..6d99fc7156c 100644 --- a/src/librustc/util/snapshot_vec.rs +++ b/src/librustc/util/snapshot_vec.rs @@ -105,7 +105,7 @@ impl> SnapshotVec { * action. */ - self.values.get_mut(index) + &mut self.values[index] } pub fn set(&mut self, index: uint, new_elem: T) { @@ -114,7 +114,7 @@ impl> SnapshotVec { * saved (and perhaps restored) if a snapshot is active. */ - let old_elem = mem::replace(self.values.get_mut(index), new_elem); + let old_elem = mem::replace(&mut self.values[index], new_elem); if self.in_snapshot() { self.undo_log.push(SetElem(index, old_elem)); } @@ -162,7 +162,7 @@ impl> SnapshotVec { } SetElem(i, v) => { - *self.values.get_mut(i) = v; + self.values[i] = v; } Other(u) => { @@ -189,7 +189,7 @@ impl> SnapshotVec { // The root snapshot. self.undo_log.truncate(0); } else { - *self.undo_log.get_mut(snapshot.length) = CommittedSnapshot; + self.undo_log[snapshot.length] = CommittedSnapshot; } } } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 99c60dde0ac..dc14a993016 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1231,7 +1231,7 @@ impl Stack { InternalIndex(i) => { i + 1 } _ => { panic!(); } }; - *self.stack.get_mut(len - 1) = InternalIndex(idx); + self.stack[len - 1] = InternalIndex(idx); } } diff --git a/src/libstd/collections/hashmap/map.rs b/src/libstd/collections/hashmap/map.rs index 6562a644988..cb47c28f8be 100644 --- a/src/libstd/collections/hashmap/map.rs +++ b/src/libstd/collections/hashmap/map.rs @@ -14,19 +14,14 @@ use clone::Clone; use cmp::{max, Eq, Equiv, PartialEq}; use collections::{Collection, Mutable, MutableSet, Map, MutableMap}; use default::Default; -use fmt::Show; -use fmt; +use fmt::{mod, Show}; use hash::{Hash, Hasher, RandomSipHasher}; -use iter::{Iterator, FromIterator, Extendable}; -use iter; -use mem::replace; -use mem; +use iter::{mod, Iterator, FromIterator, Extendable}; +use mem::{mod, replace}; use num; -use ops::Deref; +use ops::{Deref, Index, IndexMut}; use option::{Some, None, Option}; -use result::{Ok, Err}; -use ops::Index; -use core::result::Result; +use result::{Result, Ok, Err}; use super::table; use super::table::{ @@ -837,6 +832,7 @@ impl, V, S, H: Hasher> HashMap { /// # Example /// /// ``` + /// # #![allow(deprecated)] /// use std::collections::HashMap; /// /// let mut map = HashMap::new(); @@ -852,11 +848,9 @@ impl, V, S, H: Hasher> HashMap { /// *map.get_mut(&"a") = -2; /// assert_eq!(map["a"], -2); /// ``` + #[deprecated = "use indexing instead: `&mut map[key]`"] pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V { - match self.find_mut(k) { - Some(v) => v, - None => panic!("no entry found for key") - } + &mut self[*k] } /// Return true if the map contains a value for the specified key, @@ -1194,13 +1188,15 @@ impl, V, S, H: Hasher> Index for HashMap { } } -// FIXME(#12825) Indexing will always try IndexMut first and that causes issues. -/*impl, V, S, H: Hasher> ops::IndexMut for HashMap { +impl, V, S, H: Hasher> IndexMut for HashMap { #[inline] fn index_mut<'a>(&'a mut self, index: &K) -> &'a mut V { - self.get_mut(index) + match self.find_mut(index) { + Some(v) => v, + None => panic!("no entry found for key") + } } -}*/ +} /// HashMap iterator pub struct Entries<'a, K: 'a, V: 'a> { diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index f749d6c823e..f193ce8cffa 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -963,7 +963,7 @@ mod test { macro_rules! error( ($e:expr, $s:expr) => ( match $e { - Ok(val) => panic!("Unexpected success. Should've been: {}", $s), + Ok(_) => panic!("Unexpected success. Should've been: {}", $s), Err(ref err) => assert!(err.to_string().as_slice().contains($s.as_slice()), format!("`{}` did not contain `{}`", err, $s)) } diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 6e0d81a63c9..f79cda0195e 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -424,10 +424,10 @@ pub fn float_to_str_bytes_common, R: Rng>(rng: &mut R, for (i, elem) in iter.enumerate() { let k = rng.gen_range(0, i + 1 + amount); if k < amount { - *reservoir.get_mut(k) = elem; + reservoir[k] = elem; } } return reservoir; diff --git a/src/libsync/comm/sync.rs b/src/libsync/comm/sync.rs index bbb4813f5f9..42de6f66289 100644 --- a/src/libsync/comm/sync.rs +++ b/src/libsync/comm/sync.rs @@ -426,7 +426,7 @@ impl Buffer { fn enqueue(&mut self, t: T) { let pos = (self.start + self.size) % self.buf.len(); self.size += 1; - let prev = mem::replace(self.buf.get_mut(pos), Some(t)); + let prev = mem::replace(&mut self.buf[pos], Some(t)); assert!(prev.is_none()); } @@ -434,7 +434,7 @@ impl Buffer { let start = self.start; self.size -= 1; self.start = (self.start + 1) % self.buf.len(); - self.buf.get_mut(start).take().unwrap() + self.buf[start].take().unwrap() } fn size(&self) -> uint { self.size } diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs index 4fd62ac3a1d..1410091b924 100644 --- a/src/libsync/raw.rs +++ b/src/libsync/raw.rs @@ -308,7 +308,7 @@ impl<'a> Condvar<'a> { // To avoid :broadcast_heavy, we make a new waitqueue, // swap it out with the old one, and broadcast on the // old one outside of the little-lock. - queue = Some(mem::replace(state.blocked.get_mut(condvar_id), + queue = Some(mem::replace(&mut state.blocked[condvar_id], WaitQueue::new())); } else { out_of_bounds = Some(state.blocked.len()); diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index 915c2d1b318..fa36577ebdb 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -712,7 +712,7 @@ impl<'ast> NodeCollector<'ast> { if id as uint >= len { self.map.grow(id as uint - len + 1, NotPresent); } - *self.map.get_mut(id as uint) = entry; + self.map[id as uint] = entry; } fn insert(&mut self, id: NodeId, node: Node<'ast>) { diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index a8326e79ef3..e641abbfeee 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -785,6 +785,6 @@ impl SyntaxEnv { pub fn info<'a>(&'a mut self) -> &'a mut BlockInfo { let last_chain_index = self.chain.len() - 1; - &mut self.chain.get_mut(last_chain_index).info + &mut self.chain[last_chain_index].info } } diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 1b12ae67ee5..fa9a844233a 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -247,7 +247,7 @@ impl<'a, 'b> Context<'a, 'b> { self.verify_same(self.args[arg].span, &ty, arg_type); } if self.arg_types[arg].is_none() { - *self.arg_types.get_mut(arg) = Some(ty); + self.arg_types[arg] = Some(ty); } } @@ -567,7 +567,7 @@ impl<'a, 'b> Context<'a, 'b> { let lname = self.ecx.ident_of(format!("__arg{}", *name).as_slice()); pats.push(self.ecx.pat_ident(e.span, lname)); - *names.get_mut(self.name_positions[*name]) = + names[self.name_positions[*name]] = Some(Context::format_arg(self.ecx, e.span, arg_ty, self.ecx.expr_ident(e.span, lname))); heads.push(self.ecx.expr_addr_of(e.span, e)); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 9260a45adb9..4de20420148 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -288,8 +288,7 @@ pub fn parse(sess: &ParseSess, // Only touch the binders we have actually bound for idx in range(ei.match_lo, ei.match_hi) { let sub = (ei.matches[idx]).clone(); - new_pos.matches - .get_mut(idx) + new_pos.matches[idx] .push(Rc::new(MatchedSeq(sub, mk_sp(ei.sp_lo, sp.hi)))); } @@ -331,8 +330,7 @@ pub fn parse(sess: &ParseSess, new_ei.idx += 1u; //we specifically matched zero repeats. for idx in range(match_idx_lo, match_idx_hi) { - new_ei.matches - .get_mut(idx) + new_ei.matches[idx] .push(Rc::new(MatchedSeq(Vec::new(), sp))); } @@ -376,7 +374,7 @@ pub fn parse(sess: &ParseSess, if token_name_eq(&tok, &token::Eof) { if eof_eis.len() == 1u { let mut v = Vec::new(); - for dv in eof_eis.get_mut(0).matches.iter_mut() { + for dv in eof_eis[0].matches.iter_mut() { v.push(dv.pop().unwrap()); } return Success(nameize(sess, ms, v.as_slice())); @@ -417,7 +415,7 @@ pub fn parse(sess: &ParseSess, match ei.elts[ei.idx].node { MatchNonterminal(_, name, idx) => { let name_string = token::get_ident(name); - ei.matches.get_mut(idx).push(Rc::new(MatchedNonterminal( + ei.matches[idx].push(Rc::new(MatchedNonterminal( parse_nt(&mut rust_parser, name_string.get())))); ei.idx += 1u; } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 57c72ca77c6..5523f85aceb 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -303,7 +303,7 @@ impl Printer { } // be very careful with this! pub fn replace_last_token(&mut self, t: Token) { - *self.token.get_mut(self.right) = t; + self.token[self.right] = t; } pub fn pretty_print(&mut self, t: Token) -> io::IoResult<()> { debug!("pp ~[{},{}]", self.left, self.right); @@ -327,8 +327,8 @@ impl Printer { } else { self.advance_right(); } debug!("pp Begin({})/buffer ~[{},{}]", b.offset, self.left, self.right); - *self.token.get_mut(self.right) = t; - *self.size.get_mut(self.right) = -self.right_total; + self.token[self.right] = t; + self.size[self.right] = -self.right_total; let right = self.right; self.scan_push(right); Ok(()) @@ -340,8 +340,8 @@ impl Printer { } else { debug!("pp End/buffer ~[{},{}]", self.left, self.right); self.advance_right(); - *self.token.get_mut(self.right) = t; - *self.size.get_mut(self.right) = -1; + self.token[self.right] = t; + self.size[self.right] = -1; let right = self.right; self.scan_push(right); Ok(()) @@ -359,8 +359,8 @@ impl Printer { self.check_stack(0); let right = self.right; self.scan_push(right); - *self.token.get_mut(self.right) = t; - *self.size.get_mut(self.right) = -self.right_total; + self.token[self.right] = t; + self.size[self.right] = -self.right_total; self.right_total += b.blank_space; Ok(()) } @@ -373,8 +373,8 @@ impl Printer { debug!("pp String('{}')/buffer ~[{},{}]", *s, self.left, self.right); self.advance_right(); - *self.token.get_mut(self.right) = t.clone(); - *self.size.get_mut(self.right) = len; + self.token[self.right] = t.clone(); + self.size[self.right] = len; self.right_total += len; self.check_stream() } @@ -391,7 +391,7 @@ impl Printer { if self.left == self.scan_stack[self.bottom] { debug!("setting {} to infinity and popping", self.left); let scanned = self.scan_pop_bottom(); - *self.size.get_mut(scanned) = SIZE_INFINITY; + self.size[scanned] = SIZE_INFINITY; } } let left = self.token[self.left].clone(); @@ -412,7 +412,7 @@ impl Printer { self.top %= self.buf_len; assert!((self.top != self.bottom)); } - *self.scan_stack.get_mut(self.top) = x; + self.scan_stack[self.top] = x; } pub fn scan_pop(&mut self) -> uint { assert!((!self.scan_stack_empty)); @@ -474,20 +474,19 @@ impl Printer { Begin(_) => { if k > 0 { let popped = self.scan_pop(); - *self.size.get_mut(popped) = self.size[x] + - self.right_total; + self.size[popped] = self.size[x] + self.right_total; self.check_stack(k - 1); } } End => { // paper says + not =, but that makes no sense. let popped = self.scan_pop(); - *self.size.get_mut(popped) = 1; + self.size[popped] = 1; self.check_stack(k + 1); } _ => { let popped = self.scan_pop(); - *self.size.get_mut(popped) = self.size[x] + self.right_total; + self.size[popped] = self.size[x] + self.right_total; if k > 0 { self.check_stack(k); } diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 72c61f3afc7..21cf1d11e80 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -185,7 +185,7 @@ impl<'a, T: FloatMath + FromPrimitive> Stats for &'a [T] { let hi = x + y; let lo = y - (hi - x); if !lo.is_zero() { - *partials.get_mut(j) = lo; + partials[j] = lo; j += 1; } x = hi; @@ -193,7 +193,7 @@ impl<'a, T: FloatMath + FromPrimitive> Stats for &'a [T] { if j >= partials.len() { partials.push(x); } else { - *partials.get_mut(j) = x; + partials[j] = x; partials.truncate(j+1); } } -- cgit 1.4.1-3-g733a5 From 6fcba8826fd26028341a35d88b07208378ac05ea Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 30 Oct 2014 09:13:02 -0700 Subject: Test fixes and rebase conflicts --- src/libcore/panicking.rs | 6 +++--- src/libnative/io/timer_windows.rs | 2 +- src/librustc/lint/context.rs | 2 +- src/libstd/dynamic_lib.rs | 1 + src/libstd/os.rs | 2 +- src/libsyntax/ext/quote.rs | 2 +- src/libsyntax/parse/token.rs | 14 +++++++------- .../compile-fail/coerce-bare-fn-to-closure-and-proc.rs | 4 ++-- 8 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/libstd') diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 62c9d907cb2..39de04c27ce 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -28,7 +28,7 @@ //! one function. Currently, the actual symbol is declared in the standard //! library, but the location of this may change over time. -#![allow(dead_code, missing_doc)] +#![allow(dead_code, missing_docs)] use fmt; use intrinsics; @@ -63,7 +63,7 @@ fn panic_bounds_check(file_line: &(&'static str, uint), #[cfg(stage0)] #[cold] #[inline(never)] pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! { - #[allow(ctypes)] + #[allow(improper_ctypes)] extern { #[lang = "fail_fmt"] fn panic_impl(fmt: &fmt::Arguments, file: &'static str, @@ -104,7 +104,7 @@ fn panic_bounds_check(file_line: &(&'static str, uint), #[cfg(not(stage0))] #[cold] #[inline(never)] pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! { - #[allow(ctypes)] + #[allow(improper_ctypes)] extern { #[lang = "panic_fmt"] fn panic_impl(fmt: &fmt::Arguments, file: &'static str, diff --git a/src/libnative/io/timer_windows.rs b/src/libnative/io/timer_windows.rs index 421cc28e157..c17c541fc01 100644 --- a/src/libnative/io/timer_windows.rs +++ b/src/libnative/io/timer_windows.rs @@ -79,7 +79,7 @@ fn helper(input: libc::HANDLE, messages: Receiver, _: ()) { } } else { let remove = { - match chans.get_mut(idx as uint - 1) { + match &mut chans[idx as uint - 1] { &(ref mut c, oneshot) => { c.call(); oneshot } } }; diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index a75b98a5470..aa8e1ed2703 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -254,7 +254,7 @@ impl LintStore { } - #[allow(unused_variable)] + #[allow(unused_variables)] fn find_lint(&self, lint_name: &str, sess: &Session, span: Option) -> Option { diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 23cae2443c3..ec6eef07c95 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -286,6 +286,7 @@ pub mod dl { use os; use ptr; use result::{Ok, Err, Result}; + use slice::ImmutableSlice; use str::StrSlice; use str; use string::String; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 6e1eb82768c..d4e6251cebe 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -144,7 +144,7 @@ pub mod windows { use option::{None, Option}; use option; use os::TMPBUF_SZ; - use slice::MutableSlice; + use slice::{MutableSlice, ImmutableSlice}; use string::String; use str::StrSlice; use vec::Vec; diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 2151f79cd7b..f751655c9ff 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -540,7 +540,7 @@ fn mk_delim(cx: &ExtCtxt, sp: Span, delim: token::DelimToken) -> P { mk_token_path(cx, sp, name) } -#[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot +#[allow(non_upper_case_globals)] fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P { match *tok { token::BinOp(binop) => { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index c1720766ff3..d56aa8da72a 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -110,10 +110,10 @@ pub enum DelimToken { } #[cfg(stage0)] -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const ModName: bool = true; #[cfg(stage0)] -#[allow(non_uppercase_statics)] +#[allow(non_upper_case_globals)] pub const Plain: bool = false; #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)] @@ -263,7 +263,7 @@ impl Token { /// Returns `true` if the token is a path that is not followed by a `::` /// token. - #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot + #[allow(non_upper_case_globals)] pub fn is_plain_ident(&self) -> bool { match *self { Ident(_, Plain) => true, @@ -311,7 +311,7 @@ impl Token { } /// Returns `true` if the token is a given keyword, `kw`. - #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot + #[allow(non_upper_case_globals)] pub fn is_keyword(&self, kw: keywords::Keyword) -> bool { match *self { Ident(sid, Plain) => kw.to_name() == sid.name, @@ -321,7 +321,7 @@ impl Token { /// Returns `true` if the token is either a special identifier, or a strict /// or reserved keyword. - #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot + #[allow(non_upper_case_globals)] pub fn is_any_keyword(&self) -> bool { match *self { Ident(sid, Plain) => { @@ -338,7 +338,7 @@ impl Token { } /// Returns `true` if the token may not appear as an identifier. - #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot + #[allow(non_upper_case_globals)] pub fn is_strict_keyword(&self) -> bool { match *self { Ident(sid, Plain) => { @@ -364,7 +364,7 @@ impl Token { /// Returns `true` if the token is a keyword that has been reserved for /// possible future use. - #[allow(non_uppercase_statics)] // NOTE(stage0): remove this attribute after the next snapshot + #[allow(non_upper_case_globals)] pub fn is_reserved_keyword(&self) -> bool { match *self { Ident(sid, Plain) => { diff --git a/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs b/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs index 087ebf4e28c..9f258aee746 100644 --- a/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs +++ b/src/test/compile-fail/coerce-bare-fn-to-closure-and-proc.rs @@ -14,8 +14,8 @@ fn main() { let f = foo; let f_closure: || = f; //~^ ERROR: cannot coerce non-statically resolved bare fn to closure - //~^ HELP: consider embedding the function in a closure + //~^^ HELP: consider embedding the function in a closure let f_proc: proc() = f; //~^ ERROR: cannot coerce non-statically resolved bare fn to closure - //~^ HELP: consider embedding the function in a closure + //~^^ HELP: consider embedding the function in a closure } -- cgit 1.4.1-3-g733a5