From 397c4434f84a1cbb78877924d840e18b87f00d18 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Mon, 3 Jun 2024 12:22:00 +1000 Subject: [PATCH] doc: CodeReview.md: Clarify cfg usage Signed-off-by: Alistair Francis --- chips/lowrisc/Cargo.toml | 4 ++++ doc/CodeReview.md | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/chips/lowrisc/Cargo.toml b/chips/lowrisc/Cargo.toml index 8822d2a0f10..fae16af1055 100644 --- a/chips/lowrisc/Cargo.toml +++ b/chips/lowrisc/Cargo.toml @@ -11,3 +11,7 @@ edition.workspace = true [dependencies] rv32i = { path = "../../arch/rv32i" } kernel = { path = "../../kernel" } + +[lints.rust] +# These are unused and unsupported +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(aon_wkup_timer)'] } diff --git a/doc/CodeReview.md b/doc/CodeReview.md index e0284f53870..fc5b8f89993 100644 --- a/doc/CodeReview.md +++ b/doc/CodeReview.md @@ -344,6 +344,12 @@ Generally, this means `cfg` directives should be an explicit list of chips or'd together. Rarely, if ever, is a `cfg(not ...)` the correct approach for anything outside of unit tests. +Rust `cfg` features can also be used to disable code that isn't used in upstream +Tock but might be used in private or public forks. Rust custom configs can also +be used, but generally require changes to the lint configuration. See +https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html#check-cfg-in-lintsrust-table +for more details. + #### Boards Changes to boards are generally left to the maintainer or original contributor