about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-08-18 08:29:44 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-08-18 09:19:10 -0700
commit67deb2e65e150a1b9b2fcd457da47e3e13b2c4f7 (patch)
tree37fe9cab468b9f6757ca415f42a072a59012ee1e /src/libsyntax
parent7074592ee1ad1a155919268229b6464f2acc576e (diff)
downloadrust-67deb2e65e150a1b9b2fcd457da47e3e13b2c4f7.tar.gz
rust-67deb2e65e150a1b9b2fcd457da47e3e13b2c4f7.zip
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]
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/format.rs2
-rw-r--r--src/libsyntax/parse/mod.rs2
-rw-r--r--src/libsyntax/parse/obsolete.rs5
-rw-r--r--src/libsyntax/parse/parser.rs5
4 files changed, 10 insertions, 4 deletions
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index b00924c1590..835181d55c4 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -14,10 +14,10 @@ use codemap::{Span, respan};
 use ext::base::*;
 use ext::base;
 use ext::build::AstBuilder;
+use fmt_macros as parse;
 use parse::token::InternedString;
 use parse::token;
 
-use parse = fmt_macros;
 use std::collections::HashMap;
 use std::gc::{Gc, GC};
 
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 271cefeaf03..e76e4adcd7f 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -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);
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index afcf84753a6..5273addf4f5 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -34,6 +34,7 @@ pub enum ObsoleteSyntax {
     ObsoleteOwnedSelf,
     ObsoleteManagedType,
     ObsoleteManagedExpr,
+    ObsoleteImportRenaming,
 }
 
 pub trait ParserObsoleteMethods {
@@ -83,6 +84,10 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
                 "`@` notation for a managed pointer allocation",
                 "use the `box(GC)` operator instead of `@`"
             ),
+            ObsoleteImportRenaming => (
+                "`use foo = bar` syntax",
+                "write `use bar as foo` instead"
+            )
         };
 
         self.report(sp, kind, kind_str, desc);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 80b852111a2..9e2829e6380 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5385,7 +5385,6 @@ impl<'a> Parser<'a> {
         match self.token {
           token::EQ => {
             // x = foo::bar
-            // NOTE(stage0, #16461, pcwalton): Deprecate after snapshot.
             self.bump();
             let path_lo = self.span.lo;
             path = vec!(self.parse_ident());
@@ -5394,8 +5393,10 @@ impl<'a> Parser<'a> {
                 let id = self.parse_ident();
                 path.push(id);
             }
+            let span = mk_sp(path_lo, self.span.hi);
+            self.obsolete(span, ObsoleteImportRenaming);
             let path = ast::Path {
-                span: mk_sp(path_lo, self.span.hi),
+                span: span,
                 global: false,
                 segments: path.move_iter().map(|identifier| {
                     ast::PathSegment {