about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-11-28 02:58:18 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-12-17 22:43:00 +0300
commit7c901ba537c0df324c8b99f06ca3b76fcf20766a (patch)
treea8b9817bb23f94392f8ab08b883f86c3cd90582f /src
parentadbfec229ce07ff4b2a7bf2d6dec2d13cb224980 (diff)
downloadrust-7c901ba537c0df324c8b99f06ca3b76fcf20766a.tar.gz
rust-7c901ba537c0df324c8b99f06ca3b76fcf20766a.zip
Stabilize `underscore_imports`
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/lib.rs2
-rw-r--r--src/libsyntax/feature_gate.rs23
-rw-r--r--src/test/ui/feature-gates/feature-gate-underscore-imports.rs14
-rw-r--r--src/test/ui/feature-gates/feature-gate-underscore-imports.stderr19
-rw-r--r--src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs2
-rw-r--r--src/test/ui/rfc-2166-underscore-imports/basic.rs1
-rw-r--r--src/test/ui/rfc-2166-underscore-imports/basic.stderr6
-rw-r--r--src/test/ui/rfc-2166-underscore-imports/duplicate.rs2
-rw-r--r--src/test/ui/rfc-2166-underscore-imports/unused-2018.rs1
-rw-r--r--src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr6
-rw-r--r--src/test/ui/rust-2018/future-proofing-locals.rs2
-rw-r--r--src/test/ui/rust-2018/uniform-paths/macro-rules.rs2
12 files changed, 11 insertions, 69 deletions
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index 1a35f4da20b..983488da003 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -37,7 +37,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
 #![feature(if_while_or_patterns)]
 #![feature(try_from)]
 #![feature(reverse_bits)]
-#![feature(underscore_imports)]
+#![cfg_attr(stage0, feature(underscore_imports))]
 
 #![recursion_limit="256"]
 
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 1a4de59cce6..4eca0c942f3 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -400,9 +400,6 @@ declare_features! (
     // Allows `#[repr(packed)]` attribute on structs.
     (active, repr_packed, "1.26.0", Some(33158), None),
 
-    // Allows `use path as _;` and `extern crate c as _;`.
-    (active, underscore_imports, "1.26.0", Some(48216), None),
-
     // Allows macro invocations in `extern {}` blocks.
     (active, macros_in_extern, "1.27.0", Some(49476), None),
 
@@ -694,6 +691,8 @@ declare_features! (
     (accepted, self_struct_ctor, "1.32.0", Some(51994), None),
     // `Self` in type definitions (RFC 2300)
     (accepted, self_in_typedefs, "1.32.0", Some(49303), None),
+    // `use path as _;` and `extern crate c as _;`
+    (accepted, underscore_imports, "1.33.0", Some(48216), None),
 );
 
 // If you change this, please modify `src/doc/unstable-book` as well. You must
@@ -1547,26 +1546,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
         }
     }
 
