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