MCPcopy Index your code
hub / github.com/Rust-for-Linux/klint

github.com/Rust-for-Linux/klint @1.96

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.96 ↗ · + Follow
482 symbols 1,080 edges 58 files 55 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

klint

Lints for kernel or embedded system development.

Installation and Usage

Clone the repository and run cargo install:

git clone https://github.com/Rust-for-Linux/klint.git
cd klint
cargo install --path .

Note that klint currently is pinned to a Rust version so it is likely that running cargo install --git will not work as it will not use the rust-toolchain file in the repository.

klint is developed against latest nightly rustc; if you would like to use it with a stable Rust version, check the tagged releases.

klint will behave like rustc, just with additional lints.

If you use nix, you can also build and run klint directly:

nix run github:Rust-for-Linux/klint

Run on Linux kernel

cargo install --path .

klint is a tool and would need to be registered with rustc, to do so, apply this patch to the kernel tree. This patch can be used even if plain rustc or clippy is used for kernel build.

To run this tool for Linux kernel build, use make RUSTC=<path to klint> to use klint in place of a Rust compiler.

If you compile kernel with rustdoc tests as kunit tests, you also need a matching version of rustdoc. As it can be tricky to get the versions to match, klint provides a klint-rustdoc binary will execute the correct rustdoc. You can add RUSTDOC="<path to klint>-rustdoc" to the make command.

klint's atomic context checker is not lint-clean on Linux kernel tree. If you want to check it out, you can opt into it with -Dklint::atomic_context.

Implemented Lints

Extension points exported contracts — how you extend this code

PersistentQuery (Interface)
(no doc) [6 implementers]
src/ctxt.rs
MeetSemiLattice (Interface)
A [partially ordered set][poset] that has a [greatest lower bound][glb] for any pair of elements in the set. Dataflow a [1 …
src/lattice.rs
MyTrait (Interface)
(no doc) [3 implementers]
tests/ui/vtable.rs
CallbacksExt (Interface)
(no doc) [1 implementers]
src/driver.rs
DropElaborator (Interface)
(no doc) [1 implementers]
src/mir/elaborate_drop.rs
QueryValueDecodable (Interface)
(no doc) [2 implementers]
src/ctxt.rs
ToOpt (Interface)
(no doc) [2 implementers]
tests/ui/infinite_recursion.rs
Query (Interface)
(no doc)
src/ctxt.rs

Core symbols most depended-on inside this repo

unwrap
called by 90
src/preempt_count/dataflow.rs
push
called by 74
src/monomorphize_collector.rs
map
called by 33
src/mir/elaborate_drop.rs
tcx
called by 33
src/mir/elaborate_drop.rs
insert
called by 29
src/utils/anymap.rs
patch
called by 24
src/mir/drop_shim.rs
span
called by 20
src/diagnostic/use_stack.rs
encode
called by 19
src/binary_analysis/dwarf.rs

Shape

Method 288
Function 98
Class 72
Interface 13
Enum 11

Languages

Rust100%

Modules by API surface

src/monomorphize_collector.rs46 symbols
src/serde.rs44 symbols
src/mir/elaborate_drop.rs44 symbols
src/driver.rs22 symbols
src/attribute.rs20 symbols
src/mir/patch.rs19 symbols
src/mir/drop_shim.rs19 symbols
src/binary_analysis/dwarf.rs19 symbols
src/preempt_count/check.rs16 symbols
src/ctxt.rs16 symbols
tests/ui/vtable.rs15 symbols
src/preempt_count/dataflow.rs13 symbols

For agents

$ claude mcp add klint \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact