diff options
| author | Alex Ozdemir <aozdemir@hmc.edu> | 2017-05-17 20:29:58 -0700 |
|---|---|---|
| committer | Alex Ozdemir <aozdemir@hmc.edu> | 2017-06-15 08:21:17 -0700 |
| commit | a82890e67ba01057b95d7e2f910ae91226505a87 (patch) | |
| tree | 074cc431da6d4f2c133dd4d836174e90477260b8 /src/test/compile-fail/enum-and-module-in-same-scope.rs | |
| parent | 258ae6dd9b1a8ac97986852fc9f00f7687004ccb (diff) | |
| download | rust-a82890e67ba01057b95d7e2f910ae91226505a87.tar.gz rust-a82890e67ba01057b95d7e2f910ae91226505a87.zip | |
Clearer Error Message for Duplicate Definition
Clearer use of the error message and span labels to communicate
duplicaiton defitions/imports.
New error format:
```
error[E0428]: the name `Foo` is defined twice
--> example.rs:2:1
|
1 | trait Foo { }
| ------------- previous definition of the trait `Foo` here
2 | struct Foo { }
| ^^^^^^^^^^^^^^ `Foo` redefined here
= note: `Foo` must be defined only once in the type namespace of this module
error: aborting due to previous error
```
Diffstat (limited to 'src/test/compile-fail/enum-and-module-in-same-scope.rs')
| -rw-r--r-- | src/test/compile-fail/enum-and-module-in-same-scope.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/compile-fail/enum-and-module-in-same-scope.rs b/src/test/compile-fail/enum-and-module-in-same-scope.rs index 527ac7505a6..59b4d715c2d 100644 --- a/src/test/compile-fail/enum-and-module-in-same-scope.rs +++ b/src/test/compile-fail/enum-and-module-in-same-scope.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum Foo { //~ NOTE previous definition of `Foo` here +enum Foo { //~ NOTE previous definition of the type `Foo` here X } -mod Foo { //~ ERROR a type named `Foo` has already been defined - //~| NOTE already defined +mod Foo { //~ ERROR the name `Foo` is defined multiple times + //~| NOTE `Foo` redefined here + //~| NOTE `Foo` must be defined only once in the type namespace of this module pub static X: isize = 42; fn f() { f() } // Check that this does not result in a resolution error } |
