diff --git a/.gitignore b/.gitignore index cfa57d7631b51d..9df21db1ada61b 100644 --- a/.gitignore +++ b/.gitignore @@ -162,3 +162,6 @@ x509.genkey # Documentation toolchain sphinx_*/ + +# Rust analyzer configuration +/rust-project.json diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst index 42367e4365c3e8..e78125d9289bd6 100644 --- a/Documentation/rust/quick-start.rst +++ b/Documentation/rust/quick-start.rst @@ -145,6 +145,23 @@ the component manually:: The standalone installers also come with ``rustdoc``. +rust-analyzer +************* + +The `rust-analyzer `_ language server can +be used with many editors to enable syntax highlighting, completion, go to +definition, and other features. + +``rust-analyzer`` will need to be +`configured `_ +to work with the kernel by adding a ``rust-project.json`` file in the root folder. +The example ``Documentation/rust/rust-project.json`` can +be used after updating ``sysroot_src`` and including the relevant modules. +The path to ``sysroot_src`` is given by:: + + $(rustc --print sysroot)/lib/rustlib/src/rust/library + + Configuration ------------- diff --git a/Documentation/rust/rust-project.json b/Documentation/rust/rust-project.json new file mode 100644 index 00000000000000..e0f64b8dec1e38 --- /dev/null +++ b/Documentation/rust/rust-project.json @@ -0,0 +1,35 @@ +{ + "sysroot_src": , + "crates": [ + { + "root_module": "rust/module.rs", + "edition": "2018", + "deps": [] + }, + { + "root_module": "rust/kernel/lib.rs", + "edition": "2018", + "deps": [ + { + "crate": 0, + "name": "module" + } + ] + }, + { + "root_module": , + "edition": "2018", + "deps": [ + { + "crate": 0, + "name": "module" + }, + { + "crate": 1, + "name": "kernel" + } + ] + }, + <...entries for other modules...> + ] +} \ No newline at end of file