]> git.lizzy.rs Git - rust.git/blob - src/etc/zsh/_rust
auto merge of #9542 : pnkfelix/rust/fsk-fix-issue-9531, r=thestinger
[rust.git] / src / etc / zsh / _rust
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_opts_switches=(
8     --bin'[Compile an executable crate (default)]'
9     -c'[Compile and assemble, but do not link]'
10     --cfg'[Configure the compilation environment]'
11     --emit-llvm'[Produce an LLVM bitcode file]'
12     {-h,--help}'[Display this message]'
13     -L'[Add a directory to the library search path]'
14     --lib'[Compile a library crate]'
15     --linker'[Program to use for linking instead of the default.]'
16     --link-args'[FLAGS is a space-separated list of flags passed to the linker]'
17     --ls'[List the symbols defined by a library crate]'
18     --no-trans'[Run all passes except translation; no output]'
19     -O'[Equivalent to --opt-level=2]'
20     -o'[Write output to <filename>]'
21     --opt-level'[Optimize with possible levels 0-3]'
22     --out-dir'[Write output to compiler-chosen filename in <dir>]'
23     --parse-only'[Parse only; do not compile, assemble, or link]'
24     --pretty'[Pretty-print the input instead of compiling]'
25     -S'[Compile only; do not assemble or link]'
26     --save-temps'[Write intermediate files (.bc, .opt.bc, .o) in addition to normal output]'
27     --sysroot'[Override the system root]'
28     --test'[Build a test harness]'
29     --target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
30     --target-cpu'[Select target processor (llc -mcpu=help for details)]'
31     --target-feature'[Target specific attributes (llc -mattr=help for details)]'
32     --android-cross-path'[The path to the Android NDK]'
33     {-v,--version}'[Print version info and exit]'
34 )
35 _rustc_opts_lint=(
36     'path-statement[path statements with no effect]'
37     'missing-trait-doc[detects missing documentation for traits]'
38     'missing-struct-doc[detects missing documentation for structs]'
39     'ctypes[proper use of std::libc types in foreign modules]'
40     "unused-mut[detect mut variables which don't need to be mutable]"
41     'unused-imports[imports that are never used]'
42     'heap-memory[use of any (~ type or @ type) heap memory]'
43     'default-methods[allow default methods]'
44     'unused-variable[detect variables which are not used in any way]'
45     'dead-assignment[detect assignments that will never be read]'
46     'unrecognized-lint[unrecognized lint attribute]'
47     'type-limits[comparisons made useless by limits of the types involved]'
48     'unused-unsafe[unnecessary use of an `unsafe` block]'
49     'while-true[suggest using loop { } instead of while(true) { }]'
50     'non-camel-case-types[types, variants and traits should have camel case names]'
51     'managed-heap-memory[use of managed (@ type) heap memory]'
52     'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
53     'owned-heap-memory[use of owned (~ type) heap memory]'
54 )
55
56 _rustc_opts_debug=(
57     'verbose:in general, enable more debug printouts'
58     'time-passes:measure time of each rustc pass'
59     'count-llvm-insns:count where LLVM instrs originate'
60     'time-llvm-passes:measure time of each LLVM pass'
61     'trans-stats:gather trans statistics'
62     'asm-comments:generate comments into the assembly (may change behavior)'
63     'no-verify:skip LLVM verification'
64     'trace:emit trace logs'
65     'coherence:perform coherence checking'
66     'borrowck-stats:gather borrowck statistics'
67     "borrowck-note-pure:note where purity is req'd"
68     "borrowck-note-loan:note where loans are req'd"
69     'no-landing-pads:omit landing pads for unwinding'
70     'debug-llvm:enable debug output from LLVM'
71     'count-type-sizes:count the sizes of aggregate types'
72     'meta-stats:gather metadata statistics'
73     'no-opt:do not optimize, even if -O is passed'
74     'print-link-args:Print the arguments passed to the linker'
75     'gc:Garbage collect shared data (experimental)'
76     'jit:Execute using JIT (experimental)'
77     'extra-debug-info:Extra debugging info (experimental)'
78     'debug-info:Produce debug info (experimental)'
79     'static:Use or produce static libraries or binaries (experimental)'
80     'no-debug-borrows:do not show where borrow checks fail'
81     'lint-llvm:Run the LLVM lint pass on the pre-optimization IR'
82 )
83
84 _rustc_opts_fun_lint(){
85     _values -s , 'options' \
86         "$_rustc_opts_lint[@]"
87 }
88
89 _rustc_opts_fun_debug(){
90     _describe 'options' _rustc_opts_debug
91 }
92
93 _arguments -s :  \
94     '(-W --warn)'{-W,--warn}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \
95     '(-A --allow)'{-A,--allow}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \
96     '(-D --deny)'{-D,--deny}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \
97     '(-F --forbid)'{-F,--forbid}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \
98     '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \
99     "$_rustc_opts_switches[@]" \
100     '*::files:_files -g "*.rs"'