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:
~~~~
pub use api = self::implementation;
pub use self::implementation as api;
mod implementation {
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:
~~~
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

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -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};

View File

@ -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"]

View File

@ -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 */

View File

@ -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;
//

View File

@ -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);

View File

@ -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<T> {

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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() } {

View File

@ -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));

View File

@ -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};

View File

@ -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 }

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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};

View File

@ -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;

View File

@ -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;

View File

@ -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};

View File

@ -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};

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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;

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::{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;

View File

@ -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;

View File

@ -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};

View File

@ -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";

View File

@ -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) => {

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -162,8 +162,8 @@ impl<'a> LocalIo<'a> {
pub fn maybe_raise<T>(f: |io: &mut IoFactory| -> IoResult<T>)
-> IoResult<T>
{
#[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 {

View File

@ -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;

View File

@ -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};

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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};

View File

@ -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;

View File

@ -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;

View File

@ -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)]

View File

@ -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;

View File

@ -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};

View File

@ -328,7 +328,7 @@ pub mod with_hygiene {
-> Vec<ast::TokenTree> {
// 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);

View File

@ -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);

View File

@ -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 {

View File

@ -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;
}

View File

@ -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() {
}

View File

@ -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();