Skip to content

Commit 570bda6

Browse files
committed
update zsh rust completions
1 parent 340ac04 commit 570bda6

File tree

1 file changed

+93
-69
lines changed

1 file changed

+93
-69
lines changed

src/etc/zsh/_rust

Lines changed: 93 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -20,63 +20,71 @@ _rustc_crate_types=(
2020

2121
_rustc_emit_types=(
2222
'asm'
23-
'bc'
24-
'ir'
23+
'llvm-bc'
24+
'llvm-ir'
2525
'obj'
2626
'link'
27+
'dep-info'
2728
)
2829
_rustc_pretty_types=(
2930
'normal[un-annotated source]'
3031
'expanded[crates expanded]'
3132
'typed[crates expanded, with type annotations]'
3233
'identified[fully parenthesized, AST nodes and blocks with IDs]'
33-
'flowgraph=[graphviz formatted flowgraph for node]:NODEID:'
34+
'flowgraph[graphviz formatted flowgraph for node]:NODEID:'
3435
)
3536
_rustc_color_types=(
3637
'auto[colorize, if output goes to a tty (default)]'
3738
'always[always colorize output]'
3839
'never[never colorize output]'
3940
)
41+
_rustc_info_types=(
42+
'crate-name[Output the crate name and exit]'
43+
'file-names[Output the file(s) that would be written if compilation continued and exited]'
44+
'sysroot[Output the sysroot and exit]'
45+
)
4046

4147
_rustc_opts_vals=(
4248
--crate-name='[Specify the name of the crate being built]'
4349
--crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types" "$_rustc_crate_types[@]"'
4450
--emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"'
45-
--debuginfo='[Emit DWARF debug info to the objects created]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"'
46-
--dep-info='[Output dependency info to <filename> after compiling]::FILE:_files -/'
47-
--sysroot='[Override the system root]:PATH:_files -/'
4851
--cfg='[Configure the compilation environment]:SPEC:'
4952
--out-dir='[Write output to compiler-chosen filename in <dir>. Ignored if -o is specified. (default the current directory)]:DIR:_files -/'
5053
-o'[Write output to <filename>. Ignored if more than one --emit is specified.]:FILENAME:_files'
51-
--opt-level='[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)'
5254
--pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"'
5355
-L'[Add a directory to the library search path]:DIR:_files -/'
5456
--target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:'
5557
--color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"'
5658
{-v,--version}'[Print version info and exit]::VERBOSE:(verbose)'
5759
--explain='[Provide a detailed explanation of an error message]:OPT:'
5860
--extern'[Specify where an external rust library is located]:ARG:'
61+
--print='[Comma separated list of compiler information to print on stdout]:TYPES:_values -s "," "Compiler Information" "$_rustc_info_types[@]"'
5962
)
6063

6164
_rustc_opts_switches=(
62-
-g'[Equivalent to --debuginfo=2]'
63-
{-h,--help}'[Display this message]'
64-
--no-analysis'[Parse and expand the output, but run no analysis or produce output]'
65-
--no-trans'[Run all passes except translation; no output]'
66-
-O'[Equivalent to --opt-level=2]'
67-
--parse-only'[Parse only; do not compile, assemble, or link]'
68-
--print-crate-name'[Output the crate name and exit]'
69-
--print-file-name'[Output the file(s) that would be written if compilation continued and exit]'
65+
-g'[Equivalent to -C debuginfo=2]'
66+
{-h,--help}'[Display the help message]'
67+
{-V,--verbose}'[use verbose output]'
68+
-O'[Equivalent to -C opt-level=2]'
7069
--test'[Build a test harness]'
7170
)
71+
72+
73+
_rustc_opts_link=(
74+
'static[Path to the library to link statically]:PATH:_files -/'
75+
'dylib[Path to the library to link dynamically]:PATH:_files -/'
76+
'framework[Path to the library to link as a framework]:PATH:_files -/'
77+
)
78+
7279
_rustc_opts_codegen=(
73-
'ar=[Path to the archive utility to use when assembling archives.]:BIN:_path_files'
74-
'linker=[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files'
75-
'link-args=[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:'
76-
'target-cpu=[Selects a target processor. If the value is "help", then a list of available CPUs is printed.]:CPU:'
77-
'target-feature=[A space-separated list of features to enable or disable for the target. A preceding "+" enables a feature while a preceding "-" disables it. Available features can be discovered through target-cpu=help.]:FEATURE:'
78-
'passes=[A space-separated list of extra LLVM passes to run. A value of "list" will cause rustc to print all known passes and exit. The passes specified are appended at the end of the normal pass manager.]:LIST:'
79-
'llvm-args=[A space-separated list of arguments to pass through to LLVM.]:ARGS:'
80+
'ar[Path to the archive utility to use when assembling archives.]:BIN:_path_files'
81+
'linker[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files'
82+
'link-args[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:'
83+
'lto[Perform LLVM link-time optimizations]'
84+
'target-cpu[Selects a target processor. If the value is "help", then a list of available CPUs is printed.]:CPU:'
85+
'target-feature[A space-separated list of features to enable or disable for the target. A preceding "+" enables a feature while a preceding "-" disables it. Available features can be discovered through target-cpu=help.]:FEATURE:'
86+
'passes[A space-separated list of extra LLVM passes to run. A value of "list" will cause rustc to print all known passes and exit. The passes specified are appended at the end of the normal pass manager.]:LIST:'
87+
'llvm-args[A space-separated list of arguments to pass through to LLVM.]:ARGS:'
8088
'save-temps[If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated throughout compilation in the output directory.]'
8189
'rpath[If specified, then the rpath value for dynamic libraries will be set in either dynamic library or executable outputs.]'
8290
'no-prepopulate-passes[Suppresses pre-population of the LLVM pass manager that is run over the module.]'
@@ -86,55 +94,62 @@ _rustc_opts_codegen=(
8694
'prefer-dynamic[Prefers dynamic linking to static linking.]'
8795
"no-integrated-as[Force usage of an external assembler rather than LLVM's integrated one.]"
8896
'no-redzone[disable the use of the redzone]'
89-
'relocation-model=[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)'
90-
'code-model=[choose the code model to use (llc -code-model for details)]:MODEL:'
91-
'metadata=[metadata to mangle symbol names with]:VAL:'
92-
'extra-filenames=[extra data to put in each output filename]:VAL:'
93-
'codegen-units=[divide crate into N units to optimize in parallel]:N:'
97+
'relocation-model[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)'
98+
'code-model[choose the code model to use (llc -code-model for details)]:MODEL:'
99+
'metadata[metadata to mangle symbol names with]:VAL:'
100+
'extra-filenames[extra data to put in each output filename]:VAL:'
101+
'codegen-units[divide crate into N units to optimize in parallel]:N:'
102+
'remark[print remarks for these optimization passes (space separated, or "all")]:TYPE:'
103+
'debuginfo[debug info emission level, 0 = no debug info, 1 = line tables only, 2 = full debug info with variable and type information]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"'
104+
'opt-level[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)'
94105
'help[Show all codegen options]'
95106
)
96107

97108
_rustc_opts_lint=(
98109
'help[Show a list of all lints]'
99-
'experimental[detects use of #\[experimental\] items]'
100-
'heap-memory[use of any (Box type or @ type) heap memory]'
101-
'managed-heap-memory[use of managed (@ type) heap memory]'
102-
'missing-doc[detects missing documentation for public members]'
103-
'non-uppercase-statics[static constants should have uppercase identifiers]'
104-
'owned-heap-memory[use of owned (~ type) heap memory]'
105-
'unnecessary-qualification[detects unnecessarily qualified names]'
106-
'unsafe-block[usage of an `unsafe` block]'
107-
'unstable[detects use of #\[unstable\] items (incl. items with no stability attribute)]'
108-
'unused-result[unused result of an expression in a statement]'
109-
'variant-size-difference[detects enums with widely varying variant sizes]'
110-
'ctypes[proper use of libc types in foreign modules]'
111-
'dead-assignment[detect assignments that will never be read]'
112-
'dead-code[detect piece of code that will never be used]'
113-
'deprecated[detects use of #\[deprecated\] items]'
114-
'non-camel-case-types[types, variants and traits should have camel case names]'
115-
'non-snake-case[methods, functions, lifetime parameters and modules should have snake case names]'
116-
'path-statement[path statements with no effect]'
117-
'raw-pointer-deriving[uses of #\[deriving\] with raw pointers are rarely correct]'
118-
'type-limits[comparisons made useless by limits of the types involved]'
119-
'type-overflow[literal out of range for its type]'
120-
'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
121-
'unnecessary-parens[`if`, `match`, `while` and `return` do not need parentheses]'
122-
'unreachable-code[detects unreachable code]'
123-
'unrecognized-lint[unrecognized lint attribute]'
124-
'unsigned-negate[using an unary minus operator on unsigned type]'
125-
'unused-attribute[detects attributes that were not used by the compiler]'
126-
'unused-imports[imports that are never used]'
127-
'unused-must-use[unused result of a type flagged as #\[must_use\]]'
128-
"unused-mut[detect mut variables which don't need to be mutable]"
129-
'unused-unsafe[unnecessary use of an `unsafe` block]'
130-
'unused-variable[detect variables which are not used in any way]'
131-
'visible-private-types[detect use of private types in exported type signatures]'
132-
'warnings[mass-change the level for lints which produce warnings]'
133-
'while-true[suggest using `loop { }` instead of `while true { }`]'
134-
'unknown-crate-type[unknown crate type found in #\[crate_type\] directive]'
135-
'unknown-features[unknown features found in crate-level #\[feature\] directives]'
136-
'bad-style[group of non_camel_case_types, non_snake_case, non_uppercase_statics]'
137-
'unused[group of unused_imports, unused_variable, dead_assignment, dead_code, unused_mut, unreachable_code]'
110+
'box-pointers[(default: allow) use of owned (Box type) heap memory]'
111+
'experimental[(default: allow) detects use of #\[experimental\] items]'
112+
'fat-ptr-transmutes[(default: allow) detects transmutes of fat pointers]'
113+
'missing-docs[(default: allow) detects missing documentation for public members]'
114+
'unsafe-blocks[(default: allow) usage of an "unsafe" block]'
115+
'unstable[(default: allow) detects use of #\[unstable\] items (incl. items with no stability attribute)]'
116+
'unused-extern-crates[(default: allow) extern crates that are never used]'
117+
'unused-import-braces[(default: allow) unnecessary braces around an imported item]'
118+
'unused-qualifications[(default: allow) detects unnecessarily qualified names]'
119+
'unused-results[(default: allow) unused result of an expression in a statement]'
120+
'unused-typecasts[(default: allow) detects unnecessary type casts that can be removed]'
121+
'variant-size-differences[(default: allow) detects enums with widely varying variant sizes]'
122+
'dead-code[(default: warn) detect unused, unexported items]'
123+
'deprecated[(default: warn) detects use of #\[deprecated\] items]'
124+
'improper-ctypes[(default: warn) proper use of libc types in foreign modules]'
125+
'missing-copy-implementations[(default: warn) detects potentially-forgotten implementations of "Copy"]'
126+
'non-camel-case-types[(default: warn) types, variants, traits and type parameters should have camel case names]'
127+
'non-shorthand-field-patterns[(default: warn) using "Struct { x: x }" instead of "Struct { x }"]'
128+
'non-snake-case[(default: warn) methods, functions, lifetime parameters and modules should have snake case names]'
129+
'non-upper-case-globals[(default: warn) static constants should have uppercase identifiers]'
130+
'overflowing-literals[(default: warn) literal out of range for its type]'
131+
'path-statements[(default: warn) path statements with no effect]'
132+
'raw-pointer-deriving[(default: warn) uses of #\[derive\] with raw pointers are rarely correct]'
133+
'unknown-lints[(default: warn) unrecognized lint attribute]'
134+
'unreachable-code[(default: warn) detects unreachable code paths]'
135+
'unsigned-negation[(default: warn) using an unary minus operator on unsigned type]'
136+
'unused-allocation[(default: warn) detects unnecessary allocations that can be eliminated]'
137+
'unused-assignments[(default: warn) detect assignments that will never be read]'
138+
'unused-attributes[(default: warn) detects attributes that were not used by the compiler]'
139+
'unused-comparisons[(default: warn) comparisons made useless by limits of the types involved]'
140+
'unused-imports[(default: warn) imports that are never used]'
141+
'unused-must-use[(default: warn) unused result of a type flagged as must_use]'
142+
"unused-mut[(default: warn) detect mut variables which don't need to be mutable]"
143+
'unused-parens[(default: warn) "if", "match", "while" and "return" do not need parentheses]'
144+
'unused-unsafe[(default: warn) unnecessary use of an "unsafe" block]'
145+
'unused-variables[(default: warn) detect variables which are not used in any way]'
146+
'warnings[(default: warn) mass-change the level for lints which produce warnings]'
147+
'while-true[(default: warn) suggest using "loop { }" instead of "while true { }"]'
148+
"exceeding-bitshifts[(default: deny) shift exceeds the type's number of bits]"
149+
'unknown-crate-types[(default: deny) unknown crate type found in #\[crate_type\] directive]'
150+
'unknown-features[(default: deny) unknown features found in crate-level #\[feature\] directives]'
151+
'bad-style[non-camel-case-types, non-snake-case, non-upper-case-globals]'
152+
'unused[unused-imports, unused-variables, unused-assignments, dead-code, unused-mut, unreachable-code, unused-must-use, unused-unsafe, path-statements]'
138153
)
139154

140155
_rustc_opts_debug=(
@@ -151,11 +166,9 @@ _rustc_opts_debug=(
151166
'show-span[show spans for compiler debugging]'
152167
'count-type-sizes[count the sizes of aggregate types]'
153168
'meta-stats[gather metadata statistics]'
154-
'no-opt[do not optimize, even if -O is passed]'
155169
'print-link-args[Print the arguments passed to the linker]'
156170
'gc[Garbage collect shared data (experimental)]'
157171
'print-llvm-passes[Prints the llvm optimization passes being run]'
158-
'lto[Perform LLVM link-time optimizations]'
159172
'ast-json[Print the AST as JSON and halt]'
160173
'ast-json-noexpand[Print the pre-expansion AST as JSON and halt]'
161174
'ls[List the symbols defined by a library crate]'
@@ -164,6 +177,12 @@ _rustc_opts_debug=(
164177
'flowgraph-print-moves[Include move analysis data in --pretty flowgraph output]'
165178
'flowgraph-print-assigns[Include assignment analysis data in --pretty flowgraph output]'
166179
'flowgraph-print-all[Include all dataflow analysis data in --pretty flowgraph output]'
180+
'print-regiion-graph[Prints region inference graph. Use with RUST_REGION_GRAPH=help for more info]'
181+
'parse-only[Parse only; do not compile, assemble, or link]'
182+
'no-trans[Run all passes except translation; no output]'
183+
'no-analysis[Parse and expand the source, but run no analysis]'
184+
'unstable-options[Adds unstable command line options to rustc interface]'
185+
'print-enum-sizes[Print the size of enums and their variants]'
167186
)
168187

169188
_rustc_opts_fun_lint(){
@@ -179,13 +198,18 @@ _rustc_opts_fun_codegen(){
179198
_values 'options' "$_rustc_opts_codegen[@]"
180199
}
181200

201+
_rustc_opts_fun_link(){
202+
_values 'options' "$_rustc_opts_link[@]"
203+
}
204+
182205
_arguments -s : \
183206
'(-W --warn)'{-W,--warn=}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \
184207
'(-A --allow)'{-A,--allow=}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \
185208
'(-D --deny)'{-D,--deny=}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \
186209
'(-F --forbid)'{-F,--forbid=}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \
187210
'*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \
188-
'*-C[Set internal Codegen options]:codegen options:_rustc_opts_fun_codegen' \
211+
'(-C --codegen)'{-C,--codegen}'[Set internal Codegen options]:codegen options:_rustc_opts_fun_codegen' \
212+
'*-l[Link the generated crates to the specified native library NAME. the optional KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed.]:ARG:_rustc_opts_fun_link' \
189213
"$_rustc_opts_switches[@]" \
190214
"$_rustc_opts_vals[@]" \
191215
'::files:_files -g "*.rs"'

0 commit comments

Comments
 (0)