-    fn visit_use_tree(&mut self, use_tree: &'a ast::UseTree, id: NodeId, _nested: bool) {
-        if let ast::UseTreeKind::Simple(Some(ident), ..) = use_tree.kind {
-            if ident.name == "_" {
-                gate_feature_post!(&self, underscore_imports, use_tree.span,
-                                   "renaming imports with `_` is unstable");
-            }
-        }
-
-        visit::walk_use_tree(self, use_tree, id);
-    }
-
     fn visit_item(&mut self, i: &'a ast::Item) {
         match i.node {
-            ast::ItemKind::ExternCrate(_) => {
-                if i.ident.name == "_" {
-                    gate_feature_post!(&self, underscore_imports, i.span,
-                                       "renaming extern crates with `_` is unstable");
-                }
-            }
-
             ast::ItemKind::Static(..) |
             ast::ItemKind::Const(_,_) => {
                 if i.ident.name == "_" {
diff --git a/src/test/ui/feature-gates/feature-gate-underscore-imports.rs b/src/test/ui/feature-gates/feature-gate-underscore-imports.rs
deleted file mode 100644
index ceb8afe124a..00000000000
--- a/src/test/ui/feature-gates/feature-gate-underscore-imports.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern crate std as _; //~ ERROR renaming extern crates with `_` is unstable
-use std::vec as _; //~ ERROR renaming imports with `_` is unstable
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-underscore-imports.stderr b/src/test/ui/feature-gates/feature-gate-underscore-imports.stderr
deleted file mode 100644
index 2eea95260d5..00000000000
--- a/src/test/ui/feature-gates/feature-gate-underscore-imports.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0658]: renaming extern crates with `_` is unstable (see issue #48216)
-  --> $DIR/feature-gate-underscore-imports.rs:11:1
-   |
-LL | extern crate std as _; //~ ERROR renaming extern crates with `_` is unstable
-   | ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: add #![feature(underscore_imports)] to the crate attributes to enable
-
-error[E0658]: renaming imports with `_` is unstable (see issue #48216)
-  --> $DIR/feature-gate-underscore-imports.rs:12:5
-   |
-LL | use std::vec as _; //~ ERROR renaming imports with `_` is unstable
-   |     ^^^^^^^^^^^^^
-   |
-   = help: add #![feature(underscore_imports)] to the crate attributes to enable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs b/src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs
index 70de9167332..c335336bee8 100644
--- a/src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs
+++ b/src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs
@@ -1,5 +1,3 @@
-#![feature(underscore_imports)]
-
 #[macro_export]
 macro_rules! do_nothing {
     () => ()
diff --git a/src/test/ui/rfc-2166-underscore-imports/basic.rs b/src/test/ui/rfc-2166-underscore-imports/basic.rs
index 64a8d0720d6..93b246fb92d 100644
--- a/src/test/ui/rfc-2166-underscore-imports/basic.rs
+++ b/src/test/ui/rfc-2166-underscore-imports/basic.rs
@@ -11,7 +11,6 @@
 // compile-pass
 // aux-build:underscore-imports.rs
 
-#![feature(underscore_imports)]
 #![warn(unused_imports, unused_extern_crates)]
 
 #[macro_use]
diff --git a/src/test/ui/rfc-2166-underscore-imports/basic.stderr b/src/test/ui/rfc-2166-underscore-imports/basic.stderr
index e1fe5cc0783..f2b8cc411ff 100644
--- a/src/test/ui/rfc-2166-underscore-imports/basic.stderr
+++ b/src/test/ui/rfc-2166-underscore-imports/basic.stderr
@@ -1,17 +1,17 @@
 warning: unused import: `m::Tr1 as _`
-  --> $DIR/basic.rs:37:9
+  --> $DIR/basic.rs:36:9
    |
 LL |     use m::Tr1 as _; //~ WARN unused import
    |         ^^^^^^^^^^^
    |
 note: lint level defined here
-  --> $DIR/basic.rs:15:9
+  --> $DIR/basic.rs:14:9
    |
 LL | #![warn(unused_imports, unused_extern_crates)]
    |         ^^^^^^^^^^^^^^
 
 warning: unused import: `S as _`
-  --> $DIR/basic.rs:38:9
+  --> $DIR/basic.rs:37:9
    |
 LL |     use S as _; //~ WARN unused import
    |         ^^^^^^
diff --git a/src/test/ui/rfc-2166-underscore-imports/duplicate.rs b/src/test/ui/rfc-2166-underscore-imports/duplicate.rs
index 92615c4966d..95f7cae0b87 100644
--- a/src/test/ui/rfc-2166-underscore-imports/duplicate.rs
+++ b/src/test/ui/rfc-2166-underscore-imports/duplicate.rs
@@ -1,8 +1,6 @@
 // compile-pass
 // aux-build:duplicate.rs
 
-#![feature(underscore_imports)]
-
 extern crate duplicate;
 
 #[duplicate::duplicate]
diff --git a/src/test/ui/rfc-2166-underscore-imports/unused-2018.rs b/src/test/ui/rfc-2166-underscore-imports/unused-2018.rs
index 611eb3c67ca..d06a26a5f11 100644
--- a/src/test/ui/rfc-2166-underscore-imports/unused-2018.rs
+++ b/src/test/ui/rfc-2166-underscore-imports/unused-2018.rs
@@ -1,6 +1,5 @@
 // edition:2018
 
-#![feature(underscore_imports)]
 #![deny(unused_imports)]
 
 mod multi_segment {
diff --git a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr
index 02b29b3f4fe..4163c287607 100644
--- a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr
+++ b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr
@@ -1,17 +1,17 @@
 error: unused import: `core::any`
-  --> $DIR/unused-2018.rs:7:9
+  --> $DIR/unused-2018.rs:6:9
    |
 LL |     use core::any; //~ ERROR unused import: `core::any`
    |         ^^^^^^^^^
    |
 note: lint level defined here
-  --> $DIR/unused-2018.rs:4:9
+  --> $DIR/unused-2018.rs:3:9
    |
 LL | #![deny(unused_imports)]
    |         ^^^^^^^^^^^^^^
 
 error: unused import: `core`
-  --> $DIR/unused-2018.rs:11:9
+  --> $DIR/unused-2018.rs:10:9
    |
 LL |     use core; //~ ERROR unused import: `core`
    |         ^^^^
diff --git a/src/test/ui/rust-2018/future-proofing-locals.rs b/src/test/ui/rust-2018/future-proofing-locals.rs
index d2e6dbbb954..4f0cadaae5d 100644
--- a/src/test/ui/rust-2018/future-proofing-locals.rs
+++ b/src/test/ui/rust-2018/future-proofing-locals.rs
@@ -1,6 +1,6 @@
 // edition:2018
 
-#![feature(uniform_paths, underscore_imports)]
+#![feature(uniform_paths)]
 
 mod T {
     pub struct U;
diff --git a/src/test/ui/rust-2018/uniform-paths/macro-rules.rs b/src/test/ui/rust-2018/uniform-paths/macro-rules.rs
index e8098a46790..fc433c201b0 100644
--- a/src/test/ui/rust-2018/uniform-paths/macro-rules.rs
+++ b/src/test/ui/rust-2018/uniform-paths/macro-rules.rs
@@ -2,7 +2,7 @@
 
 // For the time being `macro_rules` items are treated as *very* private...
 
-#![feature(underscore_imports, decl_macro, uniform_paths)]
+#![feature(decl_macro, uniform_paths)]
 
 mod m1 {
     macro_rules! legacy_macro { () => () }