Merge pull request #20972 from A4-Tacks/impl-never-type

Fix not parse never type in inherent impl
This commit is contained in:
Shoyu Vanilla (Flint)
2025-11-10 06:10:16 +00:00
committed by Laurențiu Nicola
parent 95a0b20dad
commit ca83ff37d7
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 ! {}