Merge pull request #19862 from ChayimFriedman2/item-resolve-macro-hir

fix: Fix IDE resolution of item macros
This commit is contained in:
Chayim Refael Friedman 2025-05-26 21:34:18 +00:00 committed by GitHub
commit 7fa66d67a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 74 additions and 29 deletions

View file

@ -4,7 +4,7 @@
//! in [crate::completions::mod_].
use expect_test::expect;
use crate::tests::{check_edit, check_with_base_items};
use crate::tests::{check, check_edit, check_with_base_items};
#[test]
fn target_type_or_trait_in_impl_block() {
@ -308,3 +308,39 @@ fn bar() {
"#]],
);
}
#[test]
fn expression_in_item_macro() {
check(
r#"
fn foo() -> u8 { 0 }
macro_rules! foo {
($expr:expr) => {
const BAR: u8 = $expr;
};
}
foo!(f$0);
"#,
expect![[r#"
ct BAR u8
fn foo() fn() -> u8
ma foo!() macro_rules! foo
bt u32 u32
kw const
kw crate::
kw false
kw for
kw if
kw if let
kw loop
kw match
kw self::
kw true
kw unsafe
kw while
kw while let
"#]],
);
}