2017-01-16 06:51:10 +08:00
|
|
|
complete -c rustc -s h -l help
|
2015-09-20 03:04:53 +08:00
|
|
|
|
|
|
|
complete -c rustc -x -l cfg
|
2024-05-18 01:32:41 +08:00
|
|
|
complete -c rustc -x -l check-cfg -d "Provide list of expected cfgs for checking"
|
2021-01-04 00:53:33 +08:00
|
|
|
complete -c rustc -r -s L -a 'dependency= crate= native= framework= all='
|
2015-09-20 03:04:53 +08:00
|
|
|
complete -c rustc -x -s l -a 'dylib= static= framework='
|
2024-05-18 01:32:41 +08:00
|
|
|
complete -c rustc -x -l crate-type -a 'bin lib rlib dylib cdylib staticlib proc-macro'
|
2015-09-20 03:04:53 +08:00
|
|
|
complete -c rustc -r -l crate-name
|
2024-05-18 01:33:56 +08:00
|
|
|
complete -c rustc -x -l edition -a '2015 2018 2021' -d "Specify compiler edition"
|
2021-01-04 00:53:33 +08:00
|
|
|
complete -c rustc -x -l emit -a 'asm llvm-bc llvm-ir obj link dep-info metadata mir'
|
2024-05-18 01:32:41 +08:00
|
|
|
set -l rustc_print_infos \
|
|
|
|
crate-name file-names sysroot target-libdir cfg calling-conventions \
|
|
|
|
target-list target-cpus target-features relocation-models code-models \
|
|
|
|
tls-models target-spec-json all-target-specs-json native-static-libs \
|
|
|
|
stack-protector-strategies link-args deployment-target
|
2024-05-18 01:33:56 +08:00
|
|
|
complete -c rustc -x -l print -a "$rustc_print_infos" -d "Print compiler information"
|
2024-05-18 01:32:41 +08:00
|
|
|
complete -c rustc -s g -d "Equivalent to -C debuginfo=2"
|
|
|
|
complete -c rustc -s O -d "Equivalent to -C opt-level=2"
|
|
|
|
complete -c rustc -r -s o -d "Write output to <filename>"
|
2015-09-20 03:04:53 +08:00
|
|
|
complete -c rustc -r -l out-dir
|
|
|
|
complete -c rustc -x -l explain
|
|
|
|
complete -c rustc -l test
|
|
|
|
complete -c rustc -l target
|
|
|
|
complete -c rustc -x -l cap-lints
|
|
|
|
complete -c rustc -s V -l version -d 'Print version info and exit'
|
|
|
|
complete -c rustc -s v -l verbose -d 'Use verbose output'
|
|
|
|
complete -c rustc -f -l extern
|
|
|
|
complete -c rustc -f -l sysroot
|
|
|
|
complete -c rustc -x -l color -a 'auto always never'
|
|
|
|
|
2024-05-19 01:34:18 +08:00
|
|
|
complete -c rustc -s C -l codegen -xa "(rustc -C help 2>/dev/null | string match -rv 'option is deprecated' | string replace -rf -i '(\s+)-C\s*(.+)=val(\s+)--(\s+)([^\n]+)' '\$2='\t'\$5')"
|
2015-09-20 03:04:53 +08:00
|
|
|
|
2017-10-19 00:47:21 +08:00
|
|
|
# rustc -Z is only available with the nightly toolchain, which may not be installed
|
|
|
|
if rustc +nightly >/dev/null 2>&1
|
2022-04-21 23:35:00 +08:00
|
|
|
set -l rust_docs (rustc +nightly -Z help 2>/dev/null \
|
2017-10-19 00:47:21 +08:00
|
|
|
| string replace -r -i '(\s+)-Z(.+)--(\s+)([^\n]+)' '$2 $4' \
|
|
|
|
| string trim \
|
|
|
|
| string match -r '^.*[^:]$')
|
2015-09-20 03:04:53 +08:00
|
|
|
|
2017-10-19 00:47:21 +08:00
|
|
|
for line in $rust_docs
|
2024-03-19 23:49:46 +08:00
|
|
|
set -l docs (string split -m 1 ' ' -- $line)
|
2020-05-15 13:56:06 +08:00
|
|
|
set -l flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
|
2017-10-19 00:47:21 +08:00
|
|
|
$docs[1])
|
2018-09-21 07:59:57 +08:00
|
|
|
complete -c rustc -x -s Z -a (string escape -- "$flag") -d "$docs[2]"
|
2017-10-19 00:47:21 +08:00
|
|
|
end
|
2015-09-20 03:04:53 +08:00
|
|
|
end
|
|
|
|
|
2022-04-21 23:35:00 +08:00
|
|
|
set -l rust_docs (rustc -W help 2>/dev/null \
|
2016-04-08 10:46:51 +08:00
|
|
|
| string match -r \
|
|
|
|
'(?:\s+)(?:.+)(?:\s+)(?:allow|warn|deny|forbid)(?:\s+){2}(?:[^\n]+)' \
|
2015-09-20 03:04:53 +08:00
|
|
|
| string replace -r -i \
|
|
|
|
'(\s+)(.+)(\s+)(allow|warn|deny|forbid)(\s+){2}([^\n]+)' '$2 $6' \
|
|
|
|
| string match -r '^.*[^:]$' \
|
2016-04-08 10:46:51 +08:00
|
|
|
| string match -r -v '^(allow|warn|deny|forbid)$' \
|
|
|
|
| string match -r -v '^([a-z\-]+)(\s+)(allow|warn|deny|forbid)')
|
2015-09-20 03:04:53 +08:00
|
|
|
|
|
|
|
for line in $rust_docs
|
2024-03-19 23:49:46 +08:00
|
|
|
set -l docs (string split -m 1 ' ' -- $line)
|
2018-09-21 07:59:57 +08:00
|
|
|
complete -c rustc -x -s W -l warn -a (string escape -- "$docs[1]") -d "$docs[2]"
|
|
|
|
complete -c rustc -x -s A -l allow -a (string escape -- "$docs[1]") -d "$docs[2]"
|
|
|
|
complete -c rustc -x -s D -l deny -a (string escape -- "$docs[1]") -d "$docs[2]"
|
|
|
|
complete -c rustc -x -s F -l forbid -a (string escape -- "$docs[1]") -d "$docs[2]"
|
2015-09-20 03:04:53 +08:00
|
|
|
end
|