ale
ale copied to clipboard
Using rust linters with ALE only considers the `Cargo.toml` file at the moment the vim process started.
Information
VIM version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 24 2022 18:41:57)
Correções incluídas: 1-4464
Operating System: Linux ultrarobson 5.16.16-arch1-1 #1 SMP PREEMPT Mon, 21 Mar 2022 22:59:40 +0000 x86_64 GNU/Linux
What went wrong
Using rust linters with ALE only considers the Cargo.toml
file at the moment the vim process started.
Reproducing the bug
Using any of the linters 'rustc'
or 'cargo'
, I get the following problem:
- At a cargo project, I open the
main.rs
file - Then I try to use some external crate, let's say I add
use nix::unistd::alarm;
into the file beggining - But I haven't added it as a dependecy! So the linter tells me: E0433: failed to resolve: use ...ndeclared crate or module
nix
- I go to the
Cargo.toml
file and add under[dependencies]
the linenix = "0.23.1"
- But the linter still doesn't get it. It should now give me only a warning for the unused import, but it stills gives me the error. Running the linter on another shell only gives the warning.
That is: once the rust linter has ran at least once, it will not "see" any updates that occur to the Cargo.toml
file in the subsequential lintings.
Mannually running :ALEStopAllLSPs
solves the issue.
:ALEInfo when using cargo
Current Filetype: rust
Available Linters: ['analyzer', 'cargo', 'rls', 'rustc']
Enabled Linters: ['cargo']
Ignored Linters: []
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'rustfmt' - Fix Rust files with Rustfmt.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:
let g:ale_rust_cargo_avoid_whole_workspace = 1
let g:ale_rust_cargo_check_all_targets = 0
let g:ale_rust_cargo_check_examples = 0
let g:ale_rust_cargo_check_tests = 0
let g:ale_rust_cargo_clippy_options = ''
let g:ale_rust_cargo_default_feature_behavior = 'default'
let g:ale_rust_cargo_include_features = ''
let g:ale_rust_cargo_target_dir = ''
let g:ale_rust_cargo_use_check = 1
let g:ale_rust_cargo_use_clippy = 0
let g:ale_rust_ignore_error_codes = []
let g:ale_rust_ignore_secondary_spans = 0
Global Variables:
let g:ale_cache_executable_check_failures = 1
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'python': ['flake8']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_linter_aliases = {}
let g:ale_linters = {'solidity': ['solhint'], 'bash': ['shellcheck'], 'rust': ['cargo'], 'python': ['flake8']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = 'E>'
let g:ale_sign_info = 'W>'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'E>'
let g:ale_sign_style_warning = 'W>'
let g:ale_sign_warning = 'W>'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) cargo
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/home/ttv1/codes/alarm/home-alarm'' && ''cargo'' --version']
<<<OUTPUT STARTS>>>
cargo 1.61.0-nightly (1ef1e0a 2022-03-31)
<<<OUTPUT ENDS>>>
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/home/ttv1/codes/alarm/home-alarm'' && cargo check --frozen --message-format=json -q']
<<<OUTPUT STARTS>>>
{"reason":"compiler-artifact","package_id":"cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"cfg-if","src_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/src/lib.rs","edition":"2018","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/deps/libcfg_if-88879d2dc0fa106c.rmeta"],"executable":null,"fresh":false}
{"reason":"compiler-artifact","package_id":"bitflags 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.3.2/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"bitflags","src_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.3.2/src/lib.rs","edition":"2018","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":["default"],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/deps/libbitflags-f75283d3dcd3daad.rmeta"],"executable":null,"fresh":false}
{"reason":"compiler-artifact","package_id":"autocfg 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"autocfg","src_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.1.0/src/lib.rs","edition":"2015","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/deps/libautocfg-5788d3b0c0ad14fb.rlib","/home/ttv1/codes/alarm/home-alarm/target/debug/deps/libautocfg-5788d3b0c0ad14fb.rmeta"],"executable":null,"fresh":false}
{"reason":"compiler-artifact","package_id":"libc 0.2.121 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.121/Cargo.toml","target":{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.121/build.rs","edition":"2015","doc":false,"doctest":false,"test":false},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":["default","extra_traits","std"],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/build/libc-289ae8f3fda9458e/build-script-build"],"executable":null,"fresh":false}
{"reason":"build-script-executed","package_id":"libc 0.2.121 (registry+https://github.com/rust-lang/crates.io-index)","linked_libs":[],"linked_paths":[],"cfgs":["freebsd11","libc_priv_mod_use","libc_union","libc_const_size_of","libc_align","libc_core_cvoid","libc_packedN","libc_cfg_target_vendor","libc_non_exhaustive","libc_ptr_addr_of"],"env":[],"out_dir":"/home/ttv1/codes/alarm/home-alarm/target/debug/build/libc-f296aa9f3e586421/out"}
{"reason":"compiler-artifact","package_id":"memoffset 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/memoffset-0.6.5/Cargo.toml","target":{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/memoffset-0.6.5/build.rs","edition":"2015","doc":false,"doctest":false,"test":false},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":["default"],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/build/memoffset-faa1542f4d600245/build-script-build"],"executable":null,"fresh":false}
{"reason":"build-script-executed","package_id":"memoffset 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)","linked_libs":[],"linked_paths":[],"cfgs":["tuple_ty","allow_clippy","maybe_uninit","doctests","raw_ref_macros"],"env":[],"out_dir":"/home/ttv1/codes/alarm/home-alarm/target/debug/build/memoffset-851c5101ea5ade3a/out"}
{"reason":"compiler-artifact","package_id":"memoffset 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/memoffset-0.6.5/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"memoffset","src_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/memoffset-0.6.5/src/lib.rs","edition":"2015","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":["default"],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/deps/libmemoffset-aed047b9c650959e.rmeta"],"executable":null,"fresh":false}
{"reason":"compiler-artifact","package_id":"libc 0.2.121 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.121/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"libc","src_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.121/src/lib.rs","edition":"2015","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":["default","extra_traits","std"],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/deps/liblibc-7b4c0120d0a5d371.rmeta"],"executable":null,"fresh":false}
{"reason":"compiler-artifact","package_id":"nix 0.23.1 (registry+https://github.com/rust-lang/crates.io-index)","manifest_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.23.1/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"nix","src_path":"/home/ttv1/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.23.1/src/lib.rs","edition":"2018","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/deps/libnix-b45d3578deaca2c2.rmeta"],"executable":null,"fresh":false}
{"reason":"compiler-message","package_id":"home-alarm 0.1.0 (path+file:///home/ttv1/codes/alarm/home-alarm)","manifest_path":"/home/ttv1/codes/alarm/home-alarm/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"home-alarm","src_path":"/home/ttv1/codes/alarm/home-alarm/src/main.rs","edition":"2021","doc":true,"doctest":false,"test":true},"message":{"rendered":"warning: unused import: `nix::unistd::alarm`\n --> src/main.rs:1:5\n |\n1 | use nix::unistd::alarm;\n | ^^^^^^^^^^^^^^^^^^\n |\n = note: `#[warn(unused_imports)]` on by default\n\n","children":[{"children":[],"code":null,"level":"note","message":"`#[warn(unused_imports)]` on by default","rendered":null,"spans":[]},{"children":[],"code":null,"level":"help","message":"remove the whole `use` item","rendered":null,"spans":[{"byte_end":23,"byte_start":0,"column_end":24,"column_start":1,"expansion":null,"file_name":"src/main.rs","is_primary":true,"label":null,"line_end":1,"line_start":1,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","text":[{"highlight_end":24,"highlight_start":1,"text":"use nix::unistd::alarm;"}]}]}],"code":{"code":"unused_imports","explanation":null},"level":"warning","message":"unused import: `nix::unistd::alarm`","spans":[{"byte_end":22,"byte_start":4,"column_end":23,"column_start":5,"expansion":null,"file_name":"src/main.rs","is_primary":true,"label":null,"line_end":1,"line_start":1,"suggested_replacement":null,"suggestion_applicability":null,"text":[{"highlight_end":23,"highlight_start":5,"text":"use nix::unistd::alarm;"}]}]}}
{"reason":"compiler-message","package_id":"home-alarm 0.1.0 (path+file:///home/ttv1/codes/alarm/home-alarm)","manifest_path":"/home/ttv1/codes/alarm/home-alarm/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"home-alarm","src_path":"/home/ttv1/codes/alarm/home-alarm/src/main.rs","edition":"2021","doc":true,"doctest":false,"test":true},"message":{"rendered":"warning: 1 warning emitted\n\n","children":[],"code":null,"level":"warning","message":"1 warning emitted","spans":[]}}
{"reason":"compiler-artifact","package_id":"home-alarm 0.1.0 (path+file:///home/ttv1/codes/alarm/home-alarm)","manifest_path":"/home/ttv1/codes/alarm/home-alarm/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"home-alarm","src_path":"/home/ttv1/codes/alarm/home-alarm/src/main.rs","edition":"2021","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/ttv1/codes/alarm/home-alarm/target/debug/deps/libhome_alarm-d61a70625f090cd0.rmeta"],"executable":null,"fresh":false}
{"reason":"build-finished","success":true}
<<<OUTPUT ENDS>>>
(finished - exit code 101) ['/bin/bash', '-c', 'cd ''/home/ttv1/codes/alarm/home-alarm'' && cargo check --frozen --message-format=json -q']
<<<OUTPUT STARTS>>>
error: the lock file /home/ttv1/codes/alarm/home-alarm/Cargo.lock needs to be updated but --frozen was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --frozen flag and use --offline instead.
<<<OUTPUT ENDS>>>
:ALEInfo when using rustc
Current Filetype: rust
Available Linters: ['analyzer', 'cargo', 'rls', 'rustc']
Enabled Linters: ['rustc']
Ignored Linters: []
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'rustfmt' - Fix Rust files with Rustfmt.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:
let g:ale_rust_ignore_error_codes = []
let g:ale_rust_ignore_secondary_spans = 0
let g:ale_rust_rustc_options = '-Z no-codegen'
Global Variables:
let g:ale_cache_executable_check_failures = 1
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'python': ['flake8']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_linter_aliases = {}
let g:ale_linters = {'solidity': ['solhint'], 'bash': ['shellcheck'], 'rust': ['rustc'], 'python': ['flake8']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = 'E>'
let g:ale_sign_info = 'W>'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'E>'
let g:ale_sign_style_warning = 'W>'
let g:ale_sign_warning = 'W>'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) rustc
(finished - exit code 1) ['/bin/bash', '-c', 'rustc --error-format=json -Z no-codegen -L ''/home/ttv1/codes/alarm/home-alarm/target/debug/deps'' -L ''/home/ttv1/codes/alarm/home-alarm/target/release/deps'' - < ''/tmp/vQPReLR/1/main.rs''']
<<<OUTPUT STARTS>>>
{"message":"failed to resolve: maybe a missing crate `nix`?","code":{"code":"E0433","explanation":"An undeclared crate, module, or type was used.\n\nErroneous code example:\n\n```compile_fail,E0433\nlet map = HashMap::new();\n// error: failed to resolve: use of undeclared type `HashMap`\n```\n\nPlease verify you didn't misspell the type/module's name or that you didn't\nforget to import it:\n\n```\nuse std::collections::HashMap; // HashMap has been imported.\nlet map: HashMap<u32, u32> = HashMap::new(); // So it can be used!\n```\n\nIf you've expected to use a crate name:\n\n```compile_fail\nuse ferris_wheel::BigO;\n// error: failed to resolve: use of undeclared crate or module `ferris_wheel`\n```\n\nMake sure the crate has been added as a dependency in `Cargo.toml`.\n\nTo use a module from your current crate, add the `crate::` prefix to the path.\n"},"level":"error","spans":[{"file_name":"<anon>","byte_start":4,"byte_end":7,"line_start":1,"line_end":1,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":"use nix::unistd::alarm;","highlight_start":5,"highlight_end":8}],"label":"maybe a missing crate `nix`?","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0433]: failed to resolve: maybe a missing crate `nix`?\n --> <anon>:1:5\n |\n1 | use nix::unistd::alarm;\n | ^^^ maybe a missing crate `nix`?\n\n"}
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
{"message":"For more information about this error, try `rustc --explain E0433`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0433`.\n"}
<<<OUTPUT ENDS>>>
(finished - exit code 1) ['/bin/bash', '-c', 'rustc --error-format=json -Z no-codegen -L ''/home/ttv1/codes/alarm/home-alarm/target/debug/deps'' -L ''/home/ttv1/codes/alarm/home-alarm/target/release/deps'' - < ''/tmp/vQPReLR/3/main.rs''']
<<<OUTPUT STARTS>>>
{"message":"failed to resolve: maybe a missing crate `nix`?","code":{"code":"E0433","explanation":"An undeclared crate, module, or type was used.\n\nErroneous code example:\n\n```compile_fail,E0433\nlet map = HashMap::new();\n// error: failed to resolve: use of undeclared type `HashMap`\n```\n\nPlease verify you didn't misspell the type/module's name or that you didn't\nforget to import it:\n\n```\nuse std::collections::HashMap; // HashMap has been imported.\nlet map: HashMap<u32, u32> = HashMap::new(); // So it can be used!\n```\n\nIf you've expected to use a crate name:\n\n```compile_fail\nuse ferris_wheel::BigO;\n// error: failed to resolve: use of undeclared crate or module `ferris_wheel`\n```\n\nMake sure the crate has been added as a dependency in `Cargo.toml`.\n\nTo use a module from your current crate, add the `crate::` prefix to the path.\n"},"level":"error","spans":[{"file_name":"<anon>","byte_start":4,"byte_end":7,"line_start":1,"line_end":1,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":"use nix::unistd::alarm;","highlight_start":5,"highlight_end":8}],"label":"maybe a missing crate `nix`?","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0433]: failed to resolve: maybe a missing crate `nix`?\n --> <anon>:1:5\n |\n1 | use nix::unistd::alarm;\n | ^^^ maybe a missing crate `nix`?\n\n"}
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
{"message":"For more information about this error, try `rustc --explain E0433`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0433`.\n"}
<<<OUTPUT ENDS>>>
(finished - exit code 1) ['/bin/bash', '-c', 'rustc --error-format=json -Z no-codegen -L ''/home/ttv1/codes/alarm/home-alarm/target/debug/deps'' -L ''/home/ttv1/codes/alarm/home-alarm/target/release/deps'' - < ''/tmp/vQPReLR/6/main.rs''']
<<<OUTPUT STARTS>>>
{"message":"failed to resolve: maybe a missing crate `nix`?","code":{"code":"E0433","explanation":"An undeclared crate, module, or type was used.\n\nErroneous code example:\n\n```compile_fail,E0433\nlet map = HashMap::new();\n// error: failed to resolve: use of undeclared type `HashMap`\n```\n\nPlease verify you didn't misspell the type/module's name or that you didn't\nforget to import it:\n\n```\nuse std::collections::HashMap; // HashMap has been imported.\nlet map: HashMap<u32, u32> = HashMap::new(); // So it can be used!\n```\n\nIf you've expected to use a crate name:\n\n```compile_fail\nuse ferris_wheel::BigO;\n// error: failed to resolve: use of undeclared crate or module `ferris_wheel`\n```\n\nMake sure the crate has been added as a dependency in `Cargo.toml`.\n\nTo use a module from your current crate, add the `crate::` prefix to the path.\n"},"level":"error","spans":[{"file_name":"<anon>","byte_start":4,"byte_end":7,"line_start":1,"line_end":1,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":"use nix::unistd::alarm;","highlight_start":5,"highlight_end":8}],"label":"maybe a missing crate `nix`?","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0433]: failed to resolve: maybe a missing crate `nix`?\n --> <anon>:1:5\n |\n1 | use nix::unistd::alarm;\n | ^^^ maybe a missing crate `nix`?\n\n"}
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
{"message":"For more information about this error, try `rustc --explain E0433`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0433`.\n"}
<<<OUTPUT ENDS>>>
Same here. Adding a dependency breaks ALE, causing it to show errors where there are none. Restarting vim fixes it.
Not a permanent fix but my usual workaround to this is, :ALEStopAllLSPs
, then :ALEDisable
, then :ALEEnable
. Can be run on any Rust buffer.
EDIT: Just noticed that it also affects rustc and cargo; for those, I think ALEDisable and ALEEnable might fix it?
How about please renaming this issue from:
Using ~rust linters~ with ALE only considers the Cargo.toml file at the moment the vim process started.
to
Using cargo linter with ALE only considers the Cargo.toml file at the moment the vim process started.
It is clear from the error message that the flag --frozen
is given to cargo check
. Frankly, that seems reasonable to me. My recommendation for anyone wanting reactions to toml file updates is to use rust-analyzer rather than the way more limited cargo linter.