Skip to content

Commit

Permalink
Rewrite crate-types paragraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Jun 19, 2024
1 parent 70da9b2 commit 995f763
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 57 deletions.
23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"files.trimFinalNewlines": false,
"cSpell.ignoreRegExpList": [
"/fls_[a-zA-Z0-9]+/"
],
"rewrap.autoWrap.enabled": true,
"rewrap.wrappingColumn": 80,
"editor.rulers": [
80
],
"editor.parameterHints.enabled": true,
"cSpell.words": [
"Binutils",
"Debuginfo",
"dispatchable",
"subtrait",
"supertrait",
"undeduced"
],
"python.analysis.extraPaths": [
".venv/lib/python3.9/site-packages"
]
}
29 changes: 0 additions & 29 deletions src/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,35 +176,6 @@ An :t:`unsafe function` is a :t:`function` subject to :t:`keyword` ``unsafe``.
:dp:`fls_5hn8fkf7rcvz`
The invocation of an :t:`unsafe function` shall require :t:`unsafe context`.

:dp:`fls_kNdIXl86g6Du`
A :t:`function`'s :t:`name` shall not be the :t:`name` ``main`` unless it is in
a :t:`crate root module` of a :t:`crate`.

:dp:`fls_sbGnkm8Ephiu`
A :t:`main function signature` is a :t:`function signature` subject to the
following restrictions:

* :dp:`fls_o4fxok23134r`
It lacks :t:`[function qualifier]s` ``async`` and ``unsafe``,

* :dp:`fls_bk755pvc1l53`
Its :t:`ABI` is Rust,

* :dp:`fls_a3je4wc53bmo`
It lacks :t:`[generic parameter]s`,

* :dp:`fls_w8q15zp7kyl0`
It lacks :t:`[function parameter]s`,

* :dp:`fls_4psnfphsgdek`
It lacks a :t:`return type`,

* :dp:`fls_m7xfrhqif74`
It lacks a :t:`where clause`,

* :dp:`fls_qq9fzrw4aykd`
It has a :t:`function body`.

.. rubric:: Examples

.. code-block:: rust
Expand Down
29 changes: 13 additions & 16 deletions src/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,7 @@ binary crate
^^^^^^^^^^^^

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

.. _fls_or4o65fyt28y:

Expand Down Expand Up @@ -1568,6 +1566,16 @@ crate root module
A :dt:`crate root module` is the root of the nested :t:`module` tree of a
:t:`crate`.

.. _fls_lVpE4uFDsXH4:

crate type
^^^^^^^^^^

:dp:`fls_eaxsgPMFNH7f`
The :dt:`crate type` of a :t:`crate` is the value of the :t:`attribute`
``crate_type`` of a :t:`crate` or the value of ``--crate-type`` flag passed to
the tool compiling the :t:`crate`.

.. _fls_76cj65bptdpn:

dangling
Expand Down Expand Up @@ -3726,17 +3734,6 @@ lexical element
A :dt:`lexical element` is the most basic syntactic element in program
text.

.. _fls_r1sk7vdgckym:

library crate
^^^^^^^^^^^^^

:dp:`fls_3m8lg4mdc2x0`
A :dt:`library crate` is either a :t:`crate` that does not have a :t:`function`
in scope of its :t:`crate root module` under the :t:`name` ``main`` with a
:t:`main function signature` or a :t:`crate` subject to :t:`attribute`
:c:`no_main`.

.. _fls_vdhaa61g6kah:

lifetime
Expand Down Expand Up @@ -5068,7 +5065,7 @@ proc-macro crate
.. _fls_AjjdLZWiL9Tq:

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

.. _fls_sp5wdsxwmxf:

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

:dp:`fls_r36uf3y2denr`
See ``RangePattern.``
See ``RangePattern``.

.. _fls_3ls9xlgt8ei1:

Expand Down
56 changes: 44 additions & 12 deletions src/program-structure-and-compilation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,33 @@ Crates
A :t:`crate` is a unit of compilation and linking that contains a tree of
nested :t:`[module]s`.

:dp:`fls_unxalgMqIr3v`
The :t:`crate type` of a :t:`crate` is the value of the :t:`attribute`
``crate_type`` of a :t:`crate` or the value of ``--crate-type`` flag passed to
the tool compiling the :t:`crate`.

:dp:`fls_e7jGvXvTsFpC`
The :t:`crate type` of a :t:`crate` if not specified is ``bin``.

:dp:`fls_kQiJPwb2Hjcc`
A :t:`crate` may be subject to multiple :t:`[crate type]s`, treating each type
as a separate :t:`crate`.

:dp:`fls_9ub6ks8qrang`
A :t:`binary crate` is a :t:`crate` that has a :t:`function` in scope of its
:t:`crate root module` under the :t:`name` ``main`` with a :t:`main function
signature`. A tool can compile a :t:`binary crate` to an executable.
A :t:`binary crate` is a :t:`crate` whose :t:`crate type` is ``bin``.

:dp:`fls_OyFwBtDGVimT`
A :t:`binary crate` that is not subject to :t:`attribute` ``no_main`` shall have
a :t:`function` in scope of its :t:`crate root module` under the :t:`name`
``main`` with a :t:`main function signature`.

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

:dp:`fls_d9nn4yuiw1ja`
A :t:`library crate` is either a :t:`crate` that does not have a :t:`function`
in scope of its :t:`crate root module` under the :t:`name` ``main`` with a
:t:`main function signature` or a :t:`crate` subject to :t:`attribute`
:c:`no_main`. A tool is free to compile a :t:`library crate` to a shared
library.

:dp:`fls_Mf62VqAhoZ3c`
A :t:`proc-macro crate` is a :t:`crate` that contains :t:`[procedural macro]s`.
A tool is free to compile a :t:`proc-macro crate` to a shared library.
A :t:`proc-macro crate` is a :t:`crate` whose :t:`crate type` is ``proc-macro``.

:dp:`fls_RJJmN4tP7j4m`
A :t:`proc-macro crate` shall not declare :t:`[item]s` in its :t:`crate root
Expand Down Expand Up @@ -244,3 +251,28 @@ Program Entry Point
:dp:`fls_dp64b08em9BJ`
A :t:`program entry point` is a :t:`function` that is invoked at the start of
a Rust program.

:dp:`fls_sbGnkm8Ephiu`
A :t:`main function signature` is a :t:`function signature` subject to the
following restrictions:

* :dp:`fls_o4fxok23134r`
It lacks :t:`[function qualifier]s` ``async`` and ``unsafe``,

* :dp:`fls_bk755pvc1l53`
Its :t:`ABI` is Rust,

* :dp:`fls_a3je4wc53bmo`
It lacks :t:`[generic parameter]s`,

* :dp:`fls_w8q15zp7kyl0`
It lacks :t:`[function parameter]s`,

* :dp:`fls_4psnfphsgdek`
It lacks a :t:`return type`,

* :dp:`fls_m7xfrhqif74`
It lacks a :t:`where clause`,

* :dp:`fls_qq9fzrw4aykd`
It has a :t:`function body`.

0 comments on commit 995f763

Please sign in to comment.