Coding Standards
A coding standard that isn’t checked is a wish, so each rule below names what enforces it. The rules differ between the runtime, the compiler, and the code the compiler generates. The runtime and the generated code ship inside the customer’s binary, while the compiler only produces source code for the customer’s build.
slint-sc Runtime
Section titled “slint-sc Runtime”| Rule | Enforced by |
|---|---|
| No unsafe code. | #![forbid(unsafe_code)] at the crate root. forbid can’t be lifted by an inner allow, so the build fails if any unsafe appears anywhere in the crate. |
| Every public item is documented. | #![forbid(missing_docs)] at the crate root. |
No standard library, no alloc, no dependencies. | The crate declares #![no_std] and has no [dependencies] section, so there’s nothing to pull either in. |
| No clippy warnings. | CI runs cargo clippy over the workspace with -D warnings, so a warning fails the build. |
| No shadowing of names. | #![forbid(clippy::shadow_same, clippy::shadow_reuse, clippy::shadow_unrelated)] at the crate root, checked by the CI clippy run. |
| No panicking calls. | clippy’s unwrap_used, expect_used, panic, unreachable, todo, and unimplemented lints, forbidden at the crate root outside the unit tests and checked by the CI clippy run. |
No ? operator. | clippy’s question_mark_used lint, forbidden the same way. |
Design Principles
Section titled “Design Principles”Addresses ISO 26262-6 8.4.5, Table 6 (Norm Mapping)
ISO 26262-6 Table 6 lists design principles for software units. The runtime applies each principle the table recommends at ASIL B.
| Principle | ASIL B | How the runtime applies it |
|---|---|---|
| 1a One entry and one exit point | ++ | Functions generally return at their end. Any early returns with RAII cleanup (Drop) meet the intent. The runtime doesn’t use ?. |
| 1b No dynamic objects or variables | ++ | The runtime doesn’t use alloc; see the rules above. |
| 1c Initialization of variables | ++ | The Rust compiler rejects reading a variable before it’s initialized. |
| 1d No multiple use of variable names | ++ | The runtime doesn’t shadow any name; see the rules above. |
| 1e Avoid global variables | + | The runtime has no global state. Images are immutable statics in the generated code. |
| 1f Restricted use of pointers | ++ | The runtime uses references only. Raw pointers would need unsafe, which the crate forbids. |
| 1g No implicit type conversions | ++ | Rust has no implicit numeric conversions. Each as cast in the runtime either widens, or converts a value that an earlier clamp or the arithmetic before it keeps in range. |
| 1h No hidden data flow or control flow | ++ | The runtime doesn’t call into application code. The generated code does so only through the callbacks trait the application passes in. A panic from a bounds or overflow check is the one hidden exit; see slint.aou.panic. |
| 1i No unconditional jumps | ++ | Rust has no goto. |
| 1j No recursion | + | No function of the runtime calls itself, directly or indirectly. |
Slint Compiler
Section titled “Slint Compiler”| Rule | Enforced by |
|---|---|
| No unsafe code. | #![deny(unsafe_code)] at the crate root of slint-compiler, and of the workspace crates it builds on, i-slint-compiler and i-slint-common. Unlike forbid, deny can be lifted locally by an allow, so any exception is visible in the source and reviewable. |
| No clippy warnings. | The same CI run as for the runtime. |
Generated Code
Section titled “Generated Code”The generated code applies the design principles like the runtime, with the rules below. The rules are requirements of the generated code; see Coding Rules. The slint-sc test driver checks them on the code generated for every test case. The checks aren’t in the generated code itself, so a generator bug fails our tests rather than the customer’s build.
| Rule | Enforced by |
|---|---|
| No unsafe code. | Each test program has #![forbid(unsafe_code)]. |
No standard library and no alloc. | Each test program is #![no_std], and only its harness declares extern crate std. |
| No shadowing of names. | Clippy runs on each test program with the shadow_same, shadow_reuse, and shadow_unrelated lints denied for the generated code. |
| No panicking calls. | The same clippy run, with the unwrap_used, expect_used, panic, unreachable, todo, and unimplemented lints denied. |
| No slice indexing. | The same clippy run, with the indexing_slicing lint denied. |
No ? operator. | The same clippy run, with the question_mark_used lint denied. |
| No arithmetic that can overflow. | The same clippy run, with the arithmetic_side_effects lint denied. |
No as conversions. | The same clippy run, with the as_conversions lint denied. |
© 2026 SixtyFPS GmbH
Built from commit e69c2a25181702af006ff3af4e084bda20a131c9