-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
A-flycheckissues with flycheck a.k.a. "check on save"issues with flycheck a.k.a. "check on save"C-bugCategory: bugCategory: bug
Description
To reproduce
cargo init --bin- Open this project in VSCode.
- Create the file
datain the root of the project, with the following contents:(no trailing newline)hello Ctrl-S- Put the following in
src/main.rs:trait MyTrait {} impl MyTrait for [u8; 5] {} fn main() { let _t: &dyn MyTrait = include_bytes!("../data"); }
Ctrl-S, observe that rust-analyzer shows no errors.- Go back to the file
dataand edit it, changing its length. Ctrl-S, observe that rust-analyzer shows no errors.- Go back to file
src/main.rs. Ctrl-S, observe that rust-analyzer shows an error belatedly ("the trait bound[u8; 6]: MyTraitis not satisfied").
In the perfect world, the error would be displayed on step 8, immediately after editing and saving the data file.
This is an artificial minimal example.
For a motivating real-world example, consider a compile-time templating system like Askama. Askama uses derive proc macro to process template files, and emits include_bytes!() as a way to let the build system know about the data dependency. Mistakes in the template can result in compile errors. It would be nice if such errors were reported immediately on save, without having to manually trigger cargo check.
Version info
rust-analyzer version: 0.4.1296-standalone (2656297 2022-11-20)
VSCode version: 1.71.1
cargo 1.66.0-nightly (73ba3f35e 2022-09-18)
rustc 1.66.0-nightly (3f83906 2022-09-24)
Metadata
Metadata
Assignees
Labels
A-flycheckissues with flycheck a.k.a. "check on save"issues with flycheck a.k.a. "check on save"C-bugCategory: bugCategory: bug