Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo check ignores g:rust_cargo_check_all_features #472

Open
vlopes11 opened this issue Mar 16, 2022 · 0 comments
Open

Cargo check ignores g:rust_cargo_check_all_features #472

vlopes11 opened this issue Mar 16, 2022 · 0 comments

Comments

@vlopes11
Copy link

vlopes11 commented Mar 16, 2022

When we add g:rust_cargo_check_all_features = 1 to .vimrc, Cargo check don't pass all-features

Here is how Cargo check computes a cargo argument:

function! cargo#cmd(args) abort
" Trim trailing spaces. This is necessary since :terminal command parses
" trailing spaces as an empty argument.
let args = substitute(a:args, '\s\+$', '', '')
if exists('g:cargo_shell_command_runner')
let cmd = g:cargo_shell_command_runner
elseif has('terminal')
let cmd = 'terminal'
elseif has('nvim')
let cmd = 'noautocmd new | terminal'
else
let cmd = '!'
endif
execute cmd 'cargo' args
endfunction

And here is how we build the internal checker:

let l:check_all_targets = rust#GetConfigVar('rust_cargo_check_all_targets', 0)
let l:check_all_features = rust#GetConfigVar('rust_cargo_check_all_features', 0)
let l:check_examples = rust#GetConfigVar('rust_cargo_check_examples', 0)
let l:check_tests = rust#GetConfigVar('rust_cargo_check_tests', 0)
let l:check_benches = rust#GetConfigVar('rust_cargo_check_benches', 0)
let makeprg = makeprg. ' '
\ . (l:check_all_targets ? ' --all-targets' : '')
\ . (l:check_all_features ? ' --all-features' : '')
\ . (l:check_benches ? ' --benches' : '')
\ . (l:check_examples ? ' --examples' : '')
\ . (l:check_tests ? ' --tests' : '')

Seems we are missing these global vars check in autoload/cargo.vim. Maybe its a feature, and not a bug.

rust.vim version

4aa69b8

Steps to reproduce

  1. Add let g:rust_cargo_check_all_features = 1 to $MYVIMRC and source it, if applicable
  2. Run :Cargo check

Expected vs. actual behavior

The cargo command should be cargo check --all-features, but it is just cargo check

Debug info

rust.vim Global Variables:

let g:ftplugin_rust_source_path = v:null
let g:loaded_syntastic_rust_cargo_checker = v:null
let g:loaded_syntastic_rust_filetype = v:null
let g:loaded_syntastic_rust_rustc_checker = v:null
let g:rust_bang_comment_leader = v:null
let g:rust_cargo_avoid_whole_workspace = v:null
let g:rust_clip_command = v:null
let g:rust_conceal = v:null
let g:rust_conceal_mod_path = v:null
let g:rust_conceal_pub = v:null
let g:rust_fold = v:null
let g:rust_last_args = v:null
let b:rust_last_args = []
let g:rust_last_rustc_args = v:null
let b:rust_last_rustc_args = []
let g:rust_original_delimitMate_excluded_regions = v:null
let g:rust_playpen_url = v:null
let g:rust_prev_delimitMate_quotes = v:null
let g:rust_recent_nearest_cargo_tol = v:null
let g:rust_recent_root_cargo_toml = v:null
let g:rust_recommended_style = v:null
let g:rust_set_conceallevel = v:null
let g:rust_set_conceallevel=1 = v:null
let g:rust_set_foldmethod = v:null
let g:rust_set_foldmethod=1 = v:null
let g:rust_shortener_url = v:null
let g:rustc_makeprg_no_percent = v:null
let g:rustc_path = v:null
let g:rustfmt_autosave = 1
let g:rustfmt_autosave_if_config_present = v:null
let g:rustfmt_command = 'rustfmt'
let g:rustfmt_emit_files = 1
let g:rustfmt_fail_silently = 0
let g:rustfmt_options = ''
let g:syntastic_extra_filetypes = ['rust']
let g:syntastic_rust_cargo_fname = v:null
rustfmt 1.4.38-nightly (e95b10b 2022-03-13)

rustc 1.61.0-nightly (e95b10ba4 2022-03-13)

cargo 1.61.0-nightly (65c8266 2022-03-09)



VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 24 2022 18:41:57)
Included patches: 1-4464
Compiled by Arch Linux
Huge version without GUI.  Features included (+) or not (-):
+acl               +channel           +cscope            +ex_extra          -hangul_input      +linebreak         +mouse_dec         -mzscheme          +profile           -sodium            +tcl/dyn           +user_commands     +wildmenu
+arabic            +cindent           +cursorbind        +extra_search      +iconv             +lispindent        +mouse_gpm         +netbeans_intg     -python            -sound             +termguicolors     +vartabs           +windows
+autocmd           -clientserver      +cursorshape       -farsi             +insert_expand     +listcmds          -mouse_jsbterm     +num64             +python3/dyn       +spell             +terminal          +vertsplit         +writebackup
+autochdir         -clipboard         +dialog_con        +file_in_path      +ipv6              +localmap          +mouse_netterm     +packages          +quickfix          +startuptime       +terminfo          +vim9script        -X11
-autoservername    +cmdline_compl     +diff              +find_in_path      +job               +lua/dyn           +mouse_sgr         +path_extra        +reltime           +statusline        +termresponse      +viminfo           -xfontset
-balloon_eval      +cmdline_hist      +digraphs          +float             +jumplist          +menu              -mouse_sysmouse    +perl/dyn          +rightleft         -sun_workshop      +textobjects       +virtualedit       -xim
+balloon_eval_term +cmdline_info      -dnd               +folding           +keymap            +mksession         +mouse_urxvt       +persistent_undo   +ruby/dyn          +syntax            +textprop          +visual            -xpm
-browse            +comments          -ebcdic            -footer            +lambda            +modify_fname      +mouse_xterm       +popupwin          +scrollbind        +tag_binary        +timers            +visualextra       -xsmp
++builtin_terms    +conceal           +emacs_tags        +fork()            +langmap           +mouse             +multi_byte        +postscript        +signs             -tag_old_static    +title             +vreplace          -xterm_clipboard
+byte_offset       +cryptv            +eval              +gettext           +libcall           -mouseshape        +multi_lang        +printer           +smartindent       -tag_any_white     -toolbar           +wildignore        -xterm_save
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.34/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto -L/usr/local/lib -o vim -lm -ltinfo -lelf -lacl -lattr -lgpm -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.34/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.34/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lut
il -lc -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant