diff options
| author | bors <bors@rust-lang.org> | 2019-10-23 09:53:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-10-23 09:53:32 +0000 |
| commit | f466f52c1bf8f2e4454e31c683a88625ad4b4033 (patch) | |
| tree | debff7c338470da12d3a297e23978abfe0e6ff0e /src/libsyntax/parse | |
| parent | d6e4028a0db6b13d9a603baad109d6c902802c03 (diff) | |
| parent | 1df90814135954ba856cc236801d2ac531cc7dac (diff) | |
| download | rust-f466f52c1bf8f2e4454e31c683a88625ad4b4033.tar.gz rust-f466f52c1bf8f2e4454e31c683a88625ad4b4033.zip | |
Auto merge of #65716 - JohnTitor:rollup-fkcr85k, r=JohnTitor
Rollup of 14 pull requests Successful merges: - #64145 (Target-feature documented as unsafe) - #65007 (Mention keyword closing policy) - #65417 (Add more coherence tests) - #65507 (Fix test style in unused parentheses lint test) - #65591 (Add long error explanation for E0588) - #65617 (Fix WASI sleep impl) - #65656 (Add option to disable keyboard shortcuts in docs) - #65678 (Add long error explanation for E0728) - #65681 (Code cleanups following up on #65576.) - #65686 (refactor and move `maybe_append` ) - #65688 (Add some tests for fixed ICEs) - #65689 (bring back some Debug instances for Miri) - #65695 (self-profiling: Remove module names from some event-ids in codegen backend.) - #65706 (Add missing space in librustdoc) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/item.rs | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6bbd8be0cb9..2ce0046ca27 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -86,13 +86,6 @@ macro_rules! maybe_recover_from_interpolated_ty_qpath { } } -fn maybe_append(mut lhs: Vec<Attribute>, mut rhs: Option<Vec<Attribute>>) -> Vec<Attribute> { - if let Some(ref mut rhs) = rhs { - lhs.append(rhs); - } - lhs -} - #[derive(Debug, Clone, Copy, PartialEq)] enum PrevTokenKind { DocComment, diff --git a/src/libsyntax/parse/parser/item.rs b/src/libsyntax/parse/parser/item.rs index 0acfd1450d8..73bd80e2a21 100644 --- a/src/libsyntax/parse/parser/item.rs +++ b/src/libsyntax/parse/parser/item.rs @@ -10,7 +10,6 @@ use crate::ast::{Visibility, VisibilityKind, Mutability, FnHeader, ForeignItem, use crate::ast::{Ty, TyKind, Generics, GenericBounds, TraitRef, EnumDef, VariantData, StructField}; use crate::ast::{Mac, MacDelimiter, Block, BindingMode, FnDecl, MethodSig, SelfKind, Param}; use crate::parse::token; -use crate::parse::parser::maybe_append; use crate::tokenstream::{TokenTree, TokenStream}; use crate::symbol::{kw, sym}; use crate::source_map::{self, respan, Span}; @@ -416,10 +415,17 @@ impl<'a> Parser<'a> { ) -> PResult<'a, Option<P<Item>>> { let (ident, item, extra_attrs) = info; let span = lo.to(self.prev_span); - let attrs = maybe_append(attrs, extra_attrs); + let attrs = Self::maybe_append(attrs, extra_attrs); Ok(Some(self.mk_item(span, ident, item, vis, attrs))) } + fn maybe_append<T>(mut lhs: Vec<T>, mut rhs: Option<Vec<T>>) -> Vec<T> { + if let Some(ref mut rhs) = rhs { + lhs.append(rhs); + } + lhs + } + /// This is the fall-through for parsing items. fn parse_macro_use_or_failure( &mut self, |
