rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.25k stars 1.6k forks source link

test-log crate breaks test runnables #12396

Open mullr opened 2 years ago

mullr commented 2 years ago

rust-analyzer version: rust-analyzer 5b69a34fb 2022-05-25 dev

rustc version: rustc 1.61.0 (fe5b13d68 2022-05-18)

relevant settings: Using emacs with lsp-mode.

The test-log crate (https://github.com/d-e-s-o/test-log) comes with a replacement test macro. You use it like this:

use test_log::test;

#[test]
fn my_test() {
  info!("I can see this now!");
}

But, with this use test_log::test, when I try to run the test using lsp-rust-analyzer-run it doesn't detect it as an option. If I remove the use, the test is runnable.

jonas-schievink commented 2 years ago

It expands to a function with a #[::core::prelude::v1::test] attribute, maybe we're only looking for #[test]?

lnicola commented 2 years ago

Was it reverted in https://github.com/rust-lang/rust-analyzer/pull/10044 (https://github.com/rust-lang/rust-analyzer/pull/9943)?

Veykril commented 2 years ago

Shouldn't be, we skip expansion of test but we do it with resolved attributes, so not just a textual match. Manually using #[::core::prelude::v1::test] works fine as well

Veykril commented 2 years ago

Fwiw I do get the test lenses in VSCode for the above snippet

mullr commented 2 years ago

I just checked this in both emacs and vs code. I notice that I DO get the lenses in code and in emacs. The problem occurs in emacs in the lsp-rust-analyzer-run path only; this bottoms out in the experimental/runnables lsp request.

Veykril commented 1 year ago

Triage; This is still a problem