Skip to content

Commit c9bb68f

Browse files
committed
Auto merge of #56303 - petrochenkov:stabuseas, r=cramertj
Stabilize `underscore_imports` Closes #48216
2 parents adbfec2 + 7c901ba commit c9bb68f

File tree

12 files changed

+11
-69
lines changed

12 files changed

+11
-69
lines changed

src/librustc_mir/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
3737
#![feature(if_while_or_patterns)]
3838
#![feature(try_from)]
3939
#![feature(reverse_bits)]
40-
#![feature(underscore_imports)]
40+
#![cfg_attr(stage0, feature(underscore_imports))]
4141

4242
#![recursion_limit="256"]
4343

src/libsyntax/feature_gate.rs

+2-21
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,6 @@ declare_features! (
400400
// Allows `#[repr(packed)]` attribute on structs.
401401
(active, repr_packed, "1.26.0", Some(33158), None),
402402

403-
// Allows `use path as _;` and `extern crate c as _;`.
404-
(active, underscore_imports, "1.26.0", Some(48216), None),
405-
406403
// Allows macro invocations in `extern {}` blocks.
407404
(active, macros_in_extern, "1.27.0", Some(49476), None),
408405

@@ -694,6 +691,8 @@ declare_features! (
694691
(accepted, self_struct_ctor, "1.32.0", Some(51994), None),
695692
// `Self` in type definitions (RFC 2300)
696693
(accepted, self_in_typedefs, "1.32.0", Some(49303), None),
694+
// `use path as _;` and `extern crate c as _;`
695+
(accepted, underscore_imports, "1.33.0", Some(48216), None),
697696
);
698697

699698
// 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> {
15471546
}
15481547
}
15491548

1550-
fn visit_use_tree(&mut self, use_tree: &'a ast::UseTree, id: NodeId, _nested: bool) {
1551-
if let ast::UseTreeKind::Simple(Some(ident), ..) = use_tree.kind {
1552-
if ident.name == "_" {
1553-
gate_feature_post!(&self, underscore_imports, use_tree.span,
1554-
"renaming imports with `_` is unstable");
1555-
}
1556-
}
1557-
1558-
visit::walk_use_tree(self, use_tree, id);
1559-
}
1560-
15611549
fn visit_item(&mut self, i: &'a ast::Item) {
15621550
match i.node {
1563-
ast::ItemKind::ExternCrate(_) => {
1564-
if i.ident.name == "_" {
1565-
gate_feature_post!(&self, underscore_imports, i.span,
1566-
"renaming extern crates with `_` is unstable");
1567-
}
1568-
}
1569-
15701551
ast::ItemKind::Static(..) |
15711552
ast::ItemKind::Const(_,_) => {
15721553
if i.ident.name == "_" {

src/test/ui/feature-gates/feature-gate-underscore-imports.rs

-14
This file was deleted.

src/test/ui/feature-gates/feature-gate-underscore-imports.stderr

-19
This file was deleted.

src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(underscore_imports)]
2-
31
#[macro_export]
42
macro_rules! do_nothing {
53
() => ()

src/test/ui/rfc-2166-underscore-imports/basic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// compile-pass
1212
// aux-build:underscore-imports.rs
1313

14-
#![feature(underscore_imports)]
1514
#![warn(unused_imports, unused_extern_crates)]
1615

1716
#[macro_use]

src/test/ui/rfc-2166-underscore-imports/basic.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
warning: unused import: `m::Tr1 as _`
2-
--> $DIR/basic.rs:37:9
2+
--> $DIR/basic.rs:36:9
33
|
44
LL | use m::Tr1 as _; //~ WARN unused import
55
| ^^^^^^^^^^^
66
|
77
note: lint level defined here
8-
--> $DIR/basic.rs:15:9
8+
--> $DIR/basic.rs:14:9
99
|
1010
LL | #![warn(unused_imports, unused_extern_crates)]
1111
| ^^^^^^^^^^^^^^
1212

1313
warning: unused import: `S as _`
14-
--> $DIR/basic.rs:38:9
14+
--> $DIR/basic.rs:37:9
1515
|
1616
LL | use S as _; //~ WARN unused import
1717
| ^^^^^^

src/test/ui/rfc-2166-underscore-imports/duplicate.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// compile-pass
22
// aux-build:duplicate.rs
33

4-
#![feature(underscore_imports)]
5-
64
extern crate duplicate;
75

86
#[duplicate::duplicate]

src/test/ui/rfc-2166-underscore-imports/unused-2018.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// edition:2018
22

3-
#![feature(underscore_imports)]
43
#![deny(unused_imports)]
54

65
mod multi_segment {

src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: unused import: `core::any`
2-
--> $DIR/unused-2018.rs:7:9
2+
--> $DIR/unused-2018.rs:6:9
33
|
44
LL | use core::any; //~ ERROR unused import: `core::any`
55
| ^^^^^^^^^
66
|
77
note: lint level defined here
8-
--> $DIR/unused-2018.rs:4:9
8+
--> $DIR/unused-2018.rs:3:9
99
|
1010
LL | #![deny(unused_imports)]
1111
| ^^^^^^^^^^^^^^
1212

1313
error: unused import: `core`
14-
--> $DIR/unused-2018.rs:11:9
14+
--> $DIR/unused-2018.rs:10:9
1515
|
1616
LL | use core; //~ ERROR unused import: `core`
1717
| ^^^^

src/test/ui/rust-2018/future-proofing-locals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// edition:2018
22

3-
#![feature(uniform_paths, underscore_imports)]
3+
#![feature(uniform_paths)]
44

55
mod T {
66
pub struct U;

src/test/ui/rust-2018/uniform-paths/macro-rules.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// For the time being `macro_rules` items are treated as *very* private...
44

5-
#![feature(underscore_imports, decl_macro, uniform_paths)]
5+
#![feature(decl_macro, uniform_paths)]
66

77
mod m1 {
88
macro_rules! legacy_macro { () => () }

0 commit comments

Comments
 (0)