提交 67deb2e6 编写于 作者: P Patrick Walton

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]
上级 7074592e
......@@ -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() {}
......
......@@ -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
......
......@@ -86,7 +86,7 @@
#[deprecated = "use boxed instead"]
#[cfg(not(test))]
pub use owned = boxed;
pub use boxed as owned;
// Heaps provided for low-level allocation strategies
......
......@@ -73,7 +73,7 @@
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;
......
......@@ -19,13 +19,13 @@
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.
......
......@@ -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};
......
......@@ -21,7 +21,7 @@
*/
#[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"]
......
......@@ -107,7 +107,7 @@
/// 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 */
......
......@@ -50,7 +50,7 @@
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;
//
......
......@@ -47,7 +47,7 @@
which is cyclic.
```rust
use dot = graphviz;
use graphviz as dot;
use graphviz::maybe_owned_vec::IntoMaybeOwnedVector;
type Nd = int;
......@@ -147,7 +147,7 @@ pub fn main() {
entity `&sube`).
```rust
use dot = graphviz;
use graphviz as dot;
use std::str;
type Nd = uint;
......@@ -203,7 +203,7 @@ pub fn main() {
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);
......
......@@ -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> {
......
......@@ -25,7 +25,7 @@
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
......
......@@ -79,8 +79,8 @@
#[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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -148,8 +148,8 @@ fn wait(&mut self) -> IoResult<rtio::ProcessExit> {
}
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 @@ fn drop(&mut self) {
}
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() } {
......
......@@ -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));
......
......@@ -21,7 +21,7 @@
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::ppaux;
use util::nodemap::{NodeSet};
use dot = graphviz;
use graphviz as dot;
use serialize::{json, Encodable};
......
......@@ -16,7 +16,7 @@
use std::dynamic_lib::DynamicLibrary;
use std::collections::HashSet;
use myfs = util::fs;
use util::fs as myfs;
pub enum FileMatch { FileMatches, FileDoesntMatch }
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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};
......
......@@ -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;
......
......@@ -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;
......
......@@ -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};
......
......@@ -17,8 +17,8 @@
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};
......
......@@ -24,8 +24,8 @@
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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -53,9 +53,9 @@
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,
......
......@@ -16,10 +16,10 @@
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;
......
......@@ -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;
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;
......
......@@ -53,15 +53,15 @@
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;
......
......@@ -121,7 +121,7 @@ fn get_i(x: &'a Bar) -> &'a int {
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;
......
......@@ -195,7 +195,7 @@ enum OptionalMap<C> { Some(|C| -> C), None }
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;
......
......@@ -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};
......
......@@ -16,7 +16,7 @@
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";
......
......@@ -545,7 +545,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
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) => {
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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;
......
......@@ -162,8 +162,8 @@ pub fn borrow() -> Option<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 {
......
......@@ -74,7 +74,7 @@
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 extern "C" fn rust_eh_personality_catch(
#[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 extern "C" fn rust_eh_personality_catch(
#[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 extern "C" fn rust_eh_personality_catch(
#[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;
......
......@@ -25,7 +25,7 @@
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};
......
......@@ -27,10 +27,10 @@
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.
......
......@@ -175,7 +175,7 @@
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;
......
......@@ -80,59 +80,59 @@
/// 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;
......
......@@ -185,9 +185,9 @@
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};
......
......@@ -27,7 +27,7 @@
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;
......
......@@ -29,7 +29,7 @@
use rustrt::thread::Thread;
use atomic;
use mpsc = mpsc_queue;
use mpsc_queue as mpsc;
static DISCONNECTED: int = int::MIN;
static FUDGE: int = 1024;
......
......@@ -28,7 +28,7 @@
use atomic;
use comm::Receiver;
use spsc = spsc_queue;
use spsc_queue as spsc;
static DISCONNECTED: int = int::MIN;
#[cfg(test)]
......
......@@ -68,7 +68,7 @@
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;
......
......@@ -14,10 +14,10 @@
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};
......
......@@ -328,7 +328,7 @@ fn filemap_to_tts(sess: &ParseSess, filemap: Rc<FileMap>)
-> 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);
......
......@@ -34,6 +34,7 @@ pub enum ObsoleteSyntax {
ObsoleteOwnedSelf,
ObsoleteManagedType,
ObsoleteManagedExpr,
ObsoleteImportRenaming,
}
pub trait ParserObsoleteMethods {
......@@ -83,6 +84,10 @@ fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax) {
"`@` 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);
......
......@@ -5385,7 +5385,6 @@ fn parse_view_path(&mut self) -> Gc<ViewPath> {
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 @@ fn parse_view_path(&mut self) -> Gc<ViewPath> {
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 {
......
......@@ -225,7 +225,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
#[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 @@ fn next(&mut self) -> Option<&'a str> {
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;
}
......
......@@ -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() {
}
......
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册