Skip to content

Commit 19836b2

Browse files
committed
Stabilize uniform_paths
1 parent e412291 commit 19836b2

31 files changed

+52
-243
lines changed

src/librustc_resolve/macros.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -956,32 +956,23 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
956956
// but its `Def` should coincide with a crate passed with `--extern`
957957
// (otherwise there would be ambiguity) and we can skip feature error in this case.
958958
'ok: {
959-
if !is_import || (!rust_2015 && self.session.features_untracked().uniform_paths) {
959+
if !is_import || !rust_2015 {
960960
break 'ok;
961961
}
962962
if ns == TypeNS && use_prelude && self.extern_prelude_get(ident, true).is_some() {
963963
break 'ok;
964964
}
965-
if rust_2015 {
966-
let root_ident = Ident::new(keywords::CrateRoot.name(), orig_ident.span);
967-
let root_module = self.resolve_crate_root(root_ident);
968-
if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module),
969-
orig_ident, ns, None, false, path_span)
970-
.is_ok() {
971-
break 'ok;
972-
}
965+
let root_ident = Ident::new(keywords::PathRoot.name(), orig_ident.span);
966+
let root_module = self.resolve_crate_root(root_ident);
967+
if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module),
968+
orig_ident, ns, None, false, path_span)
969+
.is_ok() {
970+
break 'ok;
973971
}
974972

975-
let reason = if rust_2015 {
976-
"in macros originating from 2015 edition"
977-
} else {
978-
"on stable channel"
979-
};
980-
let msg = format!("imports can only refer to extern crate names \
981-
passed with `--extern` {}", reason);
982-
let mut err = feature_err(&self.session.parse_sess, "uniform_paths",
983-
ident.span, GateIssue::Language, &msg);
984-
973+
let msg = "imports can only refer to extern crate names passed with \
974+
`--extern` in macros originating from 2015 edition";
975+
let mut err = self.session.struct_span_err(ident.span, msg);
985976
let what = self.binding_description(binding, ident,
986977
flags.contains(Flags::MISC_FROM_PRELUDE));
987978
let note_msg = format!("this import refers to {what}", what = what);

src/libsyntax/feature_gate.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,7 @@ declare_features! (
459459
// Support for arbitrary delimited token streams in non-macro attributes
460460
(active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None),
461461

462-
// Allows `use x::y;` to resolve through `self::x`, not just `::x`
463-
(active, uniform_paths, "1.30.0", Some(53130), None),
464-
465-
// Allows unsized rvalues at arguments and parameters
462+
// Allows unsized rvalues at arguments and parameters.
466463
(active, unsized_locals, "1.30.0", Some(48055), None),
467464

468465
// #![test_runner]
@@ -689,6 +686,8 @@ declare_features! (
689686
(accepted, self_struct_ctor, "1.32.0", Some(51994), None),
690687
// `Self` in type definitions (RFC 2300)
691688
(accepted, self_in_typedefs, "1.32.0", Some(49303), None),
689+
// Allows `use x::y;` to search `x` in the current scope.
690+
(accepted, uniform_paths, "1.32.0", Some(53130), None),
692691
);
693692

694693
// If you change this, please modify `src/doc/unstable-book` as well. You must

src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// edition:2018
1212

13-
#![feature(uniform_paths)]
14-
1513
mod m { pub fn f() {} }
1614
mod n { pub fn g() {} }
1715

src/test/run-pass/uniform-paths/basic-nested.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
1-
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2-
// file at the top-level directory of this distribution and at
3-
// http://rust-lang.org/COPYRIGHT.
4-
//
5-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
// option. This file may not be copied, modified, or distributed
9-
// except according to those terms.
1+
// This test is similar to `basic.rs`, but nested in modules.
102

113
// run-pass
12-
#![allow(unused_imports)]
13-
#![allow(non_camel_case_types)]
14-
154
// edition:2018
165

17-
#![feature(decl_macro, uniform_paths)]
6+
#![feature(decl_macro)]
187

19-
// This test is similar to `basic.rs`, but nested in modules.
8+
#![allow(unused_imports)]
9+
#![allow(non_camel_case_types)]
2010

2111
mod foo {
2212
// Test that ambiguity errors are not emitted between `self::test` and

src/test/run-pass/uniform-paths/basic.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![allow(unused_imports)]
13-
#![allow(non_camel_case_types)]
14-
1512
// edition:2018
1613

17-
#![feature(uniform_paths)]
14+
#![allow(unused_imports)]
15+
#![allow(non_camel_case_types)]
1816

1917
// Test that ambiguity errors are not emitted between `self::test` and
2018
// `::test`, assuming the latter (crate) is not in `extern_prelude`.

src/test/run-pass/uniform-paths/macros-nested.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2-
// file at the top-level directory of this distribution and at
3-
// http://rust-lang.org/COPYRIGHT.
4-
//
5-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
// option. This file may not be copied, modified, or distributed
9-
// except according to those terms.
1+
// This test is similar to `macros.rs`, but nested in modules.
102

113
// run-pass
12-
#![allow(non_camel_case_types)]
13-
144
// edition:2018
155

16-
#![feature(uniform_paths)]
17-
18-
// This test is similar to `macros.rs`, but nested in modules.
6+
#![allow(non_camel_case_types)]
197

208
mod foo {
219
// Test that ambiguity errors are not emitted between `self::test` and

src/test/run-pass/uniform-paths/macros.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2-
// file at the top-level directory of this distribution and at
3-
// http://rust-lang.org/COPYRIGHT.
4-
//
5-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
// option. This file may not be copied, modified, or distributed
9-
// except according to those terms.
1+
// This test is similar to `basic.rs`, but with macros defining local items.
102

113
// run-pass
12-
#![allow(non_camel_case_types)]
13-
144
// edition:2018
155

16-
#![feature(uniform_paths)]
17-
18-
// This test is similar to `basic.rs`, but with macros defining local items.
6+
#![allow(non_camel_case_types)]
197

208
// Test that ambiguity errors are not emitted between `self::test` and
219
// `::test`, assuming the latter (crate) is not in `extern_prelude`.

src/test/run-pass/uniform-paths/same-crate.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
1312
// edition:2018
1413

15-
#![feature(uniform_paths)]
16-
1714
pub const A: usize = 0;
1815

1916
pub mod foo {

src/test/ui/editions/edition-imports-2015.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// aux-build:edition-imports-2018.rs
44
// aux-build:absolute.rs
55

6-
#![feature(uniform_paths)]
7-
86
#[macro_use]
97
extern crate edition_imports_2018;
108

src/test/ui/editions/edition-imports-2015.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: cannot glob-import all possible crates
2-
--> $DIR/edition-imports-2015.rs:25:5
2+
--> $DIR/edition-imports-2015.rs:23:5
33
|
44
LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates
55
| ^^^^^^^^^^^^

0 commit comments

Comments
 (0)