Skip to content

Commit 98ec85f

Browse files
committed
auto merge of #16575 : pcwalton/rust/import-foo-as-bar, r=aturon
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change] r? @aturon
2 parents fcbf012 + 67deb2e commit 98ec85f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+140
-136
lines changed

src/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ module through the rules above. It essentially allows public access into the
18011801
re-exported item. For example, this program is valid:
18021802

18031803
~~~~
1804-
pub use api = self::implementation;
1804+
pub use self::implementation as api;
18051805
18061806
mod implementation {
18071807
pub fn f() {}

src/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ use farm::*;
31123112
However, that's not all. You can also rename an item while you're bringing it into scope:
31133113

31143114
~~~
3115-
use egg_layer = farm::chicken;
3115+
use farm::chicken as egg_layer;
31163116
# mod farm { pub fn chicken() { println!("Laying eggs is fun!") } }
31173117
// ...
31183118
@@ -3335,7 +3335,7 @@ you just have to import it with an `use` statement.
33353335
For example, it re-exports `range` which is defined in `std::iter::range`:
33363336

33373337
~~~
3338-
use iter_range = std::iter::range;
3338+
use std::iter::range as iter_range;
33393339
33403340
fn main() {
33413341
// `range` is imported by default

src/liballoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extern crate libc;
8686

8787
#[deprecated = "use boxed instead"]
8888
#[cfg(not(test))]
89-
pub use owned = boxed;
89+
pub use boxed as owned;
9090

9191
// Heaps provided for low-level allocation strategies
9292

src/libcollections/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ use core::mem;
7373
use vec::Vec;
7474

7575
/// Reexport the `sip::hash` function as our default hasher.
76-
pub use hash = self::sip::hash;
76+
pub use self::sip::hash as hash;
7777

7878
pub mod sip;
7979

src/libcollections/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ use core::fmt;
1919
use core::mem;
2020
use core::ptr;
2121
// FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait
22-
use RawSlice = core::raw::Slice;
22+
use core::raw::Slice as RawSlice;
2323

2424
use {Mutable, MutableSeq};
2525
use hash;
2626
use str;
2727
use str::{CharRange, StrAllocating, MaybeOwned, Owned};
28-
use MaybeOwnedSlice = str::Slice; // So many `Slice`s...
28+
use str::Slice as MaybeOwnedSlice; // So many `Slice`s...
2929
use vec::Vec;
3030

3131
/// A growable string stored as a UTF-8 encoded buffer.

src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
use core::prelude::*;
1414

1515
use alloc::heap::{allocate, reallocate, deallocate};
16-
use RawSlice = core::raw::Slice;
1716
use core::cmp::max;
1817
use core::default::Default;
1918
use core::fmt;
2019
use core::mem;
2120
use core::num;
2221
use core::ptr;
22+
use core::raw::Slice as RawSlice;
2323
use core::uint;
2424

2525
use {Mutable, MutableSeq};

src/libcore/kinds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ by the compiler automatically for the types to which they apply.
2121
*/
2222

2323
#[deprecated = "This has been renamed to Sync"]
24-
pub use Share = self::Sync;
24+
pub use self::Sync as Share;
2525

2626
/// Types able to be transferred across task boundaries.
2727
#[lang="send"]

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub mod collections;
107107
/// Deprecated module in favor of `std::cell`
108108
pub mod ty {
109109
#[deprecated = "this type has been renamed to `UnsafeCell`"]
110-
pub use Unsafe = cell::UnsafeCell;
110+
pub use cell::UnsafeCell as Unsafe;
111111
}
112112

113113
/* Core types and methods on primitives */

src/libcore/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use mem::size_of;
5050
use kinds::marker;
5151
use raw::Repr;
5252
// Avoid conflicts with *both* the Slice trait (buggy) and the `slice::raw` module.
53-
use RawSlice = raw::Slice;
53+
use raw::Slice as RawSlice;
5454

5555

5656
//

src/libgraphviz/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ forming a diamond-shaped acyclic graph and then pointing to the fifth
4747
which is cyclic.
4848
4949
```rust
50-
use dot = graphviz;
50+
use graphviz as dot;
5151
use graphviz::maybe_owned_vec::IntoMaybeOwnedVector;
5252
5353
type Nd = int;
@@ -147,7 +147,7 @@ labelled with the ⊆ character (specified using the HTML character
147147
entity `&sube`).
148148
149149
```rust
150-
use dot = graphviz;
150+
use graphviz as dot;
151151
use std::str;
152152
153153
type Nd = uint;
@@ -203,7 +203,7 @@ The output from this example is the same as the second example: the
203203
Hasse-diagram for the subsets of the set `{x, y}`.
204204
205205
```rust
206-
use dot = graphviz;
206+
use graphviz as dot;
207207
use std::str;
208208
209209
type Nd<'a> = (uint, &'a str);

0 commit comments

Comments
 (0)