mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
fixed #1384
This commit is contained in:
parent
0129790a8f
commit
de930237ff
4 changed files with 90 additions and 7 deletions
|
@ -181,6 +181,17 @@ pub(crate) fn expr_block_contents(p: &mut Parser) {
|
|||
// fn foo(){
|
||||
// ;;;some_expr();;;;{;;;};;;;Ok(())
|
||||
// }
|
||||
|
||||
// test nocontentexpr_after_item
|
||||
// fn simple_function() {
|
||||
// enum LocalEnum {
|
||||
// One,
|
||||
// Two,
|
||||
// };
|
||||
// fn f() {};
|
||||
// struct S {};
|
||||
// }
|
||||
|
||||
if p.current() == T![;] {
|
||||
p.bump();
|
||||
continue;
|
||||
|
|
|
@ -38,7 +38,15 @@ pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool, flavor: ItemF
|
|||
let m = p.start();
|
||||
attributes::outer_attributes(p);
|
||||
let m = match maybe_item(p, m, flavor) {
|
||||
Ok(()) => return,
|
||||
Ok(()) => {
|
||||
if p.at(T![;]) {
|
||||
p.err_and_bump(
|
||||
"expected item, found `;`\n\
|
||||
consider removing this semicolon",
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Err(m) => m,
|
||||
};
|
||||
if paths::is_path_start(p) {
|
||||
|
@ -263,12 +271,6 @@ fn items_without_modifiers(p: &mut Parser, m: Marker) -> Result<(), Marker> {
|
|||
}
|
||||
_ => return Err(m),
|
||||
};
|
||||
if p.at(T![;]) {
|
||||
p.err_and_bump(
|
||||
"expected item, found `;`\n\
|
||||
consider removing this semicolon",
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue