From 90f5cfdfbd3c9e39f897fd2271c7b1c7fdaae58e Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 19 Nov 2017 17:05:29 +0300 Subject: Report special messages for path segment keywords in wrong positions --- src/test/compile-fail/dollar-crate-is-keyword-2.rs | 4 ++-- .../compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs | 2 +- .../compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs | 2 +- .../rfc-2126-crate-paths/keyword-crate-as-identifier.rs | 2 +- src/test/compile-fail/super-at-top-level.rs | 3 +-- src/test/compile-fail/use-super-global-path.rs | 6 +++--- 6 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/test') diff --git a/src/test/compile-fail/dollar-crate-is-keyword-2.rs b/src/test/compile-fail/dollar-crate-is-keyword-2.rs index ac96279d614..87a29038035 100644 --- a/src/test/compile-fail/dollar-crate-is-keyword-2.rs +++ b/src/test/compile-fail/dollar-crate-is-keyword-2.rs @@ -13,8 +13,8 @@ mod a {} macro_rules! m { () => { use a::$crate; //~ ERROR unresolved import `a::$crate` - use a::$crate::b; //~ ERROR unresolved import `a::$crate` - type A = a::$crate; //~ ERROR cannot find type `$crate` in module `a` + use a::$crate::b; //~ ERROR `$crate` in paths can only be used in start position + type A = a::$crate; //~ ERROR `$crate` in paths can only be used in start position } } diff --git a/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs b/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs index 11841e6e3ef..75c2a5f5bc4 100644 --- a/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs +++ b/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs @@ -14,7 +14,7 @@ struct S; mod m { fn f() { - let s = crate::S; //~ ERROR undeclared type or module `crate` + let s = crate::S; //~ ERROR `crate` can only be used in absolute paths } } diff --git a/src/test/compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs b/src/test/compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs index cb587ecc854..8c5a971c2f7 100644 --- a/src/test/compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs +++ b/src/test/compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs @@ -15,7 +15,7 @@ mod m { pub struct Z; pub struct S1(crate (::m::Z)); // OK pub struct S2(::crate ::m::Z); // OK - pub struct S3(crate ::m::Z); //~ ERROR undeclared type or module `crate` + pub struct S3(crate ::m::Z); //~ ERROR `crate` can only be used in absolute paths } fn main() { diff --git a/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs b/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs index b4a650efebe..2c94f7b0f59 100644 --- a/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs +++ b/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs @@ -11,5 +11,5 @@ #![feature(crate_in_paths)] fn main() { - let crate = 0; //~ ERROR cannot find unit struct/variant or constant `crate` in this scope + let crate = 0; //~ ERROR `crate` can only be used in absolute paths } diff --git a/src/test/compile-fail/super-at-top-level.rs b/src/test/compile-fail/super-at-top-level.rs index 4db673e2006..c607711c44f 100644 --- a/src/test/compile-fail/super-at-top-level.rs +++ b/src/test/compile-fail/super-at-top-level.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use super::f; //~ ERROR unresolved import `super` [E0432] - //~^ There are too many initial `super`s. +use super::f; //~ ERROR There are too many initial `super`s fn main() { } diff --git a/src/test/compile-fail/use-super-global-path.rs b/src/test/compile-fail/use-super-global-path.rs index 24d3bccdf24..fc1a72f6f2b 100644 --- a/src/test/compile-fail/use-super-global-path.rs +++ b/src/test/compile-fail/use-super-global-path.rs @@ -14,11 +14,11 @@ struct S; struct Z; mod foo { - use ::super::{S, Z}; //~ ERROR unresolved import `super` + use ::super::{S, Z}; //~ ERROR global paths cannot start with `super` pub fn g() { - use ::super::main; //~ ERROR unresolved import `super` - main(); + use ::super::main; //~ ERROR global paths cannot start with `super` + main(); //~ ERROR cannot find function `main` in this scope } } -- cgit 1.4.1-3-g733a5