3 local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug
8 --android-cross-path'[The path to the Android NDK]'
9 --ar'[Program to use for managing archives instead of the default.]'
10 --bin'[Compile an executable crate (default)]'
11 -c'[Compile and assemble, but do not link]'
12 --cfg'[Configure the compilation environment]'
13 --crate-id'[Output the crate id and exit]'
14 --crate-file-name'[Output the file(s) that would be written if compilation continued and exit]'
15 --crate-name'[Output the crate name and exit]'
16 --dep-info'[Output dependency info to <filename> after compiling]'
17 --dylib'[Compile a dynamic library crate]'
18 --emit-llvm'[Produce an LLVM bitcode file]'
19 {-h,--help}'[Display this message]'
20 -L'[Add a directory to the library search path]'
21 --lib'[Compile a library crate]'
22 --linker'[Program to use for linking instead of the default.]'
23 --link-args'[FLAGS is a space-separated list of flags passed to the linker]'
24 --llvm-args'[A list of arguments to pass to llvm, comma separated]'
25 --ls'[List the symbols defined by a library crate]'
26 --no-analysis'[Parse and expand the output, but run no analysis or produce output]'
27 --no-rpath'[Disables setting the rpath in libs/exes]'
28 --no-trans'[Run all passes except translation; no output]'
29 -O'[Equivalent to --opt-level=2]'
30 -o'[Write output to <filename>]'
31 --opt-level'[Optimize with possible levels 0-3]'
32 --out-dir'[Write output to compiler-chosen filename in <dir>]'
33 --parse-only'[Parse only; do not compile, assemble, or link]'
34 --passes'[Comma or space separated list of pass names to use]'
35 --pretty'[Pretty-print the input instead of compiling]'
36 --rlib'[Compile a rust library crate as an rlib file]'
37 -S'[Compile only; do not assemble or link]'
38 --save-temps'[Write intermediate files (.bc, .opt.bc, .o) in addition to normal output]'
39 --staticlib'[Compile a static library crate]'
40 --sysroot'[Override the system root]'
41 --test'[Build a test harness]'
42 --target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
43 --target-cpu'[Select target processor (llc -mcpu=help for details)]'
44 --target-feature'[Target specific attributes (llc -mattr=help for details)]'
45 {-v,--version}'[Print version info and exit]'
48 'attribute-usage[detects bad use of attributes]'
49 'ctypes[proper use of std::libc types in foreign modules]'
50 'dead-assignment[detect assignments that will never be read]'
51 'dead-code[detect piece of code that will never be used]'
52 'default-type-param-usage[prevents explicitly setting a type parameter with a default]'
53 'deprecated[detects use of #\[deprecated\] items]'
54 'experimental[detects use of #\[experimental\] items]'
55 'heap-memory[use of any (~ type or @ type) heap memory]'
56 'managed-heap-memory[use of managed (@ type) heap memory]'
57 'missing-doc[detects missing documentation for public members]'
58 'non-camel-case-types[types, variants and traits should have camel case names]'
59 'non-uppercase-pattern-statics[static constants in match patterns should be all caps]'
60 'non-uppercase-statics[static constants should have uppercase identifiers]'
61 'owned-heap-memory[use of owned (~ type) heap memory]'
62 'path-statement[path statements with no effect]'
63 'type-limits[comparisons made useless by limits of the types involved]'
64 'type-overflow[literal out of range for its type]'
65 'unknown-crate-type[unknown crate type found in #\[crate_type\] directive]'
66 'unknown-features[unknown features found in crate-level #\[feature\] directives]'
67 'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
68 'unnecessary-parens[`if`, `match`, `while` and `return` do not need parentheses]'
69 'unnecessary-qualification[detects unnecessarily qualified names]'
70 'unnecessary-typecast[detects unnecessary type casts, that can be removed]'
71 'unreachable-code[detects unreachable code]'
72 'unrecognized-lint[unrecognized lint attribute]'
73 'unsafe-block[usage of an `unsafe` block]'
74 'unstable[detects use of #\[unstable\] items (incl. items with no stability attribute)]'
75 'unused-imports[imports that are never used]'
76 'unused-must-use[unused result of an type flagged as #\[must_use\]]'
77 "unused-mut[detect mut variables which don't need to be mutable]"
78 'unused-result[unused result of an expression in a statement]'
79 'unused-unsafe[unnecessary use of an `unsafe` block]'
80 'unused-variable[detect variables which are not used in any way]'
81 'warnings[mass-change the level for lints which produce warnings]'
82 'while-true[suggest using `loop { }` instead of `while true { }`]'
86 'asm-comments[generate comments into the assembly (may change behavior)]'
87 'borrowck-stats[gather borrowck statistics]'
88 'count-llvm-insns[count where LLVM instrs originate]'
89 'count-type-sizes[count the sizes of aggregate types]'
90 'debug-info[Produce debug info (experimental)]'
91 'debug-llvm[enable debug output from LLVM]'
92 'extra-debug-info[Extra debugging info (experimental)]'
93 'gc[Garbage collect shared data (experimental)]'
94 'gen-crate-map[Force generation of a toplevel crate map]'
95 'lto[Perform LLVM link-time optimizations]'
96 'meta-stats[gather metadata statistics]'
97 "no-integrated-as[Use external assembler rather than LLVM's integrated one]"
98 'no-landing-pads[omit landing pads for unwinding]'
99 'no-opt[do not optimize, even if -O is passed]'
100 "no-prepopulate-passes[Don't pre-populate the pass managers with a list of passes, only use the passes from --passes]"
101 "no-vectorize-loops[Don't run the loop vectorization optimization passes]"
102 "no-vectorize-slp[Don't run LLVM's SLP vectorization passes]"
103 'no-verify[skip LLVM verification]'
104 'prefer-dynamic[Prefer dynamic linking to static linking]'
105 'print-link-args[Print the arguments passed to the linker]'
106 'print-llvm-passes[Prints the llvm optimization passes being run]'
107 'soft-float[Generate software floating point library calls]'
108 'time-llvm-passes[measure time of each LLVM pass]'
109 'time-passes[measure time of each rustc pass]'
110 'trans-stats[gather trans statistics]'
111 'verbose[in general, enable more debug printouts]'
114 _rustc_opts_fun_lint(){
115 _values -s , 'options' \
116 "$_rustc_opts_lint[@]"
119 _rustc_opts_fun_debug(){
120 _describe 'options' _rustc_opts_debug
124 '(-W --warn)'{-W,--warn}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \
125 '(-A --allow)'{-A,--allow}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \
126 '(-D --deny)'{-D,--deny}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \
127 '(-F --forbid)'{-F,--forbid}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \
128 '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \
129 "$_rustc_opts_switches[@]" \
130 '*::files:_files -g "*.rs"'