libsyntax: Remove the use foo = bar syntax from the language in favor

of `use bar as foo`.

Change all uses of `use foo = bar` to `use bar as foo`.

Implements RFC #47.

Closes #16461.

[breaking-change]
This commit is contained in:
Patrick Walton 2014-08-18 08:29:44 -07:00
parent 7074592ee1
commit 67deb2e65e
62 changed files with 140 additions and 136 deletions

View File

@ -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: re-exported item. For example, this program is valid:
~~~~ ~~~~
pub use api = self::implementation; pub use self::implementation as api;
mod implementation { mod implementation {
pub fn f() {} pub fn f() {}

View File

@ -3112,7 +3112,7 @@ use farm::*;
However, that's not all. You can also rename an item while you're bringing it into scope: 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!") } } # 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`: 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() { fn main() {
// `range` is imported by default // `range` is imported by default

View File

@ -86,7 +86,7 @@ extern crate libc;
#[deprecated = "use boxed instead"] #[deprecated = "use boxed instead"]
#[cfg(not(test))] #[cfg(not(test))]
pub use owned = boxed; pub use boxed as owned;
// Heaps provided for low-level allocation strategies // Heaps provided for low-level allocation strategies

View File

@ -73,7 +73,7 @@ use core::mem;
use vec::Vec; use vec::Vec;
/// Reexport the `sip::hash` function as our default hasher. /// 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; pub mod sip;

View File

@ -19,13 +19,13 @@ use core::fmt;
use core::mem; use core::mem;
use core::ptr; use core::ptr;
// FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait // 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 {Mutable, MutableSeq};
use hash; use hash;
use str; use str;
use str::{CharRange, StrAllocating, MaybeOwned, Owned}; 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; use vec::Vec;
/// A growable string stored as a UTF-8 encoded buffer. /// A growable string stored as a UTF-8 encoded buffer.

View File

@ -13,13 +13,13 @@
use core::prelude::*; use core::prelude::*;
use alloc::heap::{allocate, reallocate, deallocate}; use alloc::heap::{allocate, reallocate, deallocate};
use RawSlice = core::raw::Slice;
use core::cmp::max; use core::cmp::max;
use core::default::Default; use core::default::Default;
use core::fmt; use core::fmt;
use core::mem; use core::mem;
use core::num; use core::num;
use core::ptr; use core::ptr;
use core::raw::Slice as RawSlice;
use core::uint; use core::uint;
use {Mutable, MutableSeq}; use {Mutable, MutableSeq};

View File

@ -21,7 +21,7 @@ by the compiler automatically for the types to which they apply.
*/ */
#[deprecated = "This has been renamed to Sync"] #[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. /// Types able to be transferred across task boundaries.
#[lang="send"] #[lang="send"]

View File

@ -107,7 +107,7 @@ pub mod collections;
/// Deprecated module in favor of `std::cell` /// Deprecated module in favor of `std::cell`
pub mod ty { pub mod ty {
#[deprecated = "this type has been renamed to `UnsafeCell`"] #[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 */ /* Core types and methods on primitives */

View File

@ -50,7 +50,7 @@ use mem::size_of;
use kinds::marker; use kinds::marker;
use raw::Repr; use raw::Repr;
// Avoid conflicts with *both* the Slice trait (buggy) and the `slice::raw` module. // Avoid conflicts with *both* the Slice trait (buggy) and the `slice::raw` module.
use RawSlice = raw::Slice; use raw::Slice as RawSlice;
// //

View File

@ -47,7 +47,7 @@ forming a diamond-shaped acyclic graph and then pointing to the fifth
which is cyclic. which is cyclic.
```rust ```rust
use dot = graphviz; use graphviz as dot;
use graphviz::maybe_owned_vec::IntoMaybeOwnedVector; use graphviz::maybe_owned_vec::IntoMaybeOwnedVector;
type Nd = int; type Nd = int;
@ -147,7 +147,7 @@ labelled with the ⊆ character (specified using the HTML character
entity `&sube`). entity `&sube`).
```rust ```rust
use dot = graphviz; use graphviz as dot;
use std::str; use std::str;
type Nd = uint; 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}`. Hasse-diagram for the subsets of the set `{x, y}`.
```rust ```rust
use dot = graphviz; use graphviz as dot;
use std::str; use std::str;
type Nd<'a> = (uint, &'a str); type Nd<'a> = (uint, &'a str);

View File

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
use alloc::arc::Arc; use alloc::arc::Arc;
use mpsc = std::sync::mpsc_queue; use std::sync::mpsc_queue as mpsc;
use std::kinds::marker; use std::kinds::marker;
pub enum PopResult<T> { pub enum PopResult<T> {

View File

@ -25,7 +25,7 @@ use coroutine::Coroutine;
use sleeper_list::SleeperList; use sleeper_list::SleeperList;
use stack::StackPool; use stack::StackPool;
use task::{TypeSched, GreenTask, HomeSched, AnySched}; 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 /// A scheduler is responsible for coordinating the execution of Tasks
/// on a single thread. The scheduler runs inside a slightly modified /// on a single thread. The scheduler runs inside a slightly modified

View File

@ -79,8 +79,8 @@ mod tty;
#[cfg(windows)] #[path = "c_win32.rs"] mod c; #[cfg(windows)] #[path = "c_win32.rs"] mod c;
fn unimpl() -> IoError { fn unimpl() -> IoError {
#[cfg(unix)] use ERROR = libc::ENOSYS; #[cfg(unix)] use libc::ENOSYS as ERROR;
#[cfg(windows)] use ERROR = libc::ERROR_CALL_NOT_IMPLEMENTED; #[cfg(windows)] use libc::ERROR_CALL_NOT_IMPLEMENTED as ERROR;
IoError { IoError {
code: ERROR as uint, code: ERROR as uint,
extra: 0, extra: 0,

View File

@ -210,8 +210,8 @@ pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage,
}) })
} }
_ => { _ => {
#[cfg(unix)] use ERROR = libc::EINVAL; #[cfg(unix)] use libc::EINVAL as ERROR;
#[cfg(windows)] use ERROR = libc::WSAEINVAL; #[cfg(windows)] use libc::WSAEINVAL as ERROR;
Err(IoError { Err(IoError {
code: ERROR as uint, code: ERROR as uint,
extra: 0, extra: 0,

View File

@ -39,8 +39,8 @@ fn addr_to_sockaddr_un(addr: &CString,
let len = addr.len(); let len = addr.len();
if len > s.sun_path.len() - 1 { if len > s.sun_path.len() - 1 {
#[cfg(unix)] use ERROR = libc::EINVAL; #[cfg(unix)] use libc::EINVAL as ERROR;
#[cfg(windows)] use ERROR = libc::WSAEINVAL; #[cfg(windows)] use libc::WSAEINVAL as ERROR;
return Err(IoError { return Err(IoError {
code: ERROR as uint, code: ERROR as uint,
extra: 0, extra: 0,

View File

@ -148,8 +148,8 @@ impl rtio::RtioProcess for Process {
} }
fn kill(&mut self, signum: int) -> IoResult<()> { fn kill(&mut self, signum: int) -> IoResult<()> {
#[cfg(unix)] use ERROR = libc::EINVAL; #[cfg(unix)] use libc::EINVAL as ERROR;
#[cfg(windows)] use ERROR = libc::ERROR_NOTHING_TO_TERMINATE; #[cfg(windows)] use libc::ERROR_NOTHING_TO_TERMINATE as ERROR;
// On linux (and possibly other unices), a process that has exited will // On linux (and possibly other unices), a process that has exited will
// continue to accept signals because it is "defunct". The delivery of // 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)> { fn pipe() -> IoResult<(file::FileDesc, file::FileDesc)> {
#[cfg(unix)] use ERROR = libc::EMFILE; #[cfg(unix)] use libc::EMFILE as ERROR;
#[cfg(windows)] use ERROR = libc::WSAEMFILE; #[cfg(windows)] use libc::WSAEMFILE as ERROR;
struct Closer { fd: libc::c_int } struct Closer { fd: libc::c_int }
let os::Pipe { reader, writer } = match unsafe { os::pipe() } { let os::Pipe { reader, writer } = match unsafe { os::pipe() } {

View File

@ -25,8 +25,8 @@ pub enum SocketStatus {
} }
pub fn timeout(desc: &'static str) -> IoError { pub fn timeout(desc: &'static str) -> IoError {
#[cfg(unix)] use ERROR = libc::ETIMEDOUT; #[cfg(unix)] use libc::ETIMEDOUT as ERROR;
#[cfg(windows)] use ERROR = libc::ERROR_OPERATION_ABORTED; #[cfg(windows)] use libc::ERROR_OPERATION_ABORTED as ERROR;
IoError { IoError {
code: ERROR as uint, code: ERROR as uint,
extra: 0, extra: 0,
@ -35,8 +35,8 @@ pub fn timeout(desc: &'static str) -> IoError {
} }
pub fn short_write(n: uint, desc: &'static str) -> IoError { pub fn short_write(n: uint, desc: &'static str) -> IoError {
#[cfg(unix)] use ERROR = libc::EAGAIN; #[cfg(unix)] use libc::EAGAIN as ERROR;
#[cfg(windows)] use ERROR = libc::ERROR_OPERATION_ABORTED; #[cfg(windows)] use libc::ERROR_OPERATION_ABORTED as ERROR;
IoError { IoError {
code: ERROR as uint, code: ERROR as uint,
extra: n, extra: n,
@ -102,10 +102,10 @@ pub fn connect_timeout(fd: net::sock_t,
len: libc::socklen_t, len: libc::socklen_t,
timeout_ms: u64) -> IoResult<()> { timeout_ms: u64) -> IoResult<()> {
use std::os; use std::os;
#[cfg(unix)] use INPROGRESS = libc::EINPROGRESS; #[cfg(unix)] use libc::EINPROGRESS as INPROGRESS;
#[cfg(windows)] use INPROGRESS = libc::WSAEINPROGRESS; #[cfg(windows)] use libc::WSAEINPROGRESS as INPROGRESS;
#[cfg(unix)] use WOULDBLOCK = libc::EWOULDBLOCK; #[cfg(unix)] use libc::EWOULDBLOCK as WOULDBLOCK;
#[cfg(windows)] use WOULDBLOCK = libc::WSAEWOULDBLOCK; #[cfg(windows)] use libc::WSAEWOULDBLOCK as WOULDBLOCK;
// Make sure the call to connect() doesn't block // Make sure the call to connect() doesn't block
try!(set_nonblocking(fd, true)); try!(set_nonblocking(fd, true));

View File

@ -21,7 +21,7 @@ use metadata::common::LinkMeta;
use metadata::creader; use metadata::creader;
use middle::borrowck::{FnPartsWithCFG}; use middle::borrowck::{FnPartsWithCFG};
use middle::borrowck; use middle::borrowck;
use borrowck_dot = middle::borrowck::graphviz; use middle::borrowck::graphviz as borrowck_dot;
use middle::cfg; use middle::cfg;
use middle::cfg::graphviz::LabelledCFG; use middle::cfg::graphviz::LabelledCFG;
use middle::{trans, freevars, stability, kind, ty, typeck, reachable}; use middle::{trans, freevars, stability, kind, ty, typeck, reachable};
@ -35,7 +35,7 @@ use util::common::time;
use util::ppaux; use util::ppaux;
use util::nodemap::{NodeSet}; use util::nodemap::{NodeSet};
use dot = graphviz; use graphviz as dot;
use serialize::{json, Encodable}; use serialize::{json, Encodable};

View File

@ -16,7 +16,7 @@ use std::io::fs;
use std::dynamic_lib::DynamicLibrary; use std::dynamic_lib::DynamicLibrary;
use std::collections::HashSet; use std::collections::HashSet;
use myfs = util::fs; use util::fs as myfs;
pub enum FileMatch { FileMatches, FileDoesntMatch } pub enum FileMatch { FileMatches, FileDoesntMatch }

View File

@ -12,18 +12,18 @@
// FIXME: remove this after snapshot, and Results are handled // FIXME: remove this after snapshot, and Results are handled
#![allow(unused_must_use)] #![allow(unused_must_use)]
use c = metadata::common; use metadata::common as c;
use cstore = metadata::cstore; use metadata::cstore as cstore;
use driver::session::Session; use driver::session::Session;
use metadata::decoder; use metadata::decoder;
use middle::def; use middle::def;
use e = metadata::encoder; use metadata::encoder as e;
use middle::freevars::{CaptureMode, freevar_entry}; use middle::freevars::{CaptureMode, freevar_entry};
use middle::freevars; use middle::freevars;
use middle::region; use middle::region;
use metadata::tydecode; use metadata::tydecode;
use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter, use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter};
RegionParameter}; use metadata::tydecode::{RegionParameter};
use metadata::tyencode; use metadata::tyencode;
use middle::subst; use middle::subst;
use middle::subst::VecPerParamSpace; use middle::subst::VecPerParamSpace;

View File

@ -19,8 +19,8 @@
use middle::borrowck::*; use middle::borrowck::*;
use euv = middle::expr_use_visitor; use middle::expr_use_visitor as euv;
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::ty; use middle::ty;
use syntax::ast; use syntax::ast;
use syntax::codemap::Span; use syntax::codemap::Span;

View File

@ -12,12 +12,12 @@
* Computes moves. * Computes moves.
*/ */
use mc = middle::mem_categorization;
use middle::borrowck::*; 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::MoveSpanAndPath;
use middle::borrowck::gather_loans::move_error::{MoveError, MoveErrorCollector};
use middle::borrowck::move_data::*; 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 middle::ty;
use syntax::ast; use syntax::ast;
use syntax::codemap::Span; use syntax::codemap::Span;

View File

@ -14,8 +14,8 @@
*/ */
use middle::borrowck::*; use middle::borrowck::*;
use euv = middle::expr_use_visitor; use middle::expr_use_visitor as euv;
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::ty; use middle::ty;
use util::ppaux::Repr; use util::ppaux::Repr;
use syntax::ast; use syntax::ast;

View File

@ -18,8 +18,8 @@
use middle::borrowck::*; use middle::borrowck::*;
use middle::borrowck::move_data::MoveData; use middle::borrowck::move_data::MoveData;
use euv = middle::expr_use_visitor; use middle::expr_use_visitor as euv;
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::ty; use middle::ty;
use util::ppaux::{Repr}; use util::ppaux::{Repr};

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::borrowck::BorrowckCtxt; use middle::borrowck::BorrowckCtxt;
use middle::ty; use middle::ty;

View File

@ -13,8 +13,8 @@
*/ */
use middle::borrowck::*; use middle::borrowck::*;
use euv = middle::expr_use_visitor; use middle::expr_use_visitor as euv;
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::ty; use middle::ty;
use syntax::codemap::Span; use syntax::codemap::Span;
use util::ppaux::Repr; use util::ppaux::Repr;

View File

@ -13,9 +13,9 @@
//! data to rendered labels. //! data to rendered labels.
/// For clarity, rename the graphviz crate locally to dot. /// For clarity, rename the graphviz crate locally to dot.
use dot = graphviz; use graphviz as dot;
pub use middle::cfg::graphviz::{Node, Edge}; 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;
use middle::borrowck::{BorrowckCtxt, LoanPath}; use middle::borrowck::{BorrowckCtxt, LoanPath};

View File

@ -17,8 +17,8 @@ use middle::dataflow::DataFlowContext;
use middle::dataflow::BitwiseOperator; use middle::dataflow::BitwiseOperator;
use middle::dataflow::DataFlowOperator; use middle::dataflow::DataFlowOperator;
use middle::def; use middle::def;
use euv = middle::expr_use_visitor; use middle::expr_use_visitor as euv;
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::ty; use middle::ty;
use util::ppaux::{note_and_explain_region, Repr, UserString}; use util::ppaux::{note_and_explain_region, Repr, UserString};

View File

@ -24,8 +24,8 @@ use middle::cfg;
use middle::dataflow::DataFlowContext; use middle::dataflow::DataFlowContext;
use middle::dataflow::BitwiseOperator; use middle::dataflow::BitwiseOperator;
use middle::dataflow::DataFlowOperator; use middle::dataflow::DataFlowOperator;
use euv = middle::expr_use_visitor; use middle::expr_use_visitor as euv;
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::ty; use middle::ty;
use syntax::ast; use syntax::ast;
use syntax::ast_util; use syntax::ast_util;

View File

@ -12,7 +12,7 @@
/// libgraphviz traits. /// libgraphviz traits.
/// For clarity, rename the graphviz crate locally to dot. /// For clarity, rename the graphviz crate locally to dot.
use dot = graphviz; use graphviz as dot;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;

View File

@ -14,7 +14,7 @@
* `ExprUseVisitor` determines how expressions are being used. * `ExprUseVisitor` determines how expressions are being used.
*/ */
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::def; use middle::def;
use middle::freevars; use middle::freevars;
use middle::pat_util; use middle::pat_util;

View File

@ -189,16 +189,16 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use back::abi; use back::abi;
use mc = middle::mem_categorization;
use driver::config::FullDebugInfo; use driver::config::FullDebugInfo;
use euv = middle::expr_use_visitor;
use llvm;
use llvm::{ValueRef, BasicBlockRef}; use llvm::{ValueRef, BasicBlockRef};
use llvm;
use middle::check_match::StaticInliner;
use middle::check_match;
use middle::const_eval; use middle::const_eval;
use middle::def; use middle::def;
use middle::check_match; use middle::expr_use_visitor as euv;
use middle::check_match::StaticInliner;
use middle::lang_items::StrEqFnLangItem; use middle::lang_items::StrEqFnLangItem;
use middle::mem_categorization as mc;
use middle::pat_util::*; use middle::pat_util::*;
use middle::resolve::DefMap; use middle::resolve::DefMap;
use middle::trans::adt; use middle::trans::adt;

View File

@ -53,9 +53,9 @@ use middle::typeck::MethodCall;
use util::ppaux::Repr; use util::ppaux::Repr;
use std::gc::Gc; use std::gc::Gc;
use syntax::abi as synabi;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use synabi = syntax::abi;
pub struct MethodData { pub struct MethodData {
pub llfn: ValueRef, pub llfn: ValueRef,

View File

@ -16,10 +16,10 @@ use driver::session::Session;
use llvm; use llvm;
use llvm::{ValueRef, BasicBlockRef, BuilderRef}; use llvm::{ValueRef, BasicBlockRef, BuilderRef};
use llvm::{True, False, Bool}; use llvm::{True, False, Bool};
use mc = middle::mem_categorization;
use middle::def; use middle::def;
use middle::freevars; use middle::freevars;
use middle::lang_items::LangItem; use middle::lang_items::LangItem;
use middle::mem_categorization as mc;
use middle::subst; use middle::subst;
use middle::subst::Subst; use middle::subst::Subst;
use middle::trans::base; use middle::trans::base;

View File

@ -12,9 +12,8 @@
use back::svh::Svh; use back::svh::Svh;
use driver::session::Session; use driver::session::Session;
use metadata::csearch;
use mc = middle::mem_categorization;
use lint; use lint;
use metadata::csearch;
use middle::const_eval; use middle::const_eval;
use middle::def; use middle::def;
use middle::dependency_format; use middle::dependency_format;
@ -22,6 +21,7 @@ use middle::freevars::CaptureModeMap;
use middle::freevars; use middle::freevars;
use middle::lang_items::{FnMutTraitLangItem, OpaqueStructLangItem}; use middle::lang_items::{FnMutTraitLangItem, OpaqueStructLangItem};
use middle::lang_items::{TyDescStructLangItem, TyVisitorTraitLangItem}; use middle::lang_items::{TyDescStructLangItem, TyVisitorTraitLangItem};
use middle::mem_categorization as mc;
use middle::resolve; use middle::resolve;
use middle::resolve_lifetime; use middle::resolve_lifetime;
use middle::stability; use middle::stability;

View File

@ -53,15 +53,15 @@ use middle::const_eval;
use middle::def; use middle::def;
use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem}; use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem};
use middle::lang_items::{FnOnceTraitLangItem}; use middle::lang_items::{FnOnceTraitLangItem};
use middle::resolve_lifetime as rl;
use middle::subst::{FnSpace, TypeSpace, SelfSpace, Subst, Substs}; use middle::subst::{FnSpace, TypeSpace, SelfSpace, Subst, Substs};
use middle::subst::{VecPerParamSpace}; use middle::subst::{VecPerParamSpace};
use middle::ty; use middle::ty;
use middle::ty_fold::TypeFolder; use middle::ty_fold::TypeFolder;
use middle::typeck::rscope::{ExplicitRscope, ImpliedSingleRscope};
use middle::typeck::rscope::RegionScope; use middle::typeck::rscope::RegionScope;
use middle::typeck::rscope::{ExplicitRscope, ImpliedSingleRscope};
use middle::typeck::{TypeAndSubsts, infer, lookup_def_tcx, rscope}; use middle::typeck::{TypeAndSubsts, infer, lookup_def_tcx, rscope};
use middle::typeck; use middle::typeck;
use rl = middle::resolve_lifetime;
use util::ppaux::Repr; use util::ppaux::Repr;
use std::rc::Rc; use std::rc::Rc;

View File

@ -121,7 +121,7 @@ and report an error, and it just seems like more mess in the end.)
use middle::def; use middle::def;
use middle::def::{DefArg, DefBinding, DefLocal, DefUpvar}; use middle::def::{DefArg, DefBinding, DefLocal, DefUpvar};
use middle::freevars; use middle::freevars;
use mc = middle::mem_categorization; use middle::mem_categorization as mc;
use middle::ty::{ReScope}; use middle::ty::{ReScope};
use middle::ty; use middle::ty;
use middle::typeck::astconv::AstConv; use middle::typeck::astconv::AstConv;

View File

@ -195,7 +195,7 @@ represents the "variance transform" as defined in the paper:
use std::collections::HashMap; use std::collections::HashMap;
use arena; use arena;
use arena::Arena; use arena::Arena;
use rl = middle::resolve_lifetime; use middle::resolve_lifetime as rl;
use middle::subst; use middle::subst;
use middle::subst::{ParamSpace, FnSpace, TypeSpace, SelfSpace, VecPerParamSpace}; use middle::subst::{ParamSpace, FnSpace, TypeSpace, SelfSpace, VecPerParamSpace};
use middle::ty; use middle::ty;

View File

@ -10,27 +10,27 @@
use middle::def; use middle::def;
use middle::subst;
use middle::subst::{VecPerParamSpace,Subst}; use middle::subst::{VecPerParamSpace,Subst};
use middle::ty::{ReSkolemized, ReVar}; use middle::subst;
use middle::ty::{BoundRegion, BrAnon, BrNamed}; use middle::ty::{BoundRegion, BrAnon, BrNamed};
use middle::ty::{ReEarlyBound, BrFresh, ctxt}; use middle::ty::{ReEarlyBound, BrFresh, ctxt};
use middle::ty::{mt, t, ParamTy};
use middle::ty::{ReFree, ReScope, ReInfer, ReStatic, Region, ReEmpty}; 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_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_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_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_unboxed_closure};
use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_infer};
use middle::ty; 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::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::gc::Gc;
use std::rc::Rc;
use syntax::abi; use syntax::abi;
use syntax::ast_map; use syntax::ast_map;
use syntax::codemap::{Span, Pos}; use syntax::codemap::{Span, Pos};

View File

@ -16,7 +16,7 @@ use std::io;
use std::os; use std::os;
use std::str; use std::str;
use syntax::abi; use syntax::abi;
use ErrorHandler = syntax::diagnostic::Handler; use syntax::diagnostic::Handler as ErrorHandler;
pub static METADATA_FILENAME: &'static str = "rust.metadata.bin"; pub static METADATA_FILENAME: &'static str = "rust.metadata.bin";

View File

@ -545,7 +545,7 @@ impl fmt::Show for clean::ViewPath {
if *name == src.path.segments.last().unwrap().name { if *name == src.path.segments.last().unwrap().name {
write!(f, "use {};", *src) write!(f, "use {};", *src)
} else { } else {
write!(f, "use {} = {};", *name, *src) write!(f, "use {} as {};", *src, *name)
} }
} }
clean::GlobImport(ref src) => { clean::GlobImport(ref src) => {

View File

@ -13,14 +13,12 @@
//! This module uses libsyntax's lexer to provide token-based highlighting for //! This module uses libsyntax's lexer to provide token-based highlighting for
//! the HTML documentation generated by rustdoc. //! the HTML documentation generated by rustdoc.
use std::io;
use syntax::parse;
use syntax::parse::lexer;
use html::escape::Escape; 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. /// Highlights some source code, returning the HTML output.
pub fn highlight(src: &str, class: Option<&str>, id: Option<&str>) -> String { pub fn highlight(src: &str, class: Option<&str>, id: Option<&str>) -> String {

View File

@ -10,7 +10,7 @@
use clean; use clean;
use dl = std::dynamic_lib; use std::dynamic_lib as dl;
use serialize::json; use serialize::json;
use std::mem; use std::mem;
use std::string::String; use std::string::String;

View File

@ -240,7 +240,7 @@ pub mod native {
use alloc::boxed::Box; use alloc::boxed::Box;
use core::mem; use core::mem;
use core::ptr; use core::ptr;
use tls = thread_local_storage; use thread_local_storage as tls;
static mut RT_TLS_KEY: tls::Key = -1; static mut RT_TLS_KEY: tls::Key = -1;

View File

@ -162,8 +162,8 @@ impl<'a> LocalIo<'a> {
pub fn maybe_raise<T>(f: |io: &mut IoFactory| -> IoResult<T>) pub fn maybe_raise<T>(f: |io: &mut IoFactory| -> IoResult<T>)
-> IoResult<T> -> IoResult<T>
{ {
#[cfg(unix)] use ERROR = libc::EINVAL; #[cfg(unix)] use libc::EINVAL as ERROR;
#[cfg(windows)] use ERROR = libc::ERROR_CALL_NOT_IMPLEMENTED; #[cfg(windows)] use libc::ERROR_CALL_NOT_IMPLEMENTED as ERROR;
match LocalIo::borrow() { match LocalIo::borrow() {
Some(mut io) => f(io.get()), Some(mut io) => f(io.get()),
None => Err(IoError { None => Err(IoError {

View File

@ -74,7 +74,7 @@ use libc::c_void;
use local::Local; use local::Local;
use task::Task; use task::Task;
use uw = libunwind; use libunwind as uw;
pub struct Unwinder { pub struct Unwinder {
unwinding: bool, unwinding: bool,
@ -238,7 +238,7 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
#[doc(hidden)] #[doc(hidden)]
#[allow(visible_private_types)] #[allow(visible_private_types)]
pub mod eabi { pub mod eabi {
use uw = libunwind; use libunwind as uw;
use libc::c_int; use libc::c_int;
extern "C" { extern "C" {
@ -292,7 +292,7 @@ pub mod eabi {
#[doc(hidden)] #[doc(hidden)]
#[allow(visible_private_types)] #[allow(visible_private_types)]
pub mod eabi { pub mod eabi {
use uw = libunwind; use libunwind as uw;
use libc::c_int; use libc::c_int;
extern "C" { extern "C" {
@ -345,7 +345,7 @@ pub mod eabi {
#[doc(hidden)] #[doc(hidden)]
#[allow(visible_private_types)] #[allow(visible_private_types)]
pub mod eabi { pub mod eabi {
use uw = libunwind; use libunwind as uw;
use libc::c_int; use libc::c_int;
extern "C" { extern "C" {
@ -396,7 +396,7 @@ pub mod eabi {
#[allow(visible_private_types)] #[allow(visible_private_types)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub mod eabi { pub mod eabi {
use uw = libunwind; use libunwind as uw;
use libc::{c_void, c_int}; use libc::{c_void, c_int};
struct EXCEPTION_RECORD; struct EXCEPTION_RECORD;

View File

@ -25,7 +25,7 @@ use libc::c_void;
use std::mem; use std::mem;
use std::rt::mutex::NativeMutex; use std::rt::mutex::NativeMutex;
use std::rt::task::BlockedTask; use std::rt::task::BlockedTask;
use mpsc = std::sync::mpsc_queue; use std::sync::mpsc_queue as mpsc;
use async::AsyncWatcher; use async::AsyncWatcher;
use super::{Loop, UvHandle}; use super::{Loop, UvHandle};

View File

@ -27,10 +27,10 @@ use to_string::IntoStr;
use vec::Vec; use vec::Vec;
#[deprecated="this trait has been renamed to `AsciiExt`"] #[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`"] #[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. /// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.

View File

@ -175,7 +175,7 @@ pub use core::option;
pub use alloc::boxed; pub use alloc::boxed;
#[deprecated = "use boxed instead"] #[deprecated = "use boxed instead"]
pub use owned = boxed; pub use boxed as owned;
pub use alloc::rc; pub use alloc::rc;
@ -289,7 +289,7 @@ mod std {
pub use vec; // used for vec![] pub use vec; // used for vec![]
// The test runner calls ::std::os::args() but really wants realstd // 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. // The test runner requires std::slice::Vector, so re-export std::slice just for it.
#[cfg(test)] pub use slice; #[cfg(test)] pub use slice;

View File

@ -80,59 +80,59 @@ use vec::Vec;
/// Typedef for POSIX file paths. /// Typedef for POSIX file paths.
/// See `posix::Path` for more info. /// See `posix::Path` for more info.
pub use PosixPath = self::posix::Path; pub use self::posix::Path as PosixPath;
/// Typedef for Windows file paths. /// Typedef for Windows file paths.
/// See `windows::Path` for more info. /// 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 /// Typedef for the platform-native path type
#[cfg(unix)] #[cfg(unix)]
pub use Path = self::posix::Path; pub use self::posix::Path as Path;
/// Typedef for the platform-native path type /// Typedef for the platform-native path type
#[cfg(windows)] #[cfg(windows)]
pub use Path = self::windows::Path; pub use self::windows::Path as Path;
/// Typedef for the platform-native component iterator /// Typedef for the platform-native component iterator
#[cfg(unix)] #[cfg(unix)]
pub use Components = self::posix::Components; pub use self::posix::Components as Components;
/// Typedef for the platform-native component iterator /// Typedef for the platform-native component iterator
#[cfg(windows)] #[cfg(windows)]
pub use Components = self::windows::Components; pub use self::windows::Components as Components;
/// Typedef for the platform-native str component iterator /// Typedef for the platform-native str component iterator
#[cfg(unix)] #[cfg(unix)]
pub use StrComponents = self::posix::StrComponents; pub use self::posix::StrComponents as StrComponents;
/// Typedef for the platform-native str component iterator /// Typedef for the platform-native str component iterator
#[cfg(windows)] #[cfg(windows)]
pub use StrComponents = self::windows::StrComponents; pub use self::windows::StrComponents as StrComponents;
/// Alias for the platform-native separator character. /// Alias for the platform-native separator character.
#[cfg(unix)] #[cfg(unix)]
pub use SEP = self::posix::SEP; pub use self::posix::SEP as SEP;
/// Alias for the platform-native separator character. /// Alias for the platform-native separator character.
#[cfg(windows)] #[cfg(windows)]
pub use SEP = self::windows::SEP; pub use self::windows::SEP as SEP;
/// Alias for the platform-native separator byte. /// Alias for the platform-native separator byte.
#[cfg(unix)] #[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. /// Alias for the platform-native separator byte.
#[cfg(windows)] #[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 /// Typedef for the platform-native separator char func
#[cfg(unix)] #[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 /// Typedef for the platform-native separator char func
#[cfg(windows)] #[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 /// Typedef for the platform-native separator byte func
#[cfg(unix)] #[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 /// Typedef for the platform-native separator byte func
#[cfg(windows)] #[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 posix;
pub mod windows; pub mod windows;

View File

@ -185,9 +185,9 @@ use result::{Ok, Err};
use vec::Vec; use vec::Vec;
#[cfg(not(target_word_size="64"))] #[cfg(not(target_word_size="64"))]
use IsaacWordRng = core_rand::IsaacRng; use core_rand::IsaacRng as IsaacWordRng;
#[cfg(target_word_size="64")] #[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::{Rand, Rng, SeedableRng, Open01, Closed01};
pub use core_rand::{XorShiftRng, IsaacRng, Isaac64Rng}; pub use core_rand::{XorShiftRng, IsaacRng, Isaac64Rng};

View File

@ -27,7 +27,7 @@ pub use core_sync::{Semaphore, SemaphoreGuard};
pub use core_sync::one::{Once, ONCE_INIT}; pub use core_sync::one::{Once, ONCE_INIT};
#[deprecated = "use atomic instead"] #[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::future::Future;
pub use self::task_pool::TaskPool; pub use self::task_pool::TaskPool;

View File

@ -29,7 +29,7 @@ use rustrt::task::{Task, BlockedTask};
use rustrt::thread::Thread; use rustrt::thread::Thread;
use atomic; use atomic;
use mpsc = mpsc_queue; use mpsc_queue as mpsc;
static DISCONNECTED: int = int::MIN; static DISCONNECTED: int = int::MIN;
static FUDGE: int = 1024; static FUDGE: int = 1024;

View File

@ -28,7 +28,7 @@ use rustrt::thread::Thread;
use atomic; use atomic;
use comm::Receiver; use comm::Receiver;
use spsc = spsc_queue; use spsc_queue as spsc;
static DISCONNECTED: int = int::MIN; static DISCONNECTED: int = int::MIN;
#[cfg(test)] #[cfg(test)]

View File

@ -68,7 +68,7 @@ use rustrt::mutex;
use rustrt::task::{BlockedTask, Task}; use rustrt::task::{BlockedTask, Task};
use rustrt::thread::Thread; use rustrt::thread::Thread;
use q = mpsc_intrusive; use mpsc_intrusive as q;
pub static LOCKED: uint = 1 << 0; pub static LOCKED: uint = 1 << 0;
pub static GREEN_BLOCKED: uint = 1 << 1; pub static GREEN_BLOCKED: uint = 1 << 1;

View File

@ -14,10 +14,10 @@ use codemap::{Span, respan};
use ext::base::*; use ext::base::*;
use ext::base; use ext::base;
use ext::build::AstBuilder; use ext::build::AstBuilder;
use fmt_macros as parse;
use parse::token::InternedString; use parse::token::InternedString;
use parse::token; use parse::token;
use parse = fmt_macros;
use std::collections::HashMap; use std::collections::HashMap;
use std::gc::{Gc, GC}; use std::gc::{Gc, GC};

View File

@ -328,7 +328,7 @@ pub mod with_hygiene {
-> Vec<ast::TokenTree> { -> Vec<ast::TokenTree> {
// it appears to me that the cfg doesn't matter here... indeed, // it appears to me that the cfg doesn't matter here... indeed,
// parsing tt's probably shouldn't require a parser at all. // 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 cfg = Vec::new();
let srdr = make_reader(&sess.span_diagnostic, filemap); let srdr = make_reader(&sess.span_diagnostic, filemap);
let mut p1 = Parser::new(sess, cfg, box srdr); let mut p1 = Parser::new(sess, cfg, box srdr);

View File

@ -34,6 +34,7 @@ pub enum ObsoleteSyntax {
ObsoleteOwnedSelf, ObsoleteOwnedSelf,
ObsoleteManagedType, ObsoleteManagedType,
ObsoleteManagedExpr, ObsoleteManagedExpr,
ObsoleteImportRenaming,
} }
pub trait ParserObsoleteMethods { pub trait ParserObsoleteMethods {
@ -83,6 +84,10 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
"`@` notation for a managed pointer allocation", "`@` notation for a managed pointer allocation",
"use the `box(GC)` operator instead of `@`" "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); self.report(sp, kind, kind_str, desc);

View File

@ -5385,7 +5385,6 @@ impl<'a> Parser<'a> {
match self.token { match self.token {
token::EQ => { token::EQ => {
// x = foo::bar // x = foo::bar
// NOTE(stage0, #16461, pcwalton): Deprecate after snapshot.
self.bump(); self.bump();
let path_lo = self.span.lo; let path_lo = self.span.lo;
path = vec!(self.parse_ident()); path = vec!(self.parse_ident());
@ -5394,8 +5393,10 @@ impl<'a> Parser<'a> {
let id = self.parse_ident(); let id = self.parse_ident();
path.push(id); path.push(id);
} }
let span = mk_sp(path_lo, self.span.hi);
self.obsolete(span, ObsoleteImportRenaming);
let path = ast::Path { let path = ast::Path {
span: mk_sp(path_lo, self.span.hi), span: span,
global: false, global: false,
segments: path.move_iter().map(|identifier| { segments: path.move_iter().map(|identifier| {
ast::PathSegment { ast::PathSegment {

View File

@ -225,7 +225,7 @@ impl<'a> Iterator<&'a str> for Graphemes<'a> {
#[inline] #[inline]
fn next(&mut self) -> Option<&'a str> { fn next(&mut self) -> Option<&'a str> {
use gr = tables::grapheme; use tables::grapheme as gr;
if self.string.len() == 0 { if self.string.len() == 0 {
return None; return None;
} }
@ -325,7 +325,7 @@ impl<'a> Iterator<&'a str> for Graphemes<'a> {
impl<'a> DoubleEndedIterator<&'a str> for Graphemes<'a> { impl<'a> DoubleEndedIterator<&'a str> for Graphemes<'a> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'a str> { fn next_back(&mut self) -> Option<&'a str> {
use gr = tables::grapheme; use tables::grapheme as gr;
if self.string.len() == 0 { if self.string.len() == 0 {
return None; return None;
} }

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // 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() { fn main() {
} }

View File

@ -12,7 +12,7 @@
extern crate extern_mod_ordering_lib; 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() { pub fn main() {
the_lib::f(); the_lib::f();