diff --git a/src/doc/rust.md b/src/doc/rust.md index 7fe6585f07ca5..33216c64a33bf 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -1801,7 +1801,7 @@ module through the rules above. It essentially allows public access into the re-exported item. For example, this program is valid: ~~~~ -pub use api = self::implementation; +pub use self::implementation as api; mod implementation { pub fn f() {} diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 889ffba65518e..0db25c4090ebc 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -3112,7 +3112,7 @@ use farm::*; However, that's not all. You can also rename an item while you're bringing it into scope: ~~~ -use egg_layer = farm::chicken; +use farm::chicken as egg_layer; # mod farm { pub fn chicken() { println!("Laying eggs is fun!") } } // ... @@ -3335,7 +3335,7 @@ you just have to import it with an `use` statement. For example, it re-exports `range` which is defined in `std::iter::range`: ~~~ -use iter_range = std::iter::range; +use std::iter::range as iter_range; fn main() { // `range` is imported by default diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 6ae91f3897104..7809c17d93898 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -86,7 +86,7 @@ extern crate libc; #[deprecated = "use boxed instead"] #[cfg(not(test))] -pub use owned = boxed; +pub use boxed as owned; // Heaps provided for low-level allocation strategies diff --git a/src/libcollections/hash/mod.rs b/src/libcollections/hash/mod.rs index dd07e718af418..4ce39a683aea7 100644 --- a/src/libcollections/hash/mod.rs +++ b/src/libcollections/hash/mod.rs @@ -73,7 +73,7 @@ use core::mem; use vec::Vec; /// Reexport the `sip::hash` function as our default hasher. -pub use hash = self::sip::hash; +pub use self::sip::hash as hash; pub mod sip; diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index af4ac01bc6d78..66973fd410079 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -19,13 +19,13 @@ use core::fmt; use core::mem; use core::ptr; // FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait -use RawSlice = core::raw::Slice; +use core::raw::Slice as RawSlice; use {Mutable, MutableSeq}; use hash; use str; use str::{CharRange, StrAllocating, MaybeOwned, Owned}; -use MaybeOwnedSlice = str::Slice; // So many `Slice`s... +use str::Slice as MaybeOwnedSlice; // So many `Slice`s... use vec::Vec; /// A growable string stored as a UTF-8 encoded buffer. diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 3c705580f6354..6e4f2bc54819a 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -13,13 +13,13 @@ use core::prelude::*; use alloc::heap::{allocate, reallocate, deallocate}; -use RawSlice = core::raw::Slice; use core::cmp::max; use core::default::Default; use core::fmt; use core::mem; use core::num; use core::ptr; +use core::raw::Slice as RawSlice; use core::uint; use {Mutable, MutableSeq}; diff --git a/src/libcore/kinds.rs b/src/libcore/kinds.rs index 2533497b0e8be..9d64a25149fcf 100644 --- a/src/libcore/kinds.rs +++ b/src/libcore/kinds.rs @@ -21,7 +21,7 @@ by the compiler automatically for the types to which they apply. */ #[deprecated = "This has been renamed to Sync"] -pub use Share = self::Sync; +pub use self::Sync as Share; /// Types able to be transferred across task boundaries. #[lang="send"] diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index e4285ed597c8b..7e2ea492d4ccf 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -107,7 +107,7 @@ pub mod collections; /// Deprecated module in favor of `std::cell` pub mod ty { #[deprecated = "this type has been renamed to `UnsafeCell`"] - pub use Unsafe = cell::UnsafeCell; + pub use cell::UnsafeCell as Unsafe; } /* Core types and methods on primitives */ diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 93dafc153b6b2..826f25101fb70 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -50,7 +50,7 @@ use mem::size_of; use kinds::marker; use raw::Repr; // Avoid conflicts with *both* the Slice trait (buggy) and the `slice::raw` module. -use RawSlice = raw::Slice; +use raw::Slice as RawSlice; // diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index f55a1ca62f72f..7cac0d25abfee 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -47,7 +47,7 @@ forming a diamond-shaped acyclic graph and then pointing to the fifth which is cyclic. ```rust -use dot = graphviz; +use graphviz as dot; use graphviz::maybe_owned_vec::IntoMaybeOwnedVector; type Nd = int; @@ -147,7 +147,7 @@ labelled with the ⊆ character (specified using the HTML character entity `&sube`). ```rust -use dot = graphviz; +use graphviz as dot; use std::str; type Nd = uint; @@ -203,7 +203,7 @@ The output from this example is the same as the second example: the Hasse-diagram for the subsets of the set `{x, y}`. ```rust -use dot = graphviz; +use graphviz as dot; use std::str; type Nd<'a> = (uint, &'a str); diff --git a/src/libgreen/message_queue.rs b/src/libgreen/message_queue.rs index 66040633ff192..d4f2b255158bb 100644 --- a/src/libgreen/message_queue.rs +++ b/src/libgreen/message_queue.rs @@ -9,7 +9,7 @@ // except according to those terms. use alloc::arc::Arc; -use mpsc = std::sync::mpsc_queue; +use std::sync::mpsc_queue as mpsc; use std::kinds::marker; pub enum PopResult { diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs index e041547082885..22001cf107017 100644 --- a/src/libgreen/sched.rs +++ b/src/libgreen/sched.rs @@ -25,7 +25,7 @@ use coroutine::Coroutine; use sleeper_list::SleeperList; use stack::StackPool; use task::{TypeSched, GreenTask, HomeSched, AnySched}; -use msgq = message_queue; +use message_queue as msgq; /// A scheduler is responsible for coordinating the execution of Tasks /// on a single thread. The scheduler runs inside a slightly modified diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs index afd818bd7d7e7..5d66100732918 100644 --- a/src/libnative/io/mod.rs +++ b/src/libnative/io/mod.rs @@ -79,8 +79,8 @@ mod tty; #[cfg(windows)] #[path = "c_win32.rs"] mod c; fn unimpl() -> IoError { - #[cfg(unix)] use ERROR = libc::ENOSYS; - #[cfg(windows)] use ERROR = libc::ERROR_CALL_NOT_IMPLEMENTED; + #[cfg(unix)] use libc::ENOSYS as ERROR; + #[cfg(windows)] use libc::ERROR_CALL_NOT_IMPLEMENTED as ERROR; IoError { code: ERROR as uint, extra: 0, diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index a5332c8d07715..2255578ba8038 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -210,8 +210,8 @@ pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage, }) } _ => { - #[cfg(unix)] use ERROR = libc::EINVAL; - #[cfg(windows)] use ERROR = libc::WSAEINVAL; + #[cfg(unix)] use libc::EINVAL as ERROR; + #[cfg(windows)] use libc::WSAEINVAL as ERROR; Err(IoError { code: ERROR as uint, extra: 0, diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs index bc3f917a3dcc3..895b8b5929c96 100644 --- a/src/libnative/io/pipe_unix.rs +++ b/src/libnative/io/pipe_unix.rs @@ -39,8 +39,8 @@ fn addr_to_sockaddr_un(addr: &CString, let len = addr.len(); if len > s.sun_path.len() - 1 { - #[cfg(unix)] use ERROR = libc::EINVAL; - #[cfg(windows)] use ERROR = libc::WSAEINVAL; + #[cfg(unix)] use libc::EINVAL as ERROR; + #[cfg(windows)] use libc::WSAEINVAL as ERROR; return Err(IoError { code: ERROR as uint, extra: 0, diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index 4b832a4a97efa..443d7645388a3 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -148,8 +148,8 @@ impl rtio::RtioProcess for Process { } fn kill(&mut self, signum: int) -> IoResult<()> { - #[cfg(unix)] use ERROR = libc::EINVAL; - #[cfg(windows)] use ERROR = libc::ERROR_NOTHING_TO_TERMINATE; + #[cfg(unix)] use libc::EINVAL as ERROR; + #[cfg(windows)] use libc::ERROR_NOTHING_TO_TERMINATE as ERROR; // On linux (and possibly other unices), a process that has exited will // continue to accept signals because it is "defunct". The delivery of @@ -192,8 +192,8 @@ impl Drop for Process { } fn pipe() -> IoResult<(file::FileDesc, file::FileDesc)> { - #[cfg(unix)] use ERROR = libc::EMFILE; - #[cfg(windows)] use ERROR = libc::WSAEMFILE; + #[cfg(unix)] use libc::EMFILE as ERROR; + #[cfg(windows)] use libc::WSAEMFILE as ERROR; struct Closer { fd: libc::c_int } let os::Pipe { reader, writer } = match unsafe { os::pipe() } { diff --git a/src/libnative/io/util.rs b/src/libnative/io/util.rs index 97518bbf19995..356805d91de7a 100644 --- a/src/libnative/io/util.rs +++ b/src/libnative/io/util.rs @@ -25,8 +25,8 @@ pub enum SocketStatus { } pub fn timeout(desc: &'static str) -> IoError { - #[cfg(unix)] use ERROR = libc::ETIMEDOUT; - #[cfg(windows)] use ERROR = libc::ERROR_OPERATION_ABORTED; + #[cfg(unix)] use libc::ETIMEDOUT as ERROR; + #[cfg(windows)] use libc::ERROR_OPERATION_ABORTED as ERROR; IoError { code: ERROR as uint, extra: 0, @@ -35,8 +35,8 @@ pub fn timeout(desc: &'static str) -> IoError { } pub fn short_write(n: uint, desc: &'static str) -> IoError { - #[cfg(unix)] use ERROR = libc::EAGAIN; - #[cfg(windows)] use ERROR = libc::ERROR_OPERATION_ABORTED; + #[cfg(unix)] use libc::EAGAIN as ERROR; + #[cfg(windows)] use libc::ERROR_OPERATION_ABORTED as ERROR; IoError { code: ERROR as uint, extra: n, @@ -102,10 +102,10 @@ pub fn connect_timeout(fd: net::sock_t, len: libc::socklen_t, timeout_ms: u64) -> IoResult<()> { use std::os; - #[cfg(unix)] use INPROGRESS = libc::EINPROGRESS; - #[cfg(windows)] use INPROGRESS = libc::WSAEINPROGRESS; - #[cfg(unix)] use WOULDBLOCK = libc::EWOULDBLOCK; - #[cfg(windows)] use WOULDBLOCK = libc::WSAEWOULDBLOCK; + #[cfg(unix)] use libc::EINPROGRESS as INPROGRESS; + #[cfg(windows)] use libc::WSAEINPROGRESS as INPROGRESS; + #[cfg(unix)] use libc::EWOULDBLOCK as WOULDBLOCK; + #[cfg(windows)] use libc::WSAEWOULDBLOCK as WOULDBLOCK; // Make sure the call to connect() doesn't block try!(set_nonblocking(fd, true)); diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 5f86745f3f221..261d4be86b406 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -21,7 +21,7 @@ use metadata::common::LinkMeta; use metadata::creader; use middle::borrowck::{FnPartsWithCFG}; use middle::borrowck; -use borrowck_dot = middle::borrowck::graphviz; +use middle::borrowck::graphviz as borrowck_dot; use middle::cfg; use middle::cfg::graphviz::LabelledCFG; use middle::{trans, freevars, stability, kind, ty, typeck, reachable}; @@ -35,7 +35,7 @@ use util::common::time; use util::ppaux; use util::nodemap::{NodeSet}; -use dot = graphviz; +use graphviz as dot; use serialize::{json, Encodable}; diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 99b98b690fa66..52acb54d6f8a9 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -16,7 +16,7 @@ use std::io::fs; use std::dynamic_lib::DynamicLibrary; use std::collections::HashSet; -use myfs = util::fs; +use util::fs as myfs; pub enum FileMatch { FileMatches, FileDoesntMatch } diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index ff2830421e065..3359d7ed030c4 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -12,18 +12,18 @@ // FIXME: remove this after snapshot, and Results are handled #![allow(unused_must_use)] -use c = metadata::common; -use cstore = metadata::cstore; +use metadata::common as c; +use metadata::cstore as cstore; use driver::session::Session; use metadata::decoder; use middle::def; -use e = metadata::encoder; +use metadata::encoder as e; use middle::freevars::{CaptureMode, freevar_entry}; use middle::freevars; use middle::region; use metadata::tydecode; -use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter, - RegionParameter}; +use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter}; +use metadata::tydecode::{RegionParameter}; use metadata::tyencode; use middle::subst; use middle::subst::VecPerParamSpace; diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 65c7e1a6031ee..a69fe6958e175 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -19,8 +19,8 @@ use middle::borrowck::*; -use euv = middle::expr_use_visitor; -use mc = middle::mem_categorization; +use middle::expr_use_visitor as euv; +use middle::mem_categorization as mc; use middle::ty; use syntax::ast; use syntax::codemap::Span; diff --git a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs index 322471f30294f..f58cc95038382 100644 --- a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs @@ -12,12 +12,12 @@ * Computes moves. */ -use mc = middle::mem_categorization; use middle::borrowck::*; -use middle::borrowck::gather_loans::move_error::{MoveError, MoveErrorCollector}; use middle::borrowck::gather_loans::move_error::MoveSpanAndPath; +use middle::borrowck::gather_loans::move_error::{MoveError, MoveErrorCollector}; use middle::borrowck::move_data::*; -use euv = middle::expr_use_visitor; +use middle::expr_use_visitor as euv; +use middle::mem_categorization as mc; use middle::ty; use syntax::ast; use syntax::codemap::Span; diff --git a/src/librustc/middle/borrowck/gather_loans/lifetime.rs b/src/librustc/middle/borrowck/gather_loans/lifetime.rs index 0785538cc76ab..c6fbbed1f8a16 100644 --- a/src/librustc/middle/borrowck/gather_loans/lifetime.rs +++ b/src/librustc/middle/borrowck/gather_loans/lifetime.rs @@ -14,8 +14,8 @@ */ use middle::borrowck::*; -use euv = middle::expr_use_visitor; -use mc = middle::mem_categorization; +use middle::expr_use_visitor as euv; +use middle::mem_categorization as mc; use middle::ty; use util::ppaux::Repr; use syntax::ast; diff --git a/src/librustc/middle/borrowck/gather_loans/mod.rs b/src/librustc/middle/borrowck/gather_loans/mod.rs index 18323c26dd985..82e1748465f61 100644 --- a/src/librustc/middle/borrowck/gather_loans/mod.rs +++ b/src/librustc/middle/borrowck/gather_loans/mod.rs @@ -18,8 +18,8 @@ use middle::borrowck::*; use middle::borrowck::move_data::MoveData; -use euv = middle::expr_use_visitor; -use mc = middle::mem_categorization; +use middle::expr_use_visitor as euv; +use middle::mem_categorization as mc; use middle::ty; use util::ppaux::{Repr}; diff --git a/src/librustc/middle/borrowck/gather_loans/move_error.rs b/src/librustc/middle/borrowck/gather_loans/move_error.rs index 10f051f004f19..4f9e51a64f451 100644 --- a/src/librustc/middle/borrowck/gather_loans/move_error.rs +++ b/src/librustc/middle/borrowck/gather_loans/move_error.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use mc = middle::mem_categorization; +use middle::mem_categorization as mc; use middle::borrowck::BorrowckCtxt; use middle::ty; diff --git a/src/librustc/middle/borrowck/gather_loans/restrictions.rs b/src/librustc/middle/borrowck/gather_loans/restrictions.rs index 7d50d07a11e32..d1e9a2c0a7475 100644 --- a/src/librustc/middle/borrowck/gather_loans/restrictions.rs +++ b/src/librustc/middle/borrowck/gather_loans/restrictions.rs @@ -13,8 +13,8 @@ */ use middle::borrowck::*; -use euv = middle::expr_use_visitor; -use mc = middle::mem_categorization; +use middle::expr_use_visitor as euv; +use middle::mem_categorization as mc; use middle::ty; use syntax::codemap::Span; use util::ppaux::Repr; diff --git a/src/librustc/middle/borrowck/graphviz.rs b/src/librustc/middle/borrowck/graphviz.rs index e2ddb4a703aa3..b19d01187281a 100644 --- a/src/librustc/middle/borrowck/graphviz.rs +++ b/src/librustc/middle/borrowck/graphviz.rs @@ -13,9 +13,9 @@ //! data to rendered labels. /// For clarity, rename the graphviz crate locally to dot. -use dot = graphviz; +use graphviz as dot; pub use middle::cfg::graphviz::{Node, Edge}; -use cfg_dot = middle::cfg::graphviz; +use middle::cfg::graphviz as cfg_dot; use middle::borrowck; use middle::borrowck::{BorrowckCtxt, LoanPath}; diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 77dd7ed1c4204..9de55ccc46824 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -17,8 +17,8 @@ use middle::dataflow::DataFlowContext; use middle::dataflow::BitwiseOperator; use middle::dataflow::DataFlowOperator; use middle::def; -use euv = middle::expr_use_visitor; -use mc = middle::mem_categorization; +use middle::expr_use_visitor as euv; +use middle::mem_categorization as mc; use middle::ty; use util::ppaux::{note_and_explain_region, Repr, UserString}; diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index 6ec3f82ad68e7..340056875f2b9 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -24,8 +24,8 @@ use middle::cfg; use middle::dataflow::DataFlowContext; use middle::dataflow::BitwiseOperator; use middle::dataflow::DataFlowOperator; -use euv = middle::expr_use_visitor; -use mc = middle::mem_categorization; +use middle::expr_use_visitor as euv; +use middle::mem_categorization as mc; use middle::ty; use syntax::ast; use syntax::ast_util; diff --git a/src/librustc/middle/cfg/graphviz.rs b/src/librustc/middle/cfg/graphviz.rs index e9bcdff070de1..0cccae8b8c9cd 100644 --- a/src/librustc/middle/cfg/graphviz.rs +++ b/src/librustc/middle/cfg/graphviz.rs @@ -12,7 +12,7 @@ /// libgraphviz traits. /// For clarity, rename the graphviz crate locally to dot. -use dot = graphviz; +use graphviz as dot; use syntax::ast; use syntax::ast_map; diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index b76b85e024c44..6caf54790d1b4 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -14,7 +14,7 @@ * `ExprUseVisitor` determines how expressions are being used. */ -use mc = middle::mem_categorization; +use middle::mem_categorization as mc; use middle::def; use middle::freevars; use middle::pat_util; diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 7219c234779ba..d8bdeb0abf6d5 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -189,16 +189,16 @@ #![allow(non_camel_case_types)] use back::abi; -use mc = middle::mem_categorization; use driver::config::FullDebugInfo; -use euv = middle::expr_use_visitor; -use llvm; use llvm::{ValueRef, BasicBlockRef}; +use llvm; +use middle::check_match::StaticInliner; +use middle::check_match; use middle::const_eval; use middle::def; -use middle::check_match; -use middle::check_match::StaticInliner; +use middle::expr_use_visitor as euv; use middle::lang_items::StrEqFnLangItem; +use middle::mem_categorization as mc; use middle::pat_util::*; use middle::resolve::DefMap; use middle::trans::adt; diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index 59148c5d4c3fd..e397ee94c8a11 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -53,9 +53,9 @@ use middle::typeck::MethodCall; use util::ppaux::Repr; use std::gc::Gc; +use syntax::abi as synabi; use syntax::ast; use syntax::ast_map; -use synabi = syntax::abi; pub struct MethodData { pub llfn: ValueRef, diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 300e7ecf81f43..0244d0ddc6e02 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -16,10 +16,10 @@ use driver::session::Session; use llvm; use llvm::{ValueRef, BasicBlockRef, BuilderRef}; use llvm::{True, False, Bool}; -use mc = middle::mem_categorization; use middle::def; use middle::freevars; use middle::lang_items::LangItem; +use middle::mem_categorization as mc; use middle::subst; use middle::subst::Subst; use middle::trans::base; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index ce3256650fd25..ae96937757f0e 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -12,9 +12,8 @@ use back::svh::Svh; use driver::session::Session; -use metadata::csearch; -use mc = middle::mem_categorization; use lint; +use metadata::csearch; use middle::const_eval; use middle::def; use middle::dependency_format; @@ -22,6 +21,7 @@ use middle::freevars::CaptureModeMap; use middle::freevars; use middle::lang_items::{FnMutTraitLangItem, OpaqueStructLangItem}; use middle::lang_items::{TyDescStructLangItem, TyVisitorTraitLangItem}; +use middle::mem_categorization as mc; use middle::resolve; use middle::resolve_lifetime; use middle::stability; diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 24aee72e00e65..add31ed87ce4c 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -53,15 +53,15 @@ use middle::const_eval; use middle::def; use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem}; use middle::lang_items::{FnOnceTraitLangItem}; +use middle::resolve_lifetime as rl; use middle::subst::{FnSpace, TypeSpace, SelfSpace, Subst, Substs}; use middle::subst::{VecPerParamSpace}; use middle::ty; use middle::ty_fold::TypeFolder; -use middle::typeck::rscope::{ExplicitRscope, ImpliedSingleRscope}; use middle::typeck::rscope::RegionScope; +use middle::typeck::rscope::{ExplicitRscope, ImpliedSingleRscope}; use middle::typeck::{TypeAndSubsts, infer, lookup_def_tcx, rscope}; use middle::typeck; -use rl = middle::resolve_lifetime; use util::ppaux::Repr; use std::rc::Rc; diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index 0acf6e9183164..8e41c9463f6b8 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -121,7 +121,7 @@ and report an error, and it just seems like more mess in the end.) use middle::def; use middle::def::{DefArg, DefBinding, DefLocal, DefUpvar}; use middle::freevars; -use mc = middle::mem_categorization; +use middle::mem_categorization as mc; use middle::ty::{ReScope}; use middle::ty; use middle::typeck::astconv::AstConv; diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs index e0fab95a04529..97c11b9205970 100644 --- a/src/librustc/middle/typeck/variance.rs +++ b/src/librustc/middle/typeck/variance.rs @@ -195,7 +195,7 @@ represents the "variance transform" as defined in the paper: use std::collections::HashMap; use arena; use arena::Arena; -use rl = middle::resolve_lifetime; +use middle::resolve_lifetime as rl; use middle::subst; use middle::subst::{ParamSpace, FnSpace, TypeSpace, SelfSpace, VecPerParamSpace}; use middle::ty; diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 301143e504550..e0e9f0e6910b2 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -10,27 +10,27 @@ use middle::def; -use middle::subst; use middle::subst::{VecPerParamSpace,Subst}; -use middle::ty::{ReSkolemized, ReVar}; +use middle::subst; use middle::ty::{BoundRegion, BrAnon, BrNamed}; use middle::ty::{ReEarlyBound, BrFresh, ctxt}; -use middle::ty::{mt, t, ParamTy}; use middle::ty::{ReFree, ReScope, ReInfer, ReStatic, Region, ReEmpty}; +use middle::ty::{ReSkolemized, ReVar}; +use middle::ty::{mt, t, ParamTy}; use middle::ty::{ty_bool, ty_char, ty_bot, ty_box, ty_struct, ty_enum}; use middle::ty::{ty_err, ty_str, ty_vec, ty_float, ty_bare_fn, ty_closure}; use middle::ty::{ty_nil, ty_param, ty_ptr, ty_rptr, ty_tup}; -use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_infer}; use middle::ty::{ty_unboxed_closure}; +use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_infer}; use middle::ty; -use middle::typeck; -use middle::typeck::infer; -use middle::typeck::infer::unify; -use VV = middle::typeck::infer::unify::VarValue; use middle::typeck::infer::region_inference; +use middle::typeck::infer::unify::VarValue as VV; +use middle::typeck::infer::unify; +use middle::typeck::infer; +use middle::typeck; -use std::rc::Rc; use std::gc::Gc; +use std::rc::Rc; use syntax::abi; use syntax::ast_map; use syntax::codemap::{Span, Pos}; diff --git a/src/librustc_back/archive.rs b/src/librustc_back/archive.rs index 6e606f3336180..bd6770b32561c 100644 --- a/src/librustc_back/archive.rs +++ b/src/librustc_back/archive.rs @@ -16,7 +16,7 @@ use std::io; use std::os; use std::str; use syntax::abi; -use ErrorHandler = syntax::diagnostic::Handler; +use syntax::diagnostic::Handler as ErrorHandler; pub static METADATA_FILENAME: &'static str = "rust.metadata.bin"; diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index a1dd49bbf898d..3734938858870 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -545,7 +545,7 @@ impl fmt::Show for clean::ViewPath { if *name == src.path.segments.last().unwrap().name { write!(f, "use {};", *src) } else { - write!(f, "use {} = {};", *name, *src) + write!(f, "use {} as {};", *src, *name) } } clean::GlobImport(ref src) => { diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index ecdc736790dbe..85455b9df9ed1 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -13,14 +13,12 @@ //! This module uses libsyntax's lexer to provide token-based highlighting for //! the HTML documentation generated by rustdoc. -use std::io; - -use syntax::parse; -use syntax::parse::lexer; - use html::escape::Escape; -use t = syntax::parse::token; +use std::io; +use syntax::parse::lexer; +use syntax::parse::token as t; +use syntax::parse; /// Highlights some source code, returning the HTML output. pub fn highlight(src: &str, class: Option<&str>, id: Option<&str>) -> String { diff --git a/src/librustdoc/plugins.rs b/src/librustdoc/plugins.rs index c5ac9416fa06d..b2edf5d6a2bcc 100644 --- a/src/librustdoc/plugins.rs +++ b/src/librustdoc/plugins.rs @@ -10,7 +10,7 @@ use clean; -use dl = std::dynamic_lib; +use std::dynamic_lib as dl; use serialize::json; use std::mem; use std::string::String; diff --git a/src/librustrt/local_ptr.rs b/src/librustrt/local_ptr.rs index c94e5c6187b3a..ef56cd3b1da0b 100644 --- a/src/librustrt/local_ptr.rs +++ b/src/librustrt/local_ptr.rs @@ -240,7 +240,7 @@ pub mod native { use alloc::boxed::Box; use core::mem; use core::ptr; - use tls = thread_local_storage; + use thread_local_storage as tls; static mut RT_TLS_KEY: tls::Key = -1; diff --git a/src/librustrt/rtio.rs b/src/librustrt/rtio.rs index 134453659dbf6..6525adf07f76f 100644 --- a/src/librustrt/rtio.rs +++ b/src/librustrt/rtio.rs @@ -162,8 +162,8 @@ impl<'a> LocalIo<'a> { pub fn maybe_raise(f: |io: &mut IoFactory| -> IoResult) -> IoResult { - #[cfg(unix)] use ERROR = libc::EINVAL; - #[cfg(windows)] use ERROR = libc::ERROR_CALL_NOT_IMPLEMENTED; + #[cfg(unix)] use libc::EINVAL as ERROR; + #[cfg(windows)] use libc::ERROR_CALL_NOT_IMPLEMENTED as ERROR; match LocalIo::borrow() { Some(mut io) => f(io.get()), None => Err(IoError { diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs index 459d655b4c998..204128cf6be71 100644 --- a/src/librustrt/unwind.rs +++ b/src/librustrt/unwind.rs @@ -74,7 +74,7 @@ use libc::c_void; use local::Local; use task::Task; -use uw = libunwind; +use libunwind as uw; pub struct Unwinder { unwinding: bool, @@ -238,7 +238,7 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class { #[doc(hidden)] #[allow(visible_private_types)] pub mod eabi { - use uw = libunwind; + use libunwind as uw; use libc::c_int; extern "C" { @@ -292,7 +292,7 @@ pub mod eabi { #[doc(hidden)] #[allow(visible_private_types)] pub mod eabi { - use uw = libunwind; + use libunwind as uw; use libc::c_int; extern "C" { @@ -345,7 +345,7 @@ pub mod eabi { #[doc(hidden)] #[allow(visible_private_types)] pub mod eabi { - use uw = libunwind; + use libunwind as uw; use libc::c_int; extern "C" { @@ -396,7 +396,7 @@ pub mod eabi { #[allow(visible_private_types)] #[allow(non_camel_case_types)] pub mod eabi { - use uw = libunwind; + use libunwind as uw; use libc::{c_void, c_int}; struct EXCEPTION_RECORD; diff --git a/src/librustuv/queue.rs b/src/librustuv/queue.rs index baaf1150ce085..6a0f2a27b184d 100644 --- a/src/librustuv/queue.rs +++ b/src/librustuv/queue.rs @@ -25,7 +25,7 @@ use libc::c_void; use std::mem; use std::rt::mutex::NativeMutex; use std::rt::task::BlockedTask; -use mpsc = std::sync::mpsc_queue; +use std::sync::mpsc_queue as mpsc; use async::AsyncWatcher; use super::{Loop, UvHandle}; diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index e5f42bd65a300..b31baa88e0c84 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -27,10 +27,10 @@ use to_string::IntoStr; use vec::Vec; #[deprecated="this trait has been renamed to `AsciiExt`"] -pub use StrAsciiExt = self::AsciiExt; +pub use self::AsciiExt as StrAsciiExt; #[deprecated="this trait has been renamed to `OwnedAsciiExt`"] -pub use OwnedStrAsciiExt = self::OwnedAsciiExt; +pub use self::OwnedAsciiExt as OwnedStrAsciiExt; /// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero. diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index fb6599d808c3e..d35b644b643d0 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -175,7 +175,7 @@ pub use core::option; pub use alloc::boxed; #[deprecated = "use boxed instead"] -pub use owned = boxed; +pub use boxed as owned; pub use alloc::rc; @@ -289,7 +289,7 @@ mod std { pub use vec; // used for vec![] // The test runner calls ::std::os::args() but really wants realstd - #[cfg(test)] pub use os = realstd::os; + #[cfg(test)] pub use realstd::os as os; // The test runner requires std::slice::Vector, so re-export std::slice just for it. #[cfg(test)] pub use slice; diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index d24c2e2266d4c..38d04324fe417 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -80,59 +80,59 @@ use vec::Vec; /// Typedef for POSIX file paths. /// See `posix::Path` for more info. -pub use PosixPath = self::posix::Path; +pub use self::posix::Path as PosixPath; /// Typedef for Windows file paths. /// See `windows::Path` for more info. -pub use WindowsPath = self::windows::Path; +pub use self::windows::Path as WindowsPath; /// Typedef for the platform-native path type #[cfg(unix)] -pub use Path = self::posix::Path; +pub use self::posix::Path as Path; /// Typedef for the platform-native path type #[cfg(windows)] -pub use Path = self::windows::Path; +pub use self::windows::Path as Path; /// Typedef for the platform-native component iterator #[cfg(unix)] -pub use Components = self::posix::Components; +pub use self::posix::Components as Components; /// Typedef for the platform-native component iterator #[cfg(windows)] -pub use Components = self::windows::Components; +pub use self::windows::Components as Components; /// Typedef for the platform-native str component iterator #[cfg(unix)] -pub use StrComponents = self::posix::StrComponents; +pub use self::posix::StrComponents as StrComponents; /// Typedef for the platform-native str component iterator #[cfg(windows)] -pub use StrComponents = self::windows::StrComponents; +pub use self::windows::StrComponents as StrComponents; /// Alias for the platform-native separator character. #[cfg(unix)] -pub use SEP = self::posix::SEP; +pub use self::posix::SEP as SEP; /// Alias for the platform-native separator character. #[cfg(windows)] -pub use SEP = self::windows::SEP; +pub use self::windows::SEP as SEP; /// Alias for the platform-native separator byte. #[cfg(unix)] -pub use SEP_BYTE = self::posix::SEP_BYTE; +pub use self::posix::SEP_BYTE as SEP_BYTE; /// Alias for the platform-native separator byte. #[cfg(windows)] -pub use SEP_BYTE = self::windows::SEP_BYTE; +pub use self::windows::SEP_BYTE as SEP_BYTE; /// Typedef for the platform-native separator char func #[cfg(unix)] -pub use is_sep = self::posix::is_sep; +pub use self::posix::is_sep as is_sep; /// Typedef for the platform-native separator char func #[cfg(windows)] -pub use is_sep = self::windows::is_sep; +pub use self::windows::is_sep as is_sep; /// Typedef for the platform-native separator byte func #[cfg(unix)] -pub use is_sep_byte = self::posix::is_sep_byte; +pub use self::posix::is_sep_byte as is_sep_byte; /// Typedef for the platform-native separator byte func #[cfg(windows)] -pub use is_sep_byte = self::windows::is_sep_byte; +pub use self::windows::is_sep_byte as is_sep_byte; pub mod posix; pub mod windows; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 40d8f80171c4e..c02a97e09a41e 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -185,9 +185,9 @@ use result::{Ok, Err}; use vec::Vec; #[cfg(not(target_word_size="64"))] -use IsaacWordRng = core_rand::IsaacRng; +use core_rand::IsaacRng as IsaacWordRng; #[cfg(target_word_size="64")] -use IsaacWordRng = core_rand::Isaac64Rng; +use core_rand::Isaac64Rng as IsaacWordRng; pub use core_rand::{Rand, Rng, SeedableRng, Open01, Closed01}; pub use core_rand::{XorShiftRng, IsaacRng, Isaac64Rng}; diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index c9526a64f46d0..8cfa1ebd59847 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -27,7 +27,7 @@ pub use core_sync::{Semaphore, SemaphoreGuard}; pub use core_sync::one::{Once, ONCE_INIT}; #[deprecated = "use atomic instead"] -pub use atomics = core_sync::atomic; +pub use core_sync::atomic as atomics; pub use self::future::Future; pub use self::task_pool::TaskPool; diff --git a/src/libsync/comm/shared.rs b/src/libsync/comm/shared.rs index 979b0ebcf8f83..cb35bd8afb772 100644 --- a/src/libsync/comm/shared.rs +++ b/src/libsync/comm/shared.rs @@ -29,7 +29,7 @@ use rustrt::task::{Task, BlockedTask}; use rustrt::thread::Thread; use atomic; -use mpsc = mpsc_queue; +use mpsc_queue as mpsc; static DISCONNECTED: int = int::MIN; static FUDGE: int = 1024; diff --git a/src/libsync/comm/stream.rs b/src/libsync/comm/stream.rs index 11c563301e082..36fe335128e4d 100644 --- a/src/libsync/comm/stream.rs +++ b/src/libsync/comm/stream.rs @@ -28,7 +28,7 @@ use rustrt::thread::Thread; use atomic; use comm::Receiver; -use spsc = spsc_queue; +use spsc_queue as spsc; static DISCONNECTED: int = int::MIN; #[cfg(test)] diff --git a/src/libsync/mutex.rs b/src/libsync/mutex.rs index 61d895dd40664..12de615a81b79 100644 --- a/src/libsync/mutex.rs +++ b/src/libsync/mutex.rs @@ -68,7 +68,7 @@ use rustrt::mutex; use rustrt::task::{BlockedTask, Task}; use rustrt::thread::Thread; -use q = mpsc_intrusive; +use mpsc_intrusive as q; pub static LOCKED: uint = 1 << 0; pub static GREEN_BLOCKED: uint = 1 << 1; diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index b00924c159016..835181d55c457 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -14,10 +14,10 @@ use codemap::{Span, respan}; use ext::base::*; use ext::base; use ext::build::AstBuilder; +use fmt_macros as parse; use parse::token::InternedString; use parse::token; -use parse = fmt_macros; use std::collections::HashMap; use std::gc::{Gc, GC}; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 271cefeaf038f..e76e4adcd7fdf 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -328,7 +328,7 @@ pub mod with_hygiene { -> Vec { // it appears to me that the cfg doesn't matter here... indeed, // parsing tt's probably shouldn't require a parser at all. - use make_reader = super::lexer::make_reader_with_embedded_idents; + use super::lexer::make_reader_with_embedded_idents as make_reader; let cfg = Vec::new(); let srdr = make_reader(&sess.span_diagnostic, filemap); let mut p1 = Parser::new(sess, cfg, box srdr); diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index afcf84753a612..5273addf4f57d 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -34,6 +34,7 @@ pub enum ObsoleteSyntax { ObsoleteOwnedSelf, ObsoleteManagedType, ObsoleteManagedExpr, + ObsoleteImportRenaming, } pub trait ParserObsoleteMethods { @@ -83,6 +84,10 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> { "`@` notation for a managed pointer allocation", "use the `box(GC)` operator instead of `@`" ), + ObsoleteImportRenaming => ( + "`use foo = bar` syntax", + "write `use bar as foo` instead" + ) }; self.report(sp, kind, kind_str, desc); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 80b852111a2e4..9e2829e638050 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5385,7 +5385,6 @@ impl<'a> Parser<'a> { match self.token { token::EQ => { // x = foo::bar - // NOTE(stage0, #16461, pcwalton): Deprecate after snapshot. self.bump(); let path_lo = self.span.lo; path = vec!(self.parse_ident()); @@ -5394,8 +5393,10 @@ impl<'a> Parser<'a> { let id = self.parse_ident(); path.push(id); } + let span = mk_sp(path_lo, self.span.hi); + self.obsolete(span, ObsoleteImportRenaming); let path = ast::Path { - span: mk_sp(path_lo, self.span.hi), + span: span, global: false, segments: path.move_iter().map(|identifier| { ast::PathSegment { diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 2e656a5a420d3..262721bd63676 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -225,7 +225,7 @@ impl<'a> Iterator<&'a str> for Graphemes<'a> { #[inline] fn next(&mut self) -> Option<&'a str> { - use gr = tables::grapheme; + use tables::grapheme as gr; if self.string.len() == 0 { return None; } @@ -325,7 +325,7 @@ impl<'a> Iterator<&'a str> for Graphemes<'a> { impl<'a> DoubleEndedIterator<&'a str> for Graphemes<'a> { #[inline] fn next_back(&mut self) -> Option<&'a str> { - use gr = tables::grapheme; + use tables::grapheme as gr; if self.string.len() == 0 { return None; } diff --git a/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs index dcd6ee6e9571c..d13503b23fb16 100644 --- a/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs +++ b/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std = std::slice; //~ ERROR import conflicts with imported crate +use std::slice as std; //~ ERROR import conflicts with imported crate fn main() { } diff --git a/src/test/run-pass/extern-mod-ordering-exe.rs b/src/test/run-pass/extern-mod-ordering-exe.rs index 56c29b54b6877..d6c6389fdb63b 100644 --- a/src/test/run-pass/extern-mod-ordering-exe.rs +++ b/src/test/run-pass/extern-mod-ordering-exe.rs @@ -12,7 +12,7 @@ extern crate extern_mod_ordering_lib; -use the_lib = extern_mod_ordering_lib::extern_mod_ordering_lib; +use extern_mod_ordering_lib::extern_mod_ordering_lib as the_lib; pub fn main() { the_lib::f();