@@ -8,9 +8,6 @@ Make name and behavior of the `#![no_std]` and `#![no_implicit_prelude]` attribu
8
8
consistent by renaming the latter to ` #![no_prelude] ` and having it only apply to the current
9
9
module.
10
10
11
- Optionally add a ` #[deep(...)] ` attribute for deeply applying an attribute to each module as
12
- composable replacement for the old behavior.
13
-
14
11
# Motivation
15
12
16
13
Currently, Rust automatically inserts an implicit ` extern crate std; ` in the crate root that can be
@@ -52,12 +49,9 @@ mod my_iter {
52
49
While such use cases might be resolved by just requiring an explicit ` use std::prelude::*; `
53
50
in the submodules, it seems like just making the attribute behave as expected is the better outcome.
54
51
55
- However, for the cases where you want the prelude disabled for a whole sub tree of modules, it would
56
- become necessary to add a ` #[no_prelude] ` attribute for each module in it.
57
-
58
- And if the use case of deeply removing the prelude imports is still important enough to support,
59
- it could be better resolved by providing a general ` #[deep(...)] ` attribute, that just replicates an
60
- given attribute recursively, making the old behavior recoverable as ` #[deep(no_prelude)] ` .
52
+ Of course, for the cases where you want the prelude disabled for a whole sub tree of modules, it
53
+ would now become necessary to add a ` #[no_prelude] ` attribute in each of them - but that
54
+ is consistent with imports in general.
61
55
62
56
# Detailed design
63
57
@@ -71,11 +65,6 @@ changed to `#[no_prelude]` in both the main code base, and user code.
71
65
72
66
Finally, the old attribute name should emit a deprecated warning, and be removed in time.
73
67
74
- If ` #[deep(...)] ` ends up being implemented, it would be added to syntax as an item modifier
75
- for module items that first expands the module it is applied too, and then recursively inserts the
76
- passed ` #[...] ` attribute into each module AST node it contains. (This could probably live on
77
- crates.io, though)
78
-
79
68
# Drawbacks
80
69
81
70
- The attribute is a rare use case to begin with, so any effort put into this would
@@ -85,8 +74,5 @@ crates.io, though)
85
74
86
75
- Keep the current behavior
87
76
- Remove the ` #[no_implicit_prelude] ` attribute all together, instead forcing users to use
88
- ` #[no_std] ` in combination with ` extern crate std; ` and ` use std::prelude::* `
89
-
90
- # Unresolved questions
91
-
92
- Should the ` #[deep(...)] ` be included or not?
77
+ ` #[no_std] ` in combination with ` extern crate std; ` and ` use std::prelude::* ` .
78
+ - Generalize preludes more to allow custom ones, which might superseed the attributes from this RFC.
0 commit comments