Fix not parse never type in inherent impl

This commit is contained in:
A4-Tacks 2025-11-05 16:33:02 +08:00
parent c46279da2f
commit e92e6792cf
No known key found for this signature in database
GPG Key ID: DBD861323040663B
4 changed files with 22 additions and 5 deletions

View File

@ -54,12 +54,13 @@ pub(super) fn impl_(p: &mut Parser<'_>, m: Marker) {
// impl const Send for S {}
p.eat(T![const]);
// FIXME: never type
// test impl_item_never_type
// impl ! {}
// test impl_item_neg
// impl !Send for S {}
p.eat(T![!]);
if p.at(T![!]) && !p.nth_at(1, T!['{']) {
// test impl_item_neg
// impl !Send for S {}
p.eat(T![!]);
}
impl_type(p);
if p.eat(T![for]) {
impl_type(p);

View File

@ -322,6 +322,10 @@ mod ok {
#[test]
fn impl_item_neg() { run_and_expect_no_errors("test_data/parser/inline/ok/impl_item_neg.rs"); }
#[test]
fn impl_item_never_type() {
run_and_expect_no_errors("test_data/parser/inline/ok/impl_item_never_type.rs");
}
#[test]
fn impl_trait_type() {
run_and_expect_no_errors("test_data/parser/inline/ok/impl_trait_type.rs");
}

View File

@ -0,0 +1,11 @@
SOURCE_FILE
IMPL
IMPL_KW "impl"
WHITESPACE " "
NEVER_TYPE
BANG "!"
WHITESPACE " "
ASSOC_ITEM_LIST
L_CURLY "{"
R_CURLY "}"
WHITESPACE "\n"

View File

@ -0,0 +1 @@
impl ! {}