Commit 32d9e2c
committed
Clarify that
The `self` keyword in a use brace (e.g., `use m::{self}`) creates a
binding for the parent entity. The note in `items.use.self.intro`
says that `self` "means the current module of the parent segment", but
there's no rule restricting what the parent can be.
The parent path must resolve to a module, enumeration, or trait --
i.e., entities that act as modules for name resolution. Using `self`
with other entities such as structs or unions is rejected by the
compiler (as of rust-lang/rust#152996).
Let's add a rule to make this restriction explicit.{self} imports require a module parent1 parent d2715c0 commit 32d9e2c
1 file changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
206 | 226 | | |
207 | 227 | | |
208 | 228 | | |
| |||
433 | 453 | | |
434 | 454 | | |
435 | 455 | | |
| 456 | + | |
436 | 457 | | |
437 | 458 | | |
438 | 459 | | |
| 460 | + | |
439 | 461 | | |
440 | 462 | | |
441 | 463 | | |
| |||
444 | 466 | | |
445 | 467 | | |
446 | 468 | | |
| 469 | + | |
447 | 470 | | |
448 | 471 | | |
449 | 472 | | |
450 | 473 | | |
451 | 474 | | |
| 475 | + | |
452 | 476 | | |
453 | 477 | | |
0 commit comments