Parse only outer_attributes for match arms for now

This commit is contained in:
Ville Penttinen
2019-02-17 19:48:08 +02:00
parent 1c97c1ac11
commit 96e3ac389f
3 changed files with 60 additions and 47 deletions

View File

@@ -1,15 +1,5 @@
use super::*;
/// Parses both inner & outer attributes.
///
/// Allowing to run validation for reporting errors
/// regarding attributes
pub(super) fn all_attributes(p: &mut Parser) {
while p.at(POUND) {
attribute(p, p.nth(1) == EXCL)
}
}
pub(super) fn inner_attributes(p: &mut Parser) {
while p.current() == POUND && p.nth(1) == EXCL {
attribute(p, true)

View File

@@ -331,11 +331,6 @@ pub(crate) fn match_arm_list(p: &mut Parser) {
continue;
}
// This may result in invalid attributes
// if there are inner attributes mixed in together
// with the outer attributes, but we allow parsing
// those so we can run validation and report better errors
// test match_arms_outer_attributes
// fn foo() {
// match () {
@@ -349,7 +344,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) {
// _ => (),
// }
// }
attributes::all_attributes(p);
attributes::outer_attributes(p);
// test match_arms_commas
// fn foo() {