From 05a0dfe8cd4db51a08d11ab24cc1586c833e2df1 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 17 Aug 2022 12:34:33 +1000 Subject: Use `AttrVec` in more places. In some places we use `Vec` and some places we use `ThinVec` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::thin_vec::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently. --- src/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/parse') diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 268c72649a6..e0bd065518b 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -109,7 +109,7 @@ impl<'a> Parser<'a> { sess: &'a ParseSess, path: &Path, span: Span, - ) -> Result<(Vec, Vec>, Span), ParserError> { + ) -> Result<(ast::AttrVec, Vec>, Span), ParserError> { let result = catch_unwind(AssertUnwindSafe(|| { let mut parser = new_parser_from_file(sess.inner(), path, Some(span)); match parser.parse_mod(&TokenKind::Eof) { -- cgit 1.4.1-3-g733a5