mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Parse unsafe extern block
This commit is contained in:
parent
cadf0e9fb6
commit
8a11da40a7
3 changed files with 25 additions and 3 deletions
|
@ -112,7 +112,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
|
|||
has_mods = true;
|
||||
}
|
||||
|
||||
if p.at(T![extern]) {
|
||||
if p.at(T![extern]) && p.nth(1) != T!['{'] && (p.nth(1) != STRING || p.nth(2) != T!['{']) {
|
||||
has_mods = true;
|
||||
abi(p);
|
||||
}
|
||||
|
@ -181,6 +181,14 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
|
|||
T![type] => {
|
||||
type_alias(p, m);
|
||||
}
|
||||
|
||||
// unsafe extern "C" {}
|
||||
T![extern] => {
|
||||
abi(p);
|
||||
extern_item_list(p);
|
||||
m.complete(p, EXTERN_BLOCK);
|
||||
}
|
||||
|
||||
_ => {
|
||||
if !has_visibility && !has_mods {
|
||||
return Err(m);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue