mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Merge #10389
10389: fix: use the right `HirFileId` when expanding macros in fn parameters r=Veykril a=SkiFire13 Fixes #10388 Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
This commit is contained in:
commit
b21f15a237
2 changed files with 24 additions and 1 deletions
|
@ -299,7 +299,7 @@ impl GenericParams {
|
||||||
let macro_call = mc.to_node(db.upcast());
|
let macro_call = mc.to_node(db.upcast());
|
||||||
match expander.enter_expand::<ast::Type>(db, macro_call) {
|
match expander.enter_expand::<ast::Type>(db, macro_call) {
|
||||||
Ok(ExpandResult { value: Some((mark, expanded)), .. }) => {
|
Ok(ExpandResult { value: Some((mark, expanded)), .. }) => {
|
||||||
let ctx = LowerCtx::new(db, mc.file_id);
|
let ctx = LowerCtx::new(db, expander.current_file_id());
|
||||||
let type_ref = TypeRef::from_ast(&ctx, expanded);
|
let type_ref = TypeRef::from_ast(&ctx, expanded);
|
||||||
self.fill_implicit_impl_trait_args(db, expander, &type_ref);
|
self.fill_implicit_impl_trait_args(db, expander, &type_ref);
|
||||||
expander.exit(db, mark);
|
expander.exit(db, mark);
|
||||||
|
|
|
@ -1198,3 +1198,26 @@ fn bar() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn nested_macro_in_fn_params() {
|
||||||
|
check_no_mismatches(
|
||||||
|
r#"
|
||||||
|
macro_rules! U32Inner {
|
||||||
|
() => {
|
||||||
|
u32
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! U32 {
|
||||||
|
() => {
|
||||||
|
U32Inner!()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mamba(a: U32!(), p: u32) -> u32 {
|
||||||
|
a
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue