]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/rust/_rustc
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / rust / _rustc
1 #compdef rustc
2
3 local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug
4
5 typeset -A opt_args
6
7 _rustc_debuginfo_levels=(
8     "0[no debug info]"
9     "1[line-tables only (for stacktraces and breakpoints)]"
10     "2[full debug info with variable and type information (same as -g)]"
11 )
12
13 _rustc_crate_types=(
14     'bin'
15     'lib'
16     'rlib'
17     'dylib'
18     'cdylib'
19     'staticlib'
20     'proc-macro'
21 )
22
23 _rustc_emit_types=(
24     'asm'
25     'llvm-bc'
26     'llvm-ir'
27     'obj'
28     'metadata'
29     'link'
30     'dep-info'
31     'mir'
32 )
33 _rustc_print_types=(
34     'crate-name'
35     'file-names'
36     'sysroot'
37     'cfg'
38     'target-list'
39     'target-cpus'
40     'target-features'
41     'relocation-models'
42     'code-models'
43     'target-spec-json'
44     'native-static-libs'
45 )
46 _rustc_pretty_types=(
47     'normal[un-annotated source]'
48     'expanded[crates expanded]'
49     'expanded,identified[fully parenthesized, AST nodes with IDs]'
50 )
51 _rustc_unpretty_types=(
52     'normal[un-annotated source]'
53     'expanded[crates expanded]'
54     'expanded,identified[fully parenthesized, AST nodes with IDs]'
55     'flowgraph=[graphviz formatted flowgraph for node]:NODEID:'
56     'everybody_loops[all function bodies replaced with `loop {}`]'
57     'hir[the HIR]'
58     'hir,identified'
59     'hir,typed[HIR with types for each node]'
60 )
61 _rustc_color_types=(
62     'auto[colorize, if output goes to a tty (default)]'
63     'always[always colorize output]'
64     'never[never colorize output]'
65 )
66 _rustc_error_format=(
67     'human'
68     'json'
69 )
70
71 _rustc_opts_vals=(
72     --cfg='[Configure the compilation environment]:SPEC:'
73     -L'[Add a directory to the library search path]:DIR:_files -/'
74     --crate-name='[Specify the name of the crate being built]'
75     --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types"  "$_rustc_crate_types[@]"'
76     --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"'
77     --print='[Comma separated list of compiler information to print on stdout]:TYPES:_values -s "," "Printable info" "$_rustc_print_types[@]"'
78     -o'[Write output to <filename>. Ignored if more than one --emit is specified.]:FILENAME:_files'
79     --out-dir='[Write output to compiler-chosen filename in <dir>.  Ignored  if  -o  is  specified. (default the current directory)]:DIR:_files -/'
80     --explain='[Provide a detailed explanation of an error message]:OPT:'
81     --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:'
82     --extern'[Specify where an external rust library is located]:ARG:'
83     --sysroot='[Override the system root]:PATH:_files -/'
84     --error-format='[How errors and other messages are produced]:TYPES:_values "$_rustc_error_format"'
85     --debuginfo='[Emit DWARF debug info to the objects created]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"'
86     --dep-info='[Output dependency info to <filename> after compiling]::FILE:_files -/'
87     --opt-level='[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)'
88     --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"'
89     --unpretty='[Present the input source, unstable (and less-pretty)]::TYPE:_values "TYPES" "$_rustc_unpretty_types[@]"'
90     --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"'
91 )
92
93 _rustc_opts_switches=(
94     -g'[Equivalent to --debuginfo=2]'
95     -O'[Equivalent to --opt-level=2]'
96     --test'[Build a test harness]'
97     {-v,--verbose}'[Use verbose output]'
98     {-V,--version}'[Print version info and exit]'
99     {-h,--help}'[Display this message]'
100     --no-analysis'[Parse and expand the output, but run no analysis or produce output]'
101     --no-trans'[Run all passes except translation; no output]'
102     --parse-only'[Parse only; do not compile, assemble, or link]'
103     --print-crate-name'[Output the crate name and exit]'
104     --print-file-name'[Output the file(s) that would be written if compilation continued and exit]'
105 )
106 _rustc_opts_codegen=(
107     'ar=[Path to the archive utility to use when assembling archives.]:BIN:_path_files'
108     'linker=[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files'
109     'link-args=[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:'
110     'target-cpu=[Selects a target processor. If the value is "help", then a list of  available  CPUs is printed.]:CPU:'
111     '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:'
112     '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:'
113     'llvm-args=[A space-separated list of arguments to pass through to LLVM.]:ARGS:'
114     'save-temps[If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated throughout compilation in the output directory.]'
115     'rpath[If specified, then the rpath value for dynamic libraries will be set in either dynamic library or executable outputs.]'
116     'no-prepopulate-passes[Suppresses pre-population of the LLVM pass manager that is run over the module.]'
117     'no-vectorize-loops[Suppresses running the loop vectorization LLVM pass, regardless of optimization level.]'
118     'no-vectorize-slp[Suppresses running the LLVM SLP vectorization pass, regardless of optimization level.]'
119     'soft-float[Generates software floating point library calls instead of hardware instructions.]'
120     'prefer-dynamic[Prefers dynamic linking to static linking.]'
121     "no-integrated-as[Force usage of an external assembler rather than LLVM's integrated one.]"
122     'no-redzone[disable the use of the redzone]'
123     'relocation-model=[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)'
124     'code-model=[choose the code model to use (llc -code-model for details)]:MODEL:'
125     'metadata=[metadata to mangle symbol names with]:VAL:'
126     'extra-filenames=[extra data to put in each output filename]:VAL:'
127     'codegen-units=[divide crate into N units to optimize in parallel]:N:'
128     'help[Show all codegen options]'
129 )
130
131 _rustc_opts_lint=(
132     'help[Show a list of all lints]'
133     'experimental[detects use of #\[experimental\] items]'
134     'heap-memory[use of any (Box type or @ type) heap memory]'
135     'managed-heap-memory[use of managed (@ type) heap memory]'
136     'missing-doc[detects missing documentation for public members]'
137     'non-uppercase-statics[static constants should have uppercase identifiers]'
138     'owned-heap-memory[use of owned (~ type) heap memory]'
139     'unnecessary-qualification[detects unnecessarily qualified names]'
140     'unsafe-block[usage of an `unsafe` block]'
141     'unstable[detects use of #\[unstable\] items (incl. items with no stability attribute)]'
142     'unused-result[unused result of an expression in a statement]'
143     'variant-size-difference[detects enums with widely varying variant sizes]'
144     'ctypes[proper use of libc types in foreign modules]'
145     'dead-assignment[detect assignments that will never be read]'
146     'dead-code[detect piece of code that will never be used]'
147     'deprecated[detects use of #\[deprecated\] items]'
148     'non-camel-case-types[types, variants and traits should have camel case names]'
149     'non-snake-case[methods, functions, lifetime parameters and modules should have snake case names]'
150     'path-statement[path statements with no effect]'
151     'raw-pointer-deriving[uses of #\[deriving\] with raw pointers are rarely correct]'
152     'type-limits[comparisons made useless by limits of the types involved]'
153     'type-overflow[literal out of range for its type]'
154     'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
155     'unnecessary-parens[`if`, `match`, `while` and `return` do not need parentheses]'
156     'unreachable-code[detects unreachable code]'
157     'unrecognized-lint[unrecognized lint attribute]'
158     'unsigned-negate[using an unary minus operator on unsigned type]'
159     'unused-attribute[detects attributes that were not used by the compiler]'
160     'unused-imports[imports that are never used]'
161     'unused-must-use[unused result of a type flagged as #\[must_use\]]'
162     "unused-mut[detect mut variables which don't need to be mutable]"
163     'unused-unsafe[unnecessary use of an `unsafe` block]'
164     'unused-variable[detect variables which are not used in any way]'
165     'visible-private-types[detect use of private types in exported type signatures]'
166     'warnings[mass-change the level for lints which produce warnings]'
167     'while-true[suggest using `loop { }` instead of `while true { }`]'
168     'unknown-crate-type[unknown crate type found in #\[crate_type\] directive]'
169     'unknown-features[unknown features found in crate-level #\[feature\] directives]'
170     'bad-style[group of non_camel_case_types, non_snake_case, non_uppercase_statics]'
171     'unused[group of unused_imports, unused_variable, dead_assignment, dead_code, unused_mut, unreachable_code]'
172 )
173
174 _rustc_opts_debug=(
175     'verbose[in general, enable more debug printouts]'
176     'span-free-formats[when debug-printing compiler state, do not include spans]'
177     "identify-regions[make unnamed regions display as '# (where # is some non-ident unique id)]"
178     'emit-end-regions[emit EndRegion as part of MIR; enable transforms that solely process EndRegion]'
179     'time-passes[measure time of each rustc pass]'
180     'count-llvm-insns[count where LLVM instrs originate]'
181     'time-llvm-passes[measure time of each LLVM pass]'
182     'trans-stats[gather trans statistics]'
183     'asm-comments[generate comments into the assembly (may change behavior)]'
184     'no-verify[skip LLVM verification]'
185     'borrowck-stats[gather borrowck statistics]'
186     'no-landing-pads[omit landing pads for unwinding]'
187     'debug-llvm[enable debug output from LLVM]'
188     'show-span[show spans for compiler debugging]'
189     'count-type-sizes[count the sizes of aggregate types]'
190     'meta-stats[gather metadata statistics]'
191     'no-opt[do not optimize, even if -O is passed]'
192     'print-link-args[Print the arguments passed to the linker]'
193     'gc[Garbage collect shared data (experimental)]'
194     'print-llvm-passes[Prints the llvm optimization passes being run]'
195     'lto[Perform LLVM link-time optimizations]'
196     'ast-json[Print the AST as JSON and halt]'
197     'ast-json-noexpand[Print the pre-expansion AST as JSON and halt]'
198     'ls[List the symbols defined by a library crate]'
199     'save-analysis[Write syntax and type analysis information in addition to normal output]'
200     'flowgraph-print-loans[Include loan analysis data in --pretty flowgraph output]'
201     'flowgraph-print-moves[Include move analysis data in --pretty flowgraph output]'
202     'flowgraph-print-assigns[Include assignment analysis data in --pretty flowgraph output]'
203     'flowgraph-print-all[Include all dataflow analysis data in --pretty flowgraph output]'
204 )
205
206 _rustc_opts_fun_lint(){
207     _values -s , 'options' \
208         "$_rustc_opts_lint[@]"
209 }
210
211 _rustc_opts_fun_debug(){
212     _values 'options' "$_rustc_opts_debug[@]"
213 }
214
215 _rustc_opts_fun_codegen(){
216     _values 'options' "$_rustc_opts_codegen[@]"
217 }
218
219 _arguments -s :  \
220     '(-W --warn)'{-W,--warn=}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \
221     '(-A --allow)'{-A,--allow=}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \
222     '(-D --deny)'{-D,--deny=}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \
223     '(-F --forbid)'{-F,--forbid=}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \
224     '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \
225     '*-C[Set internal Codegen options]:codegen options:_rustc_opts_fun_codegen' \
226     "$_rustc_opts_switches[@]" \
227     "$_rustc_opts_vals[@]" \
228     '::files:_files -g "*.rs"'