@@ -803,8 +803,9 @@ Crates contain [items](#items), each of which may have some number of
803
803
## Items
804
804
805
805
``` {.ebnf .gram}
806
- item : mod_item | fn_item | type_item | struct_item | enum_item
807
- | static_item | trait_item | impl_item | extern_block ;
806
+ item : extern_crate_decl | use_decl | mod_item | fn_item | type_item
807
+ | struct_item | enum_item | static_item | trait_item | impl_item
808
+ | extern_block ;
808
809
```
809
810
810
811
An _ item_ is a component of a crate; some module items can be defined in crate
@@ -818,6 +819,8 @@ execution, and may reside in read-only memory.
818
819
819
820
There are several kinds of item:
820
821
822
+ * [ ` extern crate ` declarations] ( #extern-crate-declarations )
823
+ * [ ` use ` declarations] ( #use-declarations )
821
824
* [ modules] ( #modules )
822
825
* [ functions] ( #functions )
823
826
* [ type definitions] ( #type-definitions )
@@ -854,13 +857,10 @@ no notion of type abstraction: there are no first-class "forall" types.
854
857
855
858
``` {.ebnf .gram}
856
859
mod_item : "mod" ident ( ';' | '{' mod '}' );
857
- mod : [ view_item | item ] * ;
860
+ mod : item * ;
858
861
```
859
862
860
- A module is a container for zero or more [ view items] ( #view-items ) and zero or
861
- more [ items] ( #items ) . The view items manage the visibility of the items defined
862
- within the module, as well as the visibility of names from outside the module
863
- when referenced from inside the module.
863
+ A module is a container for zero or more [ items] ( #items ) .
864
864
865
865
A _ module item_ is a module, surrounded in braces, named, and prefixed with the
866
866
keyword ` mod ` . A module item introduces a new, named module into the tree of
@@ -918,19 +918,6 @@ mod thread {
918
918
}
919
919
```
920
920
921
- #### View items
922
-
923
- ``` {.ebnf .gram}
924
- view_item : extern_crate_decl | use_decl ;
925
- ```
926
-
927
- A view item manages the namespace of a module. View items do not define new
928
- items, but rather, simply change other items' visibility. There are two
929
- kinds of view items:
930
-
931
- * [ ` extern crate ` declarations] ( #extern-crate-declarations )
932
- * [ ` use ` declarations] ( #use-declarations )
933
-
934
921
##### Extern crate declarations
935
922
936
923
``` {.ebnf .gram}
@@ -2891,13 +2878,12 @@ Point3d {y: 0, z: 10, .. base};
2891
2878
### Block expressions
2892
2879
2893
2880
``` {.ebnf .gram}
2894
- block_expr : '{' [ view_item ] *
2895
- [ stmt ';' | item ] *
2881
+ block_expr : '{' [ stmt ';' | item ] *
2896
2882
[ expr ] '}' ;
2897
2883
```
2898
2884
2899
2885
A _ block expression_ is similar to a module in terms of the declarations that
2900
- are possible. Each block conceptually introduces a new namespace scope. View
2886
+ are possible. Each block conceptually introduces a new namespace scope. Use
2901
2887
items can bring new names into scopes and declared items are in scope for only
2902
2888
the block itself.
2903
2889
0 commit comments