Lines Matching full:code
6 This document describes how to write Rust code in the kernel.
12 The code should be formatted using ``rustfmt``. In this way, a person
39 even work with broken code.
48 .. code-block:: rust
60 .. code-block:: rust
82 .. code-block:: rust
97 .. code-block:: rust
109 a hard rule. There is also code that is not migrated to this style yet, but
110 please do not introduce code in other styles.
120 "Normal" comments (i.e. ``//``, rather than code documentation which starts
126 .. code-block:: rust
135 .. code-block:: rust
148 .. code-block:: rust
169 .. code-block:: rust
176 before every ``unsafe`` block, and they explain why the code inside the block is
179 .. code-block:: rust
185 in code documentation. ``# Safety`` sections specify the contract that callers
192 Code documentation
195 Rust kernel code is not documented like C kernel code (i.e. via kernel-doc).
196 Instead, the usual system for documenting Rust code is used: the ``rustdoc``
206 .. code-block:: rust
255 describing why the code inside is sound.
270 .. code-block:: rust
276 .. code-block:: rust
284 Rust kernel code refers to C types, such as ``int``, using type aliases such as
291 .. code-block:: rust
301 Rust kernel code follows the usual Rust naming conventions:
315 .. code-block:: c
322 .. code-block:: rust
346 .. code-block:: c
359 .. code-block:: rust
374 .. code-block:: rust
412 - Inside macros, when the different invocations may create expanded code that
415 - When code may trigger a warning for some architectures but not others, such
420 .. code-block:: rust
429 Here, function ``g()`` is dead code if ``CONFIG_X`` is not set. Can we use
432 .. code-block:: rust
442 This would emit a lint if ``CONFIG_X`` is set, since it is not dead code in that
447 .. code-block:: rust
459 .. code-block:: rust
470 (e.g. unconditionally), then it would be spotted that it is not dead code