From ddc66ffecc85fa7ba089367fe7ad6c307cbea216 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 28 Oct 2022 12:48:51 +0000 Subject: [PATCH] Make rust-analyzer run flycheck on the build system --- .vscode/settings.json | 8 +------- Cargo.toml | 8 ++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 95603bca595..bc914e37d2b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,7 @@ "rust-analyzer.imports.granularity.enforce": true, "rust-analyzer.imports.granularity.group": "module", "rust-analyzer.imports.prefix": "crate", - "rust-analyzer.cargo.features": ["unstable-features"], + "rust-analyzer.cargo.features": ["unstable-features", "__check_build_system_using_ra"], "rust-analyzer.linkedProjects": [ "./Cargo.toml", { @@ -32,12 +32,6 @@ { "sysroot_src": "./build_sysroot/sysroot_src/library", "crates": [ - { - "root_module": "./y.rs", - "edition": "2021", - "deps": [], - "cfg": [], - }, { "root_module": "./example/std_example.rs", "edition": "2015", diff --git a/Cargo.toml b/Cargo.toml index 08b3ef0ee31..1a97feb70b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,13 @@ name = "rustc_codegen_cranelift" version = "0.1.0" edition = "2021" +[[bin]] +# This is used just to teach rust-analyzer how to check the build system. required-features is used +# to disable it for regular builds. +name = "y" +path = "./y.rs" +required-features = ["__check_build_system_using_ra"] + [lib] crate-type = ["dylib"] @@ -40,6 +47,7 @@ smallvec = "1.8.1" unstable-features = ["jit", "inline_asm"] jit = ["cranelift-jit", "libloading"] inline_asm = [] +__check_build_system_using_ra = [] [package.metadata.rust-analyzer] rustc_private = true