From ef6d53521f07caa9c524749116d5fe53e1e8408d Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sat, 16 May 2020 18:06:23 +0200 Subject: Shrink ra_parser::Event from 32 bytes to 16 bytes This boxes the Error variant with the assumption that it is rarely constructed --- crates/ra_parser/src/lib.rs | 2 +- crates/ra_parser/src/parser.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_parser') diff --git a/crates/ra_parser/src/lib.rs b/crates/ra_parser/src/lib.rs index e08ad4dae..eeb8ad66b 100644 --- a/crates/ra_parser/src/lib.rs +++ b/crates/ra_parser/src/lib.rs @@ -25,7 +25,7 @@ pub(crate) use token_set::TokenSet; pub use syntax_kind::SyntaxKind; #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParseError(pub String); +pub struct ParseError(pub Box); /// `TokenSource` abstracts the source of the tokens parser operates on. /// diff --git a/crates/ra_parser/src/parser.rs b/crates/ra_parser/src/parser.rs index faa63d53f..4f59b0a23 100644 --- a/crates/ra_parser/src/parser.rs +++ b/crates/ra_parser/src/parser.rs @@ -192,7 +192,7 @@ impl<'t> Parser<'t> { /// structured errors with spans and notes, like rustc /// does. pub(crate) fn error>(&mut self, message: T) { - let msg = ParseError(message.into()); + let msg = ParseError(Box::new(message.into())); self.push_event(Event::Error { msg }) } -- cgit v1.2.3