e8e7bf3b892ef69aac97c171d02b4b026322dcec

Author
bjorn3 <bjorn3@users.noreply.github.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Update rust plugin for latest rustc (#6342)

* Update for latest rustc

* Some debug option updates

* Add some cargo flags

* Fix bug in cargo plugin

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo
  2index 17585920252a7919d87a35e18e579460b3f9490a..54e709ca099928e7adc5467adf368020f3ef658e 100644
  3--- a/plugins/cargo/_cargo
  4+++ b/plugins/cargo/_cargo
  5@@ -7,10 +7,13 @@ _cargo() {
  6 
  7 _arguments \
  8     '(- 1 *)'{-h,--help}'[show help message]' \
  9+    '(- 1 *)'{-V,--version}'[show version information]' \
 10     '(- 1 *)'--list'[list installed commands]' \
 11+    '(- 1 *)'--explain'[Run `rustc --explain CODE`]' \
 12     '(- 1 *)'{-v,--verbose}'[use verbose output]' \
 13     '(- 1 *)'--color'[colorization option]' \
 14-    '(- 1 *)'{-V,--version}'[show version information]' \
 15+    '(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \
 16+    '(- 1 *)'--locked'[Require Cargo.lock is up to date]' \
 17     '1: :_cargo_cmds' \
 18     '*:: :->args'
 19 
 20diff --git a/plugins/rust/_rust b/plugins/rust/_rust
 21index f4e8f6f7873c9baa0bc64f59eb11530dd753e017..ac6aee160bf086c5cdd53b220a32c55d8f387b0d 100644
 22--- a/plugins/rust/_rust
 23+++ b/plugins/rust/_rust
 24@@ -15,59 +15,93 @@ _rustc_crate_types=(
 25     'lib'
 26     'rlib'
 27     'dylib'
 28+    'cdylib'
 29     'staticlib'
 30+    'proc-macro'
 31 )
 32 
 33 _rustc_emit_types=(
 34     'asm'
 35-    'bc'
 36-    'ir'
 37+    'llvm-bc'
 38+    'llvm-ir'
 39     'obj'
 40+    'metadata'
 41     'link'
 42+    'dep-info'
 43+    'mir'
 44+)
 45+_rustc_print_types=(
 46+    'crate-name'
 47+    'file-names'
 48+    'sysroot'
 49+    'cfg'
 50+    'target-list'
 51+    'target-cpus'
 52+    'target-features'
 53+    'relocation-models'
 54+    'code-models'
 55+    'target-spec-json'
 56+    'native-static-libs'
 57 )
 58 _rustc_pretty_types=(
 59     'normal[un-annotated source]'
 60     'expanded[crates expanded]'
 61-    'typed[crates  expanded,  with  type  annotations]'
 62-    'identified[fully parenthesized, AST nodes and blocks with IDs]'
 63+    'expanded,identified[fully parenthesized, AST nodes with IDs]'
 64+)
 65+_rustc_unpretty_types=(
 66+    'normal[un-annotated source]'
 67+    'expanded[crates expanded]'
 68+    'expanded,identified[fully parenthesized, AST nodes with IDs]'
 69     'flowgraph=[graphviz formatted flowgraph for node]:NODEID:'
 70+    'everybody_loops[all function bodies replaced with `loop {}`]'
 71+    'hir[the HIR]'
 72+    'hir,identified'
 73+    'hir,typed[HIR with types for each node]'
 74 )
 75 _rustc_color_types=(
 76     'auto[colorize, if output goes to a tty (default)]'
 77     'always[always colorize output]'
 78     'never[never colorize output]'
 79 )
 80+_rustc_error_format=(
 81+    'human'
 82+    'json'
 83+)
 84 
 85 _rustc_opts_vals=(
 86+    --cfg='[Configure the compilation environment]:SPEC:'
 87+    -L'[Add a directory to the library search path]:DIR:_files -/'
 88     --crate-name='[Specify the name of the crate being built]'
 89     --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types"  "$_rustc_crate_types[@]"'
 90     --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"'
 91+    --print='[Comma separated list of compiler information to print on stdout]:TYPES:_values -s "," "Printable info" "$_rustc_print_types[@]"'
 92+    -o'[Write output to <filename>. Ignored if more than one --emit is specified.]:FILENAME:_files'
 93+    --out-dir='[Write output to compiler-chosen filename in <dir>.  Ignored  if  -o  is  specified. (default the current directory)]:DIR:_files -/'
 94+    --explain='[Provide a detailed explanation of an error message]:OPT:'
 95+    --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:'
 96+    --extern'[Specify where an external rust library is located]:ARG:'
 97+    --sysroot='[Override the system root]:PATH:_files -/'
 98+    --error-format='[How errors and other messages are produced]:TYPES:_values "$_rustc_error_format"'
 99     --debuginfo='[Emit DWARF debug info to the objects created]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"'
100     --dep-info='[Output dependency info to <filename> after compiling]::FILE:_files -/'
101-    --sysroot='[Override the system root]:PATH:_files -/'
102-    --cfg='[Configure the compilation environment]:SPEC:'
103-    --out-dir='[Write output to compiler-chosen filename in <dir>.  Ignored  if  -o  is  specified. (default the current directory)]:DIR:_files -/'
104-    -o'[Write output to <filename>. Ignored if more than one --emit is specified.]:FILENAME:_files'
105     --opt-level='[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)'
106     --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"'
107-    -L'[Add a directory to the library search path]:DIR:_files -/'
108-    --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:'
109+    --unpretty='[Present the input source, unstable (and less-pretty)]::TYPE:_values "TYPES" "$_rustc_unpretty_types[@]"'
110     --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"'
111     {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)'
112-    --explain='[Provide a detailed explanation of an error message]:OPT:'
113-    --extern'[Specify where an external rust library is located]:ARG:'
114 )
115 
116 _rustc_opts_switches=(
117     -g'[Equivalent to --debuginfo=2]'
118+    -O'[Equivalent to --opt-level=2]'
119+    --test'[Build a test harness]'
120+    --verbose'[Use verbose output]'
121     {-h,--help}'[Display this message]'
122     --no-analysis'[Parse and expand the output, but run no analysis or produce output]'
123     --no-trans'[Run all passes except translation; no output]'