aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/Rust.md
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-07-10 11:27:32 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2024-07-10 21:37:06 +0300
commit43bcaacfc9f6ed6217d2b4e3956fa3cffc207998 (patch)
tree1338968d4eee4d0b841e96a0f7331c38b09b3092 /docs/markdown/Rust.md
parent47fd13aefcb3f1b9494b0b248073ed6e388b1dac (diff)
downloadmeson-43bcaacfc9f6ed6217d2b4e3956fa3cffc207998.zip
meson-43bcaacfc9f6ed6217d2b4e3956fa3cffc207998.tar.gz
meson-43bcaacfc9f6ed6217d2b4e3956fa3cffc207998.tar.bz2
docs: explain not to use extern crate in Rust code
Diffstat (limited to 'docs/markdown/Rust.md')
-rw-r--r--docs/markdown/Rust.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/markdown/Rust.md b/docs/markdown/Rust.md
index 151aac0..74f6844 100644
--- a/docs/markdown/Rust.md
+++ b/docs/markdown/Rust.md
@@ -5,6 +5,24 @@ short-description: Working with Rust in Meson
# Using Rust with Meson
+## Avoid using `extern crate`
+
+Meson can't track dependency information for crates linked by rustc as
+a result of `extern crate` statements in Rust source code. If your
+crate dependencies are properly expressed in Meson, there should be no
+need for `extern crate` statements in your Rust code.
+
+An example of the problems with `extern crate` is that if you delete a
+crate from a Meson build file, other crates that depend on that crate
+using `extern crate` might continue linking with the leftover rlib of
+the deleted crate rather than failing to build, until the build
+directory is cleaned.
+
+This limitation could be resolved in future with rustc improvements,
+for example if the [`-Z
+binary-dep-depinfo`](https://github.com/rust-lang/rust/issues/63012)
+feature is stabilized.
+
## Mixing Rust and non-Rust sources
Meson currently does not support creating a single target with Rust and non Rust