Skip to content

Commit 597689d

Browse files
committed
Rewrite crate-types paragraphs
1 parent 70da9b2 commit 597689d

File tree

3 files changed

+57
-57
lines changed

3 files changed

+57
-57
lines changed

src/functions.rst

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -176,35 +176,6 @@ An :t:`unsafe function` is a :t:`function` subject to :t:`keyword` ``unsafe``.
176176
:dp:`fls_5hn8fkf7rcvz`
177177
The invocation of an :t:`unsafe function` shall require :t:`unsafe context`.
178178

179-
:dp:`fls_kNdIXl86g6Du`
180-
A :t:`function`'s :t:`name` shall not be the :t:`name` ``main`` unless it is in
181-
a :t:`crate root module` of a :t:`crate`.
182-
183-
:dp:`fls_sbGnkm8Ephiu`
184-
A :t:`main function signature` is a :t:`function signature` subject to the
185-
following restrictions:
186-
187-
* :dp:`fls_o4fxok23134r`
188-
It lacks :t:`[function qualifier]s` ``async`` and ``unsafe``,
189-
190-
* :dp:`fls_bk755pvc1l53`
191-
Its :t:`ABI` is Rust,
192-
193-
* :dp:`fls_a3je4wc53bmo`
194-
It lacks :t:`[generic parameter]s`,
195-
196-
* :dp:`fls_w8q15zp7kyl0`
197-
It lacks :t:`[function parameter]s`,
198-
199-
* :dp:`fls_4psnfphsgdek`
200-
It lacks a :t:`return type`,
201-
202-
* :dp:`fls_m7xfrhqif74`
203-
It lacks a :t:`where clause`,
204-
205-
* :dp:`fls_qq9fzrw4aykd`
206-
It has a :t:`function body`.
207-
208179
.. rubric:: Examples
209180

210181
.. code-block:: rust

src/glossary.rst

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,7 @@ binary crate
655655
^^^^^^^^^^^^
656656

657657
:dp:`fls_8gfe7hajxkd7`
658-
A :dt:`binary crate` is a :t:`crate` that has a :t:`function` in scope of its
659-
:t:`crate root module` under the :t:`name` ``main`` with a :t:`main function
660-
signature`.
658+
A :dt:`binary crate` is a :t:`crate` whose :t:`crate type` is ``bin``.
661659

662660
.. _fls_or4o65fyt28y:
663661

@@ -1568,6 +1566,16 @@ crate root module
15681566
A :dt:`crate root module` is the root of the nested :t:`module` tree of a
15691567
:t:`crate`.
15701568

1569+
.. _fls_lVpE4uFDsXH4:
1570+
1571+
crate type
1572+
^^^^^^^^^^
1573+
1574+
:dp:`fls_eaxsgPMFNH7f`
1575+
The :dt:`crate type` of a :t:`crate` is the value of the :t:`attribute`
1576+
``crate_type`` of a :t:`crate` or the value of ``--crate-type`` flag passed to
1577+
the tool compiling the :t:`crate`.
1578+
15711579
.. _fls_76cj65bptdpn:
15721580

15731581
dangling
@@ -3726,17 +3734,6 @@ lexical element
37263734
A :dt:`lexical element` is the most basic syntactic element in program
37273735
text.
37283736

3729-
.. _fls_r1sk7vdgckym:
3730-
3731-
library crate
3732-
^^^^^^^^^^^^^
3733-
3734-
:dp:`fls_3m8lg4mdc2x0`
3735-
A :dt:`library crate` is either a :t:`crate` that does not have a :t:`function`
3736-
in scope of its :t:`crate root module` under the :t:`name` ``main`` with a
3737-
:t:`main function signature` or a :t:`crate` subject to :t:`attribute`
3738-
:c:`no_main`.
3739-
37403737
.. _fls_vdhaa61g6kah:
37413738

37423739
lifetime
@@ -5068,7 +5065,7 @@ proc-macro crate
50685065
.. _fls_AjjdLZWiL9Tq:
50695066

50705067
:dp:`fls_DfTszT1PjV7o`
5071-
A :dt:`proc-macro crate` is a :t:`crate` that contains :t:`[procedural macro]s`.
5068+
A :t:`proc-macro crate` is a :t:`crate` whose :t:`crate type` is ``proc-macro``.
50725069

50735070
.. _fls_sp5wdsxwmxf:
50745071

@@ -5210,7 +5207,7 @@ A :dt:`range pattern` is a :t:`pattern` that matches :t:`[value]s` which fall
52105207
within a range.
52115208

52125209
:dp:`fls_r36uf3y2denr`
5213-
See ``RangePattern.``
5210+
See ``RangePattern``.
52145211

52155212
.. _fls_3ls9xlgt8ei1:
52165213

src/program-structure-and-compilation.rst

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,33 @@ Crates
113113
A :t:`crate` is a unit of compilation and linking that contains a tree of
114114
nested :t:`[module]s`.
115115

116+
:dp:`fls_unxalgMqIr3v`
117+
The :t:`crate type` of a :t:`crate` is the value of the :t:`attribute`
118+
``crate_type`` of a :t:`crate` or the value of ``--crate-type`` flag passed to
119+
the tool compiling the :t:`crate`.
120+
121+
:dp:`fls_e7jGvXvTsFpC`
122+
The :t:`crate type` of a :t:`crate` if not specified is ``bin``.
123+
124+
:dp:`fls_kQiJPwb2Hjcc`
125+
A :t:`crate` may be subject to multiple :t:`[crate type]s`, treating each type
126+
as a separate :t:`crate`.
127+
116128
:dp:`fls_9ub6ks8qrang`
117-
A :t:`binary crate` is a :t:`crate` that has a :t:`function` in scope of its
118-
:t:`crate root module` under the :t:`name` ``main`` with a :t:`main function
119-
signature`. A tool can compile a :t:`binary crate` to an executable.
129+
A :t:`binary crate` is a :t:`crate` whose :t:`crate type` is ``bin``.
130+
131+
:dp:`fls_OyFwBtDGVimT`
132+
A :t:`binary crate` that is not subject to :t:`attribute` ``no_main`` shall have
133+
a :t:`function` in scope of its :t:`crate root module` under the :t:`name`
134+
``main`` with a :t:`main function signature`.
120135

121136
:dp:`fls_jQqXxPyND1ds`
122137
The :t:`function` in scope of a :t:`binary crate`'s :t:`crate root module` under
123138
the :t:`name` ``main`` with a :t:`main function signature` is the :t:`binary
124139
crate`'s :t:`program entry point`.
125140

126-
:dp:`fls_d9nn4yuiw1ja`
127-
A :t:`library crate` is either a :t:`crate` that does not have a :t:`function`
128-
in scope of its :t:`crate root module` under the :t:`name` ``main`` with a
129-
:t:`main function signature` or a :t:`crate` subject to :t:`attribute`
130-
:c:`no_main`. A tool is free to compile a :t:`library crate` to a shared
131-
library.
132-
133141
:dp:`fls_Mf62VqAhoZ3c`
134-
A :t:`proc-macro crate` is a :t:`crate` that contains :t:`[procedural macro]s`.
135-
A tool is free to compile a :t:`proc-macro crate` to a shared library.
142+
A :t:`proc-macro crate` is a :t:`crate` whose :t:`crate type` is ``proc-macro``.
136143

137144
:dp:`fls_RJJmN4tP7j4m`
138145
A :t:`proc-macro crate` shall not declare :t:`[item]s` in its :t:`crate root
@@ -244,3 +251,28 @@ Program Entry Point
244251
:dp:`fls_dp64b08em9BJ`
245252
A :t:`program entry point` is a :t:`function` that is invoked at the start of
246253
a Rust program.
254+
255+
:dp:`fls_sbGnkm8Ephiu`
256+
A :t:`main function signature` is a :t:`function signature` subject to the
257+
following restrictions:
258+
259+
* :dp:`fls_o4fxok23134r`
260+
It lacks :t:`[function qualifier]s` ``async`` and ``unsafe``,
261+
262+
* :dp:`fls_bk755pvc1l53`
263+
Its :t:`ABI` is Rust,
264+
265+
* :dp:`fls_a3je4wc53bmo`
266+
It lacks :t:`[generic parameter]s`,
267+
268+
* :dp:`fls_w8q15zp7kyl0`
269+
It lacks :t:`[function parameter]s`,
270+
271+
* :dp:`fls_4psnfphsgdek`
272+
It lacks a :t:`return type`,
273+
274+
* :dp:`fls_m7xfrhqif74`
275+
It lacks a :t:`where clause`,
276+
277+
* :dp:`fls_qq9fzrw4aykd`
278+
It has a :t:`function body`.

0 commit comments

Comments
 (0)