Disallow ZSTs in `ThinMap`. From thin-vec v0.2.20, `ThinVec` contains an optimization for the case where the contained type is a ZST. In this case, the `ThinVec` will avoid allocating any memory and simply store the length of the vector plus one in the `ptr` field. This means that the least significant bit of `ThinVec.ptr` may be 1 when the contained type is a ZST. This is incompatible with the pointer tagging mechanism of `ThinMap`, which uses the LSB of `ThinMap.ptr` to indicate whether `ptr` is a transmuted `ThinVec` or a boxed map. The assumption is that a transmuted `ThinVec` always has a LSB of 0, but this is not the case if the `ThinVec` contains a ZST, and this will cause crashes in this case. Of course, no one would construct a `ThinMap<(), ()>` explicitly, but it's possible that this case could happen implicitly in a generic context, so we should guard against it. (I assume the reason that `ThinVec` optimizes for ZSTs in the first place is also because `ThinVec<()>` may occur in generic contexts.) Note that this disallows only the case where both the key and the value are ZSTs. It is still permissible for either the key or the value to be ZSTs (and the latter case in particular is important because it is used by `ThinSet`).
rust-analyzer is a language server that provides IDE functionality for writing Rust programs. You can use it with any editor that supports the Language Server Protocol (VS Code, Vim, Emacs, Zed, etc).
rust-analyzer features include go-to-definition, find-all-references, refactorings and code completion. rust-analyzer also supports integrated formatting (with rustfmt) and integrated diagnostics (with rustc and clippy).
Internally, rust-analyzer is structured as a set of libraries for analyzing Rust code. See Architecture in the manual.
https://rust-analyzer.github.io/book/installation.html
If you want to contribute to rust-analyzer check out the CONTRIBUTING.md or if you are just curious about how things work under the hood, see the Contributing section of the manual.
If you want to use rust-analyzer's language server with your editor of choice, check the manual. It also contains some tips & tricks to help you be more productive when using rust-analyzer.
See the security and privacy sections of the manual.
For usage and troubleshooting requests, please use “IDEs and Editors” category of the Rust forum:
https://users.rust-lang.org/c/ide/14
For questions about development and implementation, join rust-analyzer working group on Zulip:
https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer
rust-analyzer is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.