mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Fix up token_tree_to_syntax_node float split handling
This commit is contained in:
parent
9053bcc65c
commit
c6e7917d6e
5 changed files with 76 additions and 12 deletions
|
@ -111,7 +111,8 @@ impl ItemTree {
|
|||
Some(node) => node,
|
||||
None => return Default::default(),
|
||||
};
|
||||
if never!(syntax.kind() == SyntaxKind::ERROR) {
|
||||
if never!(syntax.kind() == SyntaxKind::ERROR, "{:?} from {:?} {}", file_id, syntax, syntax)
|
||||
{
|
||||
// FIXME: not 100% sure why these crop up, but return an empty tree to avoid a panic
|
||||
return Default::default();
|
||||
}
|
||||
|
@ -133,7 +134,7 @@ impl ItemTree {
|
|||
ctx.lower_macro_stmts(stmts)
|
||||
},
|
||||
_ => {
|
||||
panic!("cannot create item tree from {syntax:?} {syntax}");
|
||||
panic!("cannot create item tree for file {file_id:?} from {syntax:?} {syntax}");
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
@ -104,7 +104,7 @@ macro_rules! id {
|
|||
$($t)*
|
||||
};
|
||||
}
|
||||
id /*+errors*/! {
|
||||
id! {
|
||||
#[proc_macros::identity]
|
||||
impl Foo for WrapBj {
|
||||
async fn foo(&self) {
|
||||
|
@ -113,18 +113,17 @@ id /*+errors*/! {
|
|||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r##"
|
||||
expect![[r#"
|
||||
macro_rules! id {
|
||||
($($t:tt)*) => {
|
||||
$($t)*
|
||||
};
|
||||
}
|
||||
/* parse error: expected SEMICOLON */
|
||||
#[proc_macros::identity] impl Foo for WrapBj {
|
||||
async fn foo(&self ) {
|
||||
self .0.id().await ;
|
||||
}
|
||||
}
|
||||
"##]],
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue