fn parse_attribute_with_inner_parse_policy(
        &mut self,
        inner_parse_policy: InnerAttributeParsePolicy<'_>
    ) -> PResult<'a, ast::Attribute> {
        debug!("parse_attribute_with_inner_parse_policy: inner_parse_policy={:?} self.token={:?}",
               inner_parse_policy,
               self.token);
        let (span, item, style) = match self.token.kind {
            token::Pound => {
                let lo = self.token.span;
                self.bump();

                if let InnerAttributeParsePolicy::Permitted = inner_parse_policy {
                    self.expected_tokens.push(TokenType::Token(token::Not));
                }

                let style = if self.token == token::Not {
                    self.bump();
                    ast::AttrStyle::Inner
                } else {
                    ast::AttrStyle::Outer
                };

                self.expect(&token::OpenDelim(token::Bracket))?;
                let item = self.parse_attr_item()?;
                self.expect(&token::CloseDelim(token::Bracket))?;
                let hi = self.prev_span;

                let attr_sp = lo.to(hi);

                // Emit error if inner attribute is encountered and not permitted
                if style == ast::AttrStyle::Inner {
                    if let InnerAttributeParsePolicy::NotPermitted { reason,
                        saw_doc_comment, prev_attr_sp } = inner_parse_policy {
                        let prev_attr_note = if saw_doc_comment {
                            "previous doc comment"
                        } else {
                            "previous outer attribute"
                        };

                        let mut diagnostic = self
                            .diagnostic()
                            .struct_span_err(attr_sp, reason);

                        if let Some(prev_attr_sp) = prev_attr_sp {
                            diagnostic
                                .span_label(attr_sp, "not permitted following an outer attibute")
                                .span_label(prev_attr_sp, prev_attr_note);
                        }

                        diagnostic
                            .note("inner attributes, like `#![no_std]`, annotate the item \
                                   enclosing them, and are usually found at the beginning of \
                                   source files. Outer attributes, like `#[test]`, annotate the \
                                   item following them.")
                            .emit()
                    }
                }

                (attr_sp, item, style)
            }
            _ => {
                let token_str = self.this_token_to_string();
                return Err(self.fatal(&format!("expected `#`, found `{}`", token_str)));
            }
        };

        Ok(attr::mk_attr_from_item(style, item, span))
    }
/// The same as `parse_attribute`, except it takes in an `InnerAttributeParsePolicy`
/// that prescribes how to handle inner attributes.
The same as `parse_attribute`, except it takes in an `InnerAttributeParsePolicy`
that prescribes how to handle inner attributes.
The same as ` parse_attribute ` except it takes in an ` InnerAttributeParsePolicy ` that prescribes how to handle inner attributes .
fn parse_attribute_with_inner_parse_policy(
        &mut self,
        inner_parse_policy: InnerAttributeParsePolicy<'_>
    ) -> PResult<'a, ast::Attribute> {
        debug!("parse_attribute_with_inner_parse_policy: inner_parse_policy={:?} self.token={:?}",
               inner_parse_policy,
               self.token);
        let (span, item, style) = match self.token.kind {
            token::Pound => {
                let lo = self.token.span;
                self.bump();
                if let InnerAttributeParsePolicy::Permitted = inner_parse_policy {
                    self.expected_tokens.push(TokenType::Token(token::Not));
                }
                let style = if self.token == token::Not {
                    self.bump();
                    ast::AttrStyle::Inner
                } else {
                    ast::AttrStyle::Outer
                };
                self.expect(&token::OpenDelim(token::Bracket))?;
                let item = self.parse_attr_item()?;
                self.expect(&token::CloseDelim(token::Bracket))?;
                let hi = self.prev_span;
                let attr_sp = lo.to(hi);
                // Emit error if inner attribute is encountered and not permitted
                if style == ast::AttrStyle::Inner {
                    if let InnerAttributeParsePolicy::NotPermitted { reason,
                        saw_doc_comment, prev_attr_sp } = inner_parse_policy {
                        let prev_attr_note = if saw_doc_comment {
                            "previous doc comment"
                        } else {
                            "previous outer attribute"
                        };
                        let mut diagnostic = self
                            .diagnostic()
                            .struct_span_err(attr_sp, reason);
                        if let Some(prev_attr_sp) = prev_attr_sp {
                            diagnostic
                                .span_label(attr_sp, "not permitted following an outer attibute")
                                .span_label(prev_attr_sp, prev_attr_note);
                        }
                        diagnostic
                            .note("inner attributes, like `#![no_std]`, annotate the item \
                                   enclosing them, and are usually found at the beginning of \
                                   source files. Outer attributes, like `#[test]`, annotate the \
                                   item following them.")
                            .emit()
                    }
                }
                (attr_sp, item, style)
            }
            _ => {
                let token_str = self.this_token_to_string();
                return Err(self.fatal(&format!("expected `#`, found `{}`", token_str)));
            }
        };
        Ok(attr::mk_attr_from_item(style, item, span))
    }
fn parse_attribute_with_inner_parse_policy ( & mut self , inner_parse_policy : InnerAttributeParsePolicy < ' _ > ) -> PResult < ' a , ast :: Attribute > { debug ! ( " " inner_parse_policy self token ) ; let ( span , item , style ) = match self . token . kind { token :: Pound => { let lo = self . token . span ; self . bump ( ) ; if let InnerAttributeParsePolicy :: Permitted = inner_parse_policy { self . expected_tokens . push ( TokenType :: Token ( token :: Not ) ) ; } let style = if self . token == token :: Not { self . bump ( ) ; ast :: AttrStyle :: Inner } else { ast :: AttrStyle :: Outer } ; self . expect ( & token :: OpenDelim ( token :: Bracket ) ) ? ; let item = self . parse_attr_item ( ) ? ; self . expect ( & token :: CloseDelim ( token :: Bracket ) ) ? ; let hi = self . prev_span ; let attr_sp = lo . to ( hi ) ; // Emit error if inner attribute is encountered and not permitted if style == ast :: AttrStyle :: Inner { if let InnerAttributeParsePolicy :: NotPermitted { reason , saw_doc_comment , prev_attr_sp } = inner_parse_policy { let prev_attr_note = if saw_doc_comment { " " } else { " " } ; let mut diagnostic = self . diagnostic ( ) . struct_span_err ( attr_sp , reason ) ; if let Some ( prev_attr_sp ) = prev_attr_sp { diagnostic . span_label ( attr_sp , " " ) . span_label ( prev_attr_sp , prev_attr_note ) ; } diagnostic . note ( " \
 \
 \
 " ) . emit ( ) } } ( attr_sp , item , style ) } _ => { let token_str = self . this_token_to_string ( ) ; return Err ( self . fatal ( & format ! ( " " token_str ) ) ) ; } } ; Ok ( attr :: mk_attr_from_item ( style , item , span ) ) }
The same as `parse_attribute`, except it takes in an `InnerAttributeParsePolicy`
that prescribes how to handle inner attributes.
The same as ` parse_attribute ` except it takes in an ` InnerAttributeParsePolicy ` that prescribes how to handle inner attributes .
&mut self
inner_parse_policy
InnerAttributeParsePolicy<'_>