-
Notifications
You must be signed in to change notification settings - Fork 3
Document rustc bugs #3
Comments
It's mostly around There's also short list of issues where a Anyway, it's generally enough to ensure that some of the code in the module is reachable. This should keep the module from getting thrown out, which IME seems to be what usually causes the If you can compile with LTO its pretty reliable IME, since it becomes one big module. Also, if you can control arbitrary build flags in your use case, it can be even more robust by directly asking the linker not to remove certain things. Also, note that some targets are a lot worse about this than others, unfortunately. Unfortunately, to implement Sadly, there's not really a way for us to access something like this from Rust. We'd need rustc to do it for us, e.g. it'd need to be supported by the Rust language which... seems very unlikely to happen (it can't really be supported on some of Rust's targets, like wasm, bare metal, ...). Just putting the functions in the right section works well in practice, but isn't perfect... (Although, it'd work way better in practice if All that said, in practice most of the time I use There are also a few patterns you should avoid if possible: I wouldn't recommend it in situations where you have a big block of code in a module, that has no public items, but uses That said, this kind of thing is very useful for some designs. :( |
The code has a comment along the lines of "There are known
rustc
bugs that will prevent it from working", it would be nice if the known issues were linked in the README or documentation.The text was updated successfully, but these errors were encountered: