Add PROC_MACRO_TEST_TOOLCHAIN environment variable This allows overriding the toolchain used to run `proc-macro-srv` tests. --- Sample usage. Testing the current ABI (variable unset/empty): ```shell amos@tails ~/bearcove/rust-analyzer/crates/proc-macro-srv proc-macro-test-toolchain* ❯ PROC_MACRO_TEST_TOOLCHAIN="" cargo test --quiet running 16 tests ................ test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s ``` Testing an older ABI: ```shell amos@tails ~/bearcove/rust-analyzer/crates/proc-macro-srv proc-macro-test-toolchain* ❯ PROC_MACRO_TEST_TOOLCHAIN="1.58" cargo test --quiet running 16 tests ................ test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s ``` Testing current nightly ABI: ```shell ❯ rustc +nightly --version rustc 1.64.0-nightly (f8588549c 2022-07-18) ❯ PROC_MACRO_TEST_TOOLCHAIN="nightly" cargo test --quiet running 16 tests ................ test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s ``` Testing future ABI (`rust-lang/rust` master): ```shell amos@tails ~/bearcove/rust-analyzer/crates/proc-macro-srv proc-macro-test-toolchain ❯ PROC_MACRO_TEST_TOOLCHAIN="stage1" cargo test --quiet running 16 tests ..........thread '<unnamed>' panicked at 'range end index 216221164920373249 out of range for slice of length 18', library/core/src/slice/index.rs:73:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ....F. failures: ---- tests::test_fn_like_macro2 stdout ---- thread 'tests::test_fn_like_macro2' panicked at 'called `Result::unwrap()` on an `Err` value: "range end index 216221164920373249 out of range for slice of length 18"', crates/proc-macro-srv/src/tests/utils.rs:38:83 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: tests::test_fn_like_macro2 test result: FAILED. 15 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s error: test failed, to rerun pass '--lib ``` --- Tagging `@jonas-schievink:` this might be helpful when updating versioned ABIs later on.
rust-analyzer is a modular compiler frontend for the Rust language. It is a part of a larger rls-2.0 effort to create excellent IDE support for Rust.
Quick Start
https://rust-analyzer.github.io/manual.html#installation
Documentation
If you want to contribute to rust-analyzer or are just curious about how things work under the hood, check the ./docs/dev folder.
If you want to use rust-analyzer's language server with your editor of choice, check the manual folder. It also contains some tips & tricks to help you be more productive when using rust-analyzer.
Security and Privacy
See the corresponding sections of the manual.
Communication
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
Quick Links
- Website: https://rust-analyzer.github.io/
- Metrics: https://rust-analyzer.github.io/metrics/
- API docs: https://rust-lang.github.io/rust-analyzer/ide/
- Changelog: https://rust-analyzer.github.io/thisweek
License
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.