Skip to content

Commit aa5bfef

Browse files
committed
Add test for middle self
1 parent e96eb6d commit aa5bfef

3 files changed

Lines changed: 68 additions & 2 deletions

File tree

tests/ui/use/use-self-at-end.e2015.stderr

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,30 @@ error[E0432]: unresolved import `super::Struct`
192192
LL | pub use super::Struct::{self};
193193
| ^^^^^^ `Struct` is a struct, not a module
194194

195+
error[E0433]: `self` in paths can only be used in start position or last position
196+
--> $DIR/use-self-at-end.rs:83:24
197+
|
198+
LL | pub use super::self::y::z;
199+
| ^^^^ can only be used in path start position or last position
200+
201+
error[E0433]: `self` in paths can only be used in start position or last position
202+
--> $DIR/use-self-at-end.rs:84:24
203+
|
204+
LL | pub use super::self::y::z as z3;
205+
| ^^^^ can only be used in path start position or last position
206+
207+
error[E0433]: `self` in paths can only be used in start position or last position
208+
--> $DIR/use-self-at-end.rs:85:24
209+
|
210+
LL | pub use super::self::y::{z};
211+
| ^^^^ can only be used in path start position or last position
212+
213+
error[E0433]: `self` in paths can only be used in start position or last position
214+
--> $DIR/use-self-at-end.rs:86:24
215+
|
216+
LL | pub use super::self::y::{z as z4};
217+
| ^^^^ can only be used in path start position or last position
218+
195219
error[E0432]: unresolved import `super::Struct`
196220
--> $DIR/use-self-at-end.rs:66:24
197221
|
@@ -204,6 +228,12 @@ error[E0433]: `self` in paths can only be used in start position or last positio
204228
LL | type G = z::self::self;
205229
| ^^^^ can only be used in path start position or last position
206230

231+
error[E0433]: `self` in paths can only be used in start position or last position
232+
--> $DIR/use-self-at-end.rs:82:25
233+
|
234+
LL | type K = super::self::y::z;
235+
| ^^^^ can only be used in path start position or last position
236+
207237
error[E0573]: expected type, found module `crate::self`
208238
--> $DIR/use-self-at-end.rs:13:18
209239
|
@@ -266,7 +296,7 @@ help: if this is a dyn-compatible trait, use `dyn`
266296
LL | type J = dyn super::Trait::self;
267297
| +++
268298

269-
error: aborting due to 29 previous errors; 1 warning emitted
299+
error: aborting due to 34 previous errors; 1 warning emitted
270300

271301
Some errors have detailed explanations: E0223, E0252, E0432, E0433, E0573.
272302
For more information about an error, try `rustc --explain E0223`.

tests/ui/use/use-self-at-end.e2018.stderr

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,30 @@ error[E0432]: unresolved import `super::Struct`
194194
LL | pub use super::Struct::{self};
195195
| ^^^^^^ `Struct` is a struct, not a module
196196

197+
error[E0433]: `self` in paths can only be used in start position or last position
198+
--> $DIR/use-self-at-end.rs:83:24
199+
|
200+
LL | pub use super::self::y::z;
201+
| ^^^^ can only be used in path start position or last position
202+
203+
error[E0433]: `self` in paths can only be used in start position or last position
204+
--> $DIR/use-self-at-end.rs:84:24
205+
|
206+
LL | pub use super::self::y::z as z3;
207+
| ^^^^ can only be used in path start position or last position
208+
209+
error[E0433]: `self` in paths can only be used in start position or last position
210+
--> $DIR/use-self-at-end.rs:85:24
211+
|
212+
LL | pub use super::self::y::{z};
213+
| ^^^^ can only be used in path start position or last position
214+
215+
error[E0433]: `self` in paths can only be used in start position or last position
216+
--> $DIR/use-self-at-end.rs:86:24
217+
|
218+
LL | pub use super::self::y::{z as z4};
219+
| ^^^^ can only be used in path start position or last position
220+
197221
error[E0432]: unresolved import `super::Struct`
198222
--> $DIR/use-self-at-end.rs:66:24
199223
|
@@ -206,6 +230,12 @@ error[E0433]: `self` in paths can only be used in start position or last positio
206230
LL | type G = z::self::self;
207231
| ^^^^ can only be used in path start position or last position
208232

233+
error[E0433]: `self` in paths can only be used in start position or last position
234+
--> $DIR/use-self-at-end.rs:82:25
235+
|
236+
LL | type K = super::self::y::z;
237+
| ^^^^ can only be used in path start position or last position
238+
209239
error[E0573]: expected type, found module `crate::self`
210240
--> $DIR/use-self-at-end.rs:13:18
211241
|
@@ -268,7 +298,7 @@ error[E0433]: global paths cannot start with `self`
268298
LL | type F = ::self;
269299
| ^^^^ cannot start with this
270300

271-
error: aborting due to 31 previous errors; 1 warning emitted
301+
error: aborting due to 36 previous errors; 1 warning emitted
272302

273303
Some errors have detailed explanations: E0223, E0252, E0432, E0433, E0573.
274304
For more information about an error, try `rustc --explain E0223`.

tests/ui/use/use-self-at-end.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ pub mod x {
7878
pub use super::Trait::self as Trait1;
7979
pub use super::Trait::{self}; //~ ERROR the name `Trait` is defined multiple times
8080
pub use super::Trait::{self as Trait2};
81+
82+
type K = super::self::y::z; //~ ERROR `self` in paths can only be used in start position or last position
83+
pub use super::self::y::z; //~ ERROR `self` in paths can only be used in start position or last position
84+
pub use super::self::y::z as z3; //~ ERROR `self` in paths can only be used in start position or last position
85+
pub use super::self::y::{z}; //~ ERROR `self` in paths can only be used in start position or last position
86+
pub use super::self::y::{z as z4}; //~ ERROR `self` in paths can only be used in start position or last position
8187
}
8288
}
8389

0 commit comments

Comments
 (0)