Textwächter erkennt gruppierte std-Importe und globale Sperren
Mit `use std::{fs, process};` und anschließendem `fs::remove_file(…)`
kam bisher beides durch: Der Textwächter suchte `std::fs` wörtlich, und
Clippy kennt nur die aufgelisteten Funktionen. Globaler veränderlicher
Zustand über `static` mit Mutex, RwLock, OnceLock oder LazyLock wurde
auch nicht erkannt.
Neu in FORBIDDEN: `std::{` (gruppierte Importe verbergen dem Text die
Modulnamen) sowie Mutex, RwLock, OnceLock und LazyLock. Der Kern in
core/src nutzt nichts davon. Der Kommentar in core/clippy.toml behauptet
jetzt nur noch, was Clippy leistet, und CLAUDE.md nennt die Regel, dass
jeder std-Pfad in einer eigenen use-Zeile steht.
Der bestehende Selbsttest every_forbidden_term_is_detected deckt die
neuen Einträge ab.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -42,12 +42,20 @@ const FORBIDDEN: &[(&str, &str)] = &[
|
||||
"the core must not read or write streams; the shell does that",
|
||||
),
|
||||
("std::process", "the core must not start or end processes"),
|
||||
(
|
||||
"std::{",
|
||||
"grouped std imports hide forbidden modules from this search; import each path on its own line",
|
||||
),
|
||||
("static mut", "global mutable state can differ between runs"),
|
||||
(
|
||||
"thread_local",
|
||||
"global mutable state can differ between runs",
|
||||
),
|
||||
("Atomic", "global mutable state can differ between runs"),
|
||||
("Mutex", "global mutable state can differ between runs"),
|
||||
("RwLock", "global mutable state can differ between runs"),
|
||||
("OnceLock", "global mutable state can differ between runs"),
|
||||
("LazyLock", "global mutable state can differ between runs"),
|
||||
("unsafe", "the core forbids unsafe code"),
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user