Skip to content

Commit 8e24697

Browse files
committed
rust_is_available: exit showing the documentation
exit function providing a documentation link Signed-off-by: Alice Ferrazzi <[email protected]>
1 parent bd12347 commit 8e24697

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

scripts/rust_is_available.sh

+12-6
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@ get_canonical_version()
2121
echo $((100000 * $1 + 100 * $2 + $3))
2222
}
2323

24+
_show_documentation_on_exit() {
25+
echo >&2 "*** Please refer to Documentation/rust/quick-start.rst"
26+
echo >&2 "***"
27+
exit 1
28+
}
29+
2430
# Check that the Rust compiler exists.
2531
if ! command -v "$RUSTC" >/dev/null; then
2632
if [ "$1" = -v ]; then
2733
echo >&2 "***"
2834
echo >&2 "*** Rust compiler '$RUSTC' could not be found."
2935
echo >&2 "***"
3036
fi
31-
exit 1
37+
_show_documentation_on_exit
3238
fi
3339

3440
# Check that the Rust bindings generator exists.
@@ -38,7 +44,7 @@ if ! command -v "$BINDGEN" >/dev/null; then
3844
echo >&2 "*** Rust bindings generator '$BINDGEN' could not be found."
3945
echo >&2 "***"
4046
fi
41-
exit 1
47+
_show_documentation_on_exit
4248
fi
4349

4450
# Check that the Rust compiler version is suitable.
@@ -60,7 +66,7 @@ if [ "$rust_compiler_cversion" -lt "$rust_compiler_min_cversion" ]; then
6066
echo >&2 "*** Minimum version: $rust_compiler_min_version"
6167
echo >&2 "***"
6268
fi
63-
exit 1
69+
_show_documentation_on_exit
6470
fi
6571
if [ "$1" = -v ] && [ "$rust_compiler_cversion" -gt "$rust_compiler_min_cversion" ]; then
6672
echo >&2 "***"
@@ -89,7 +95,7 @@ if [ "$rust_bindings_generator_cversion" -lt "$rust_bindings_generator_min_cvers
8995
echo >&2 "*** Minimum version: $rust_bindings_generator_min_version"
9096
echo >&2 "***"
9197
fi
92-
exit 1
98+
_show_documentation_on_exit
9399
fi
94100
if [ "$1" = -v ] && [ "$rust_bindings_generator_cversion" -gt "$rust_bindings_generator_min_cversion" ]; then
95101
echo >&2 "***"
@@ -117,7 +123,7 @@ if [ "$bindgen_libclang_cversion" -lt "$bindgen_libclang_min_cversion" ]; then
117123
echo >&2 "*** Minimum version: $bindgen_libclang_min_version"
118124
echo >&2 "***"
119125
fi
120-
exit 1
126+
_show_documentation_on_exit
121127
fi
122128

123129
# If the C compiler is Clang, then we can also check whether its version
@@ -156,5 +162,5 @@ if [ ! -e "$rustc_src_core" ]; then
156162
echo >&2 "*** at '$rustc_src_core'."
157163
echo >&2 "***"
158164
fi
159-
exit 1
165+
_show_documentation_on_exit
160166
fi

0 commit comments

Comments
 (0)