mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
hir_ty: cleanups and extend infinitely_recursive_macro_type test
This commit is contained in:
parent
6ed2fd233b
commit
f0507ab7c6
2 changed files with 14 additions and 8 deletions
|
@ -296,9 +296,11 @@ impl<'a> TyLoweringContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TypeRef::Macro(macro_call) => {
|
TypeRef::Macro(macro_call) => {
|
||||||
let (expander, recursion_start) = match self.expander.borrow_mut() {
|
let (expander, recursion_start) = {
|
||||||
expander if expander.is_some() => (Some(expander), false),
|
let mut expander = self.expander.borrow_mut();
|
||||||
mut expander => {
|
if expander.is_some() {
|
||||||
|
(Some(expander), false)
|
||||||
|
} else {
|
||||||
if let Some(module_id) = self.resolver.module() {
|
if let Some(module_id) = self.resolver.module() {
|
||||||
*expander = Some(Expander::new(
|
*expander = Some(Expander::new(
|
||||||
self.db.upcast(),
|
self.db.upcast(),
|
||||||
|
|
|
@ -1248,14 +1248,18 @@ fn macros_in_type_generics() {
|
||||||
fn infinitely_recursive_macro_type() {
|
fn infinitely_recursive_macro_type() {
|
||||||
check_infer(
|
check_infer(
|
||||||
r#"
|
r#"
|
||||||
struct Bar<T>(T);
|
struct Bar<T, X>(T, X);
|
||||||
|
|
||||||
macro_rules! Foo {
|
macro_rules! Foo {
|
||||||
() => { Foo!() }
|
() => { Foo!() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! U32 {
|
||||||
|
() => { u32 }
|
||||||
|
}
|
||||||
|
|
||||||
type A = Foo!();
|
type A = Foo!();
|
||||||
type B = Bar<Foo!()>;
|
type B = Bar<Foo!(), U32!()>;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a: A;
|
let a: A;
|
||||||
|
@ -1263,9 +1267,9 @@ fn infinitely_recursive_macro_type() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
112..143 '{ ...: B; }': ()
|
166..197 '{ ...: B; }': ()
|
||||||
122..123 'a': {unknown}
|
176..177 'a': {unknown}
|
||||||
136..137 'b': Bar<{unknown}>
|
190..191 'b': Bar<{unknown}, u32>
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue