Skip to content

Commit 9a982bd

Browse files
committed
Remove non-leaf item in crate parsing failure error
gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_items): Remove item parsing error. gcc/testsuite/ChangeLog: * rust/compile/braced_macro_arm.rs: Remove superfluous error message matching. * rust/compile/decl_macro6.rs: Likewise. * rust/compile/decl_macro7.rs: Likewise. * rust/compile/extern_type_item_missing_semi.rs: Likewise. * rust/compile/issue-2187.rs: Likewise. * rust/compile/issue-407-2.rs: Likewise. * rust/compile/issue-407.rs: Likewise. * rust/compile/issue-4162.rs: Likewise. * rust/compile/issue-867.rs: Likewise. * rust/compile/macros/mbe/macro-issue1053-2.rs: Likewise. * rust/compile/macros/mbe/macro-issue1395-2.rs: Likewise. * rust/compile/macros/mbe/macro-issue3608.rs: Likewise. * rust/compile/macros/mbe/macro27.rs: Likewise. * rust/compile/macros/mbe/macro28.rs: Likewise. * rust/compile/macros/mbe/macro29.rs: Likewise. * rust/compile/macros/mbe/macro30.rs: Likewise. * rust/compile/macros/mbe/macro31.rs: Likewise. * rust/compile/macros/mbe/macro33.rs: Likewise. * rust/compile/macros/mbe/macro35.rs: Likewise. * rust/compile/macros/mbe/macro37.rs: Likewise. * rust/compile/macros/mbe/macro38.rs: Likewise. * rust/compile/macros/mbe/macro39.rs: Likewise. * rust/compile/macros/mbe/macro48.rs: Likewise. * rust/compile/parse_invalid_specialization.rs: Likewise. * rust/compile/parse_simple_path_fail_1.rs: Likewise. * rust/compile/parse_simple_path_fail_2.rs: Likewise. * rust/compile/raw-string-loc.rs: Likewise. * rust/compile/raw-byte-string-loc.rs: Likewise. * rust/compile/self_const_ptr.rs: Likewise. * rust/compile/self_mut_ptr.rs: Likewise. * rust/compile/static_var1.rs: Likewise. * rust/compile/self_ptr.rs: Likewise. * rust/compile/torture/identifier-missing-impl-1.rs: Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
1 parent 7d19dc6 commit 9a982bd

34 files changed

+6
-43
lines changed

gcc/rust/parse/rust-parse-impl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,6 @@ Parser<ManagedTokenSource>::parse_items ()
431431
std::unique_ptr<AST::Item> item = parse_item (false);
432432
if (item == nullptr)
433433
{
434-
Error error (lexer.peek_token ()->get_locus (),
435-
"failed to parse item in crate");
436-
add_error (std::move (error));
437-
438434
// TODO: should all items be cleared?
439435
items = std::vector<std::unique_ptr<AST::Item>> ();
440436
break;

gcc/testsuite/rust/compile/braced_macro_arm.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ fn h(c: bool) {
1212
false => ()
1313
// { dg-error "exprwithoutblock requires comma after match case expression in match arm \\(if not final case\\)" "" { target *-*-* } .-1 }
1414
// { dg-error "unrecognised token .false. for start of item" "" { target *-*-* } .-2 }
15-
// { dg-error "failed to parse item in crate" "" { target *-*-* } .-3 }
1615
};
1716
}
1817

gcc/testsuite/rust/compile/decl_macro6.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
macro m {}
33
// { dg-error "unexpected token .\}. - expecting delimiters .for a macro matcher." "" { target *-*-* } .-1 }
44
// { dg-error "required first macro rule in declarative macro definition could not be parsed" "" { target *-*-* } .-2 }
5-
// { dg-error "failed to parse item in crate" "" { target *-*-* } .-3 }
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#![feature(decl_macro)]
22
pub macro hello() [ "Hello" ]
33
// { dg-error "only braces can be used for a macro transcriber in declarative macro definition" "" { target *-*-* } .-1 }
4-
// { dg-error "failed to parse item in crate" }

gcc/testsuite/rust/compile/extern_type_item_missing_semi.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ extern "C" {
44
type F;
55
type E // { dg-error "failed to parse" }
66
} // { dg-error "expecting" }
7-
// { dg-error "failed to parse item in crate" "" { target *-*-* } .-1 }

gcc/testsuite/rust/compile/issue-2187.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ const D: &'static str = "
88
";
99
ERROR_TIME
1010
// { dg-error "unrecognised token" "" { target *-*-* } .-1 }
11-
// { dg-error "failed to parse item in crate" "" { target *-*-* } .-2 }

gcc/testsuite/rust/compile/issue-407-2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub fn loopy() {
1010
// { dg-error {failed to parse if body block expression in if expression} "" { target *-*-* } .-2 }
1111
// { dg-error {could not parse loop body in \(infinite\) loop expression} "" { target *-*-* } .-3 }
1212
// { dg-error {unrecognised token 'integer literal' for start of item} "" { target *-*-* } .-4 }
13-
// { dg-error {failed to parse item in crate} "" { target *-*-* } .-5 }
1413
} else {
1514
break;
1615
}

gcc/testsuite/rust/compile/issue-407.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ fn test() {
44
a + = 1; // { dg-error "found unexpected token '=' in null denotation" }
55
// { dg-error {failed to parse statement or expression in block expression} "" { target *-*-* } .-1 }
66
// { dg-error {unrecognised token 'integer literal' for start of item} "" { target *-*-* } .-2 }
7-
// { dg-error {failed to parse item in crate} "" { target *-*-* } .-3 }
87
}

gcc/testsuite/rust/compile/issue-4162.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pub fn main() {
33
// { dg-error "should be at least 1 pattern" "" { target *-*-* } .-1 }
44
// { dg-error "failed to parse statement or expression in block expression" "" { target *-*-* } .-2 }
55
// { dg-error "unrecognised token .=. for start of item" "" { target *-*-* } .-3 }
6-
// { dg-error "failed to parse item in crate" "" { target *-*-* } .-4 }
76
{}
87
}
98

gcc/testsuite/rust/compile/issue-867.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ fn main() {
33
let a = _ + 123; // { dg-error "use of '_' is not allowed on the right-side of an assignment" }
44
// { dg-error {failed to parse expression in let statement} "" { target *-*-* } .-1 }
55
// { dg-error {failed to parse statement or expression in block expression} "" { target *-*-* } .-2 }
6-
// { dg-error {unrecognised token '\}' for start of item} "" { target *-*-* } .+2 }
7-
// { dg-error {failed to parse item in crate} "" { target *-*-* } .+1 }
6+
// { dg-error {unrecognised token '\}' for start of item} "" { target *-*-* } .+1 }
87
}

0 commit comments

Comments
 (0)