7
7
# Summary
8
8
9
9
- Lift the hard ordering restriction between ` extern crate ` , ` use ` and other items.
10
- - Optionally keep the order restriction as convention with a warn-per-default lint
11
10
- Allow ` pub extern crate ` as opposed to only private ones.
12
11
- Allow ` extern crate ` in blocks/functions, and not just in modules.
13
12
@@ -59,7 +58,7 @@ Another use case are item macros/attributes that want to automatically include t
59
58
This is possible by having the macro expand to an item that links to the needed crate, eg like this:
60
59
61
60
``` rust
62
- #[MyAttribute ]
61
+ #[my_attribute ]
63
62
struct UserType ;
64
63
```
65
64
@@ -75,12 +74,6 @@ With the order restriction still in place, this requires the sub module workarou
75
74
76
75
As an example, [gfx- rs](https: // github.com/gfx-rs/gfx-rs) currently employs this strategy.
77
76
78
- ## Optionally keeping the order restriction as convention with a warn- per- default lint
79
-
80
- It is still useful for developers to know that imports and extern crates are written in certain places,
81
- so it could get weakly enforced with a warn- per- default lint. Macro authors or other users can then simply
82
- disable the lint with an attribute if the need arises.
83
-
84
77
## Allow `pub extern crate ` as opposed to only private ones.
85
78
86
79
`extern crate ` semantically is somewhere between `use `ing a module, and declaring one with `mod `,
@@ -153,9 +146,6 @@ However, as alluded to above it might be a good idea for 1.0 regardless
153
146
- If necessary, change resolve to look in the whole scope block for view items, not just in a prefix of it.
154
147
- Make ` pub extern crate ` parse and teach privacy about it
155
148
- Allow ` extern crate ` view items in blocks
156
- - Optionally implement a warn-per-default lint that checks for each item that it is ordered correctly.
157
- Give it a more useful error message like "Convention is to put all imports at the start of the block"
158
- rather than the often confusing "View items need to precede items".
159
149
160
150
# Drawbacks
161
151
0 commit comments