@@ -802,8 +802,9 @@ Crates contain [items](#items), each of which may have some number of
802
802
## Items
803
803
804
804
``` {.ebnf .gram}
805
- item : mod_item | fn_item | type_item | struct_item | enum_item
806
- | static_item | trait_item | impl_item | extern_block ;
805
+ item : extern_crate_decl | use_decl | mod_item | fn_item | type_item
806
+ | struct_item | enum_item | static_item | trait_item | impl_item
807
+ | extern_block ;
807
808
```
808
809
809
810
An _ item_ is a component of a crate; some module items can be defined in crate
@@ -817,6 +818,8 @@ execution, and may reside in read-only memory.
817
818
818
819
There are several kinds of item:
819
820
821
+ * [ ` extern crate ` declarations] ( #extern-crate-declarations )
822
+ * [ ` use ` declarations] ( #use-declarations )
820
823
* [ modules] ( #modules )
821
824
* [ functions] ( #functions )
822
825
* [ type definitions] ( #type-definitions )
@@ -853,13 +856,10 @@ no notion of type abstraction: there are no first-class "forall" types.
853
856
854
857
``` {.ebnf .gram}
855
858
mod_item : "mod" ident ( ';' | '{' mod '}' );
856
- mod : [ view_item | item ] * ;
859
+ mod : item * ;
857
860
```
858
861
859
- A module is a container for zero or more [ view items] ( #view-items ) and zero or
860
- more [ items] ( #items ) . The view items manage the visibility of the items defined
861
- within the module, as well as the visibility of names from outside the module
862
- when referenced from inside the module.
862
+ A module is a container for zero or more [ items] ( #items ) .
863
863
864
864
A _ module item_ is a module, surrounded in braces, named, and prefixed with the
865
865
keyword ` mod ` . A module item introduces a new, named module into the tree of
@@ -917,19 +917,6 @@ mod thread {
917
917
}
918
918
```
919
919
920
- #### View items
921
-
922
- ``` {.ebnf .gram}
923
- view_item : extern_crate_decl | use_decl ;
924
- ```
925
-
926
- A view item manages the namespace of a module. View items do not define new
927
- items, but rather, simply change other items' visibility. There are two
928
- kinds of view items:
929
-
930
- * [ ` extern crate ` declarations] ( #extern-crate-declarations )
931
- * [ ` use ` declarations] ( #use-declarations )
932
-
933
920
##### Extern crate declarations
934
921
935
922
``` {.ebnf .gram}
@@ -2854,13 +2841,12 @@ Point3d {y: 0, z: 10, .. base};
2854
2841
### Block expressions
2855
2842
2856
2843
``` {.ebnf .gram}
2857
- block_expr : '{' [ view_item ] *
2858
- [ stmt ';' | item ] *
2844
+ block_expr : '{' [ stmt ';' | item ] *
2859
2845
[ expr ] '}' ;
2860
2846
```
2861
2847
2862
2848
A _ block expression_ is similar to a module in terms of the declarations that
2863
- are possible. Each block conceptually introduces a new namespace scope. View
2849
+ are possible. Each block conceptually introduces a new namespace scope. Use
2864
2850
items can bring new names into scopes and declared items are in scope for only
2865
2851
the block itself.
2866
2852
0 commit comments