New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix runnable detection for #[tokio::test]
#15157
Conversation
Why are we changing the We could also try a different idea. Fetch the source of the function (or whatever def), walk up the macro expansions its in and check if any of those comes from the rust-analyzer/crates/hir-expand/src/lib.rs Lines 343 to 352 in 7c8ae35
|
I would like to get rid of the test_related_attribute function in future. It detects any proc macro with test in the start or end of name if I understand it correctly, which is bad. It looks like a pre macro expansion thing to me.
I guess we don't do macro expansion for the test attribute, do we? If we do, we can just check for |
Ah right, we are skipping the test/bench expansion as its just wasting memory. |
Aha, that's reasonable. Is there a way to do name resolution on attributes without doing relying on macro expansion? |
dcc7607
to
97c48f9
Compare
I'm going to merge this to fix the tokio issue sooner, so that we can @bors r+ |
Fix runnable detection for `#[tokio::test]` fix #15141 It is hacky, and it wouldn't work for e.g. this case: ```Rust use ::core::prelude; #[prelude::v1::test] fn foo() { } ``` But it works for the tokio case. We should use the name resolution here somehow, and after that we should probably also get rid of the ast based `test_related_attribute` function.
💔 Test failed - checks-actions |
@bors retry |
Fix runnable detection for `#[tokio::test]` fix #15141 It is hacky, and it wouldn't work for e.g. this case: ```Rust use ::core::prelude; #[prelude::v1::test] fn foo() { } ``` But it works for the tokio case. We should use the name resolution here somehow, and after that we should probably also get rid of the ast based `test_related_attribute` function.
💔 Test failed - checks-actions |
@bors r+ |
☀️ Test successful - checks-actions |
1 similar comment
☀️ Test successful - checks-actions |
👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request. |
fix #15141
It is hacky, and it wouldn't work for e.g. this case:
But it works for the tokio case. We should use the name resolution here somehow, and after that we should probably also get rid of the ast based
test_related_attribute
function.