manage cases with tabs or other whitespaces
This commit is contained in:
parent
4520b305ec
commit
9eacd68a49
13 changed files with 204 additions and 29 deletions
22
src/test/ui/issues/issue-45829/import-self.rs
Normal file
22
src/test/ui/issues/issue-45829/import-self.rs
Normal file
|
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
mod foo {
|
||||
pub struct A;
|
||||
pub struct B;
|
||||
}
|
||||
|
||||
use foo::{self};
|
||||
|
||||
use foo as self;
|
||||
|
||||
use foo::self;
|
||||
|
||||
fn main() {}
|
||||
31
src/test/ui/issues/issue-45829/import-self.stderr
Normal file
31
src/test/ui/issues/issue-45829/import-self.stderr
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
error: expected identifier, found keyword `self`
|
||||
--> $DIR/import-self.rs:18:12
|
||||
|
|
||||
LL | use foo as self;
|
||||
| ^^^^ expected identifier, found keyword
|
||||
|
||||
error[E0429]: `self` imports are only allowed within a { } list
|
||||
--> $DIR/import-self.rs:20:5
|
||||
|
|
||||
LL | use foo::self;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0255]: the name `foo` is defined multiple times
|
||||
--> $DIR/import-self.rs:16:11
|
||||
|
|
||||
LL | mod foo {
|
||||
| ------- previous definition of the module `foo` here
|
||||
...
|
||||
LL | use foo::{self};
|
||||
| ^^^^ `foo` reimported here
|
||||
|
|
||||
= note: `foo` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::{self as other_foo};
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors occurred: E0255, E0429.
|
||||
For more information about an error, try `rustc --explain E0255`.
|
||||
18
src/test/ui/issues/issue-45829/import-twice.rs
Normal file
18
src/test/ui/issues/issue-45829/import-twice.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
mod foo {
|
||||
pub struct A;
|
||||
pub struct B;
|
||||
}
|
||||
|
||||
use foo::{A, A};
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/import-twice.stderr
Normal file
17
src/test/ui/issues/issue-45829/import-twice.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0252]: the name `A` is defined multiple times
|
||||
--> $DIR/import-twice.rs:16:14
|
||||
|
|
||||
LL | use foo::{A, A};
|
||||
| - ^ `A` reimported here
|
||||
| |
|
||||
| previous import of the type `A` here
|
||||
|
|
||||
= note: `A` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::{A, A as OtherA};
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0252`.
|
||||
17
src/test/ui/issues/issue-45829/rename-extern-with-tab.rs
Normal file
17
src/test/ui/issues/issue-45829/rename-extern-with-tab.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// aux-build:issue_45829_a.rs
|
||||
// aux-build:issue_45829_b.rs
|
||||
|
||||
extern crate issue_45829_a;
|
||||
extern crate issue_45829_b as issue_45829_a;
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/rename-extern-with-tab.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename-extern-with-tab.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0259]: the name `issue_45829_a` is defined multiple times
|
||||
--> $DIR/rename-extern-with-tab.rs:15:1
|
||||
|
|
||||
LL | extern crate issue_45829_a;
|
||||
| --------------------------- previous import of the extern crate `issue_45829_a` here
|
||||
LL | extern crate issue_45829_b as issue_45829_a;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `issue_45829_a` reimported here
|
||||
|
|
||||
= note: `issue_45829_a` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate issue_45829_b as other_issue_45829_a;
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0259`.
|
||||
21
src/test/ui/issues/issue-45829/rename-use-with-tabs.rs
Normal file
21
src/test/ui/issues/issue-45829/rename-use-with-tabs.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
mod foo {
|
||||
pub struct A;
|
||||
|
||||
pub mod bar {
|
||||
pub struct B;
|
||||
}
|
||||
}
|
||||
|
||||
use foo::{A, bar::B as A};
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/rename-use-with-tabs.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename-use-with-tabs.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0252]: the name `A` is defined multiple times
|
||||
--> $DIR/rename-use-with-tabs.rs:19:14
|
||||
|
|
||||
LL | use foo::{A, bar::B as A};
|
||||
| - ^^^^^^^^^^^^^^^^^ `A` reimported here
|
||||
| |
|
||||
| previous import of the type `A` here
|
||||
|
|
||||
= note: `A` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::{A, bar::B as OtherA};
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0252`.
|
||||
|
|
@ -5,10 +5,6 @@ LL | mod std {} //~ ERROR the name `std` is defined multiple times
|
|||
| ^^^^^^^ `std` redefined here
|
||||
|
|
||||
= note: `std` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | as other_std// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue