Report special messages for path segment keywords in wrong positions

This commit is contained in:
Vadim Petrochenkov 2017-11-19 17:05:29 +03:00
parent 2e9b89ddc5
commit 90f5cfdfbd
8 changed files with 47 additions and 18 deletions

View file

@ -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
}
}

View file

@ -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
}
}

View file

@ -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() {

View file

@ -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
}

View file

@ -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() {
}

View file

@ -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
}
}