From 5218a5cf356b65e8fc1014cdf0e299c6c2ab6e01 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Thu, 9 Aug 2018 23:50:04 +0300 Subject: [PATCH] syntax: add `uniform_paths` feature-gate. --- src/libsyntax/feature_gate.rs | 3 +++ src/test/ui/feature-gate-uniform-paths.rs | 22 +++++++++++++++++++ src/test/ui/feature-gate-uniform-paths.stderr | 9 ++++++++ 3 files changed, 34 insertions(+) create mode 100644 src/test/ui/feature-gate-uniform-paths.rs create mode 100644 src/test/ui/feature-gate-uniform-paths.stderr diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index b779b2eb689e8..56e69b9df9e04 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -507,6 +507,9 @@ declare_features! ( // Support for arbitrary delimited token streams in non-macro attributes. (active, unrestricted_attribute_tokens, "1.30.0", Some(44690), None), + + // Allows `use x::y;` to resolve through `self::x`, not just `::x`. + (active, uniform_paths, "1.30.0", Some(53130), None), ); declare_features! ( diff --git a/src/test/ui/feature-gate-uniform-paths.rs b/src/test/ui/feature-gate-uniform-paths.rs new file mode 100644 index 0000000000000..140655d52bd46 --- /dev/null +++ b/src/test/ui/feature-gate-uniform-paths.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod foo { + pub use bar::Bar; + //~^ ERROR unresolved import `bar` + + pub mod bar { + pub struct Bar; + } +} + +fn main() { + let _ = foo::Bar; +} diff --git a/src/test/ui/feature-gate-uniform-paths.stderr b/src/test/ui/feature-gate-uniform-paths.stderr new file mode 100644 index 0000000000000..68faacfcbe75e --- /dev/null +++ b/src/test/ui/feature-gate-uniform-paths.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `bar` + --> $DIR/feature-gate-uniform-paths.rs:12:13 + | +LL | pub use bar::Bar; + | ^^^ Did you mean `self::bar`? + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`.