I am planning to push the first version of the Cross-Crate Inlining (CCI) work. The basic idea here is that functions marked `#[inline]` will be serialized into the crate metadata. When such a function is called, a local copy will be made in the current crate. That means that if the crate is later updated, dynamic linking will not pick up the new definition, so changes to functions marked as `#[inline]` may require recompilation for all users of a library. The feature works for simple examples but does not yet work on its intended target, things like `vec::iter()` (compilation crashes).

I am sending this e-mail as warning because the current scheme uses an auto-generated module called `astencode_gen`. This is generated by a program called `serializer` which examines the rustc source. This scheme is, however, somewhat fragile: changes to the AST source require that `astencode_gen` be regenerated. This can be done by running the `src/etc/gen-astencode` script, as described below. It's annoying and I have a plan to convert the serializer into a syntax extension in the near future which should address these problems.

For the time being, however, if you make changes to the AST, you generally have to follow a procedure like this:

1. Change the AST.
2. Run gen-astencode. Likely this script will fail to execute because rustc is not yet type-checking. It will, however, leave dummy versions of the various encoding functions in astencode_gen which simply fail when executed.
3. You can now fix the various typing errors and get the compiler to build.
4. Now, re-run gen-astencode. This will generate the real versions of the serialization functions.
5. Now, re-compile, and you will have a functioning compiler.


Niko
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to