@@ -9,14 +9,14 @@ use tako::resources::{FRACTIONS_MAX_DIGITS, ResourceAmount};
99
1010#[ derive( Clone , Debug , PartialEq ) ]
1111pub struct ParseError {
12- error : Simple < String > ,
12+ error : Box < Simple < String > > ,
1313}
1414
1515impl ParseError {
1616 /// Create an error with a custom error message.
1717 pub fn custom < M : ToString > ( span : <Self as Error < char > >:: Span , msg : M ) -> Self {
1818 Self {
19- error : Simple :: custom ( span, msg) ,
19+ error : Box :: new ( Simple :: custom ( span, msg) ) ,
2020 }
2121 }
2222
@@ -26,7 +26,7 @@ impl ParseError {
2626 found : Option < String > ,
2727 ) -> Self {
2828 Self {
29- error : Simple :: expected_input_found ( span, expected, found) ,
29+ error : Box :: new ( Simple :: expected_input_found ( span, expected, found) ) ,
3030 }
3131 }
3232
@@ -67,19 +67,25 @@ impl Error<char> for ParseError {
6767 ) -> Self {
6868 let expected = expected. into_iter ( ) . map ( |c| c. map ( |c| c. to_string ( ) ) ) ;
6969 Self {
70- error : Simple :: expected_input_found ( span, expected, found. map ( |c| c. to_string ( ) ) ) ,
70+ error : Box :: new ( Simple :: expected_input_found (
71+ span,
72+ expected,
73+ found. map ( |c| c. to_string ( ) ) ,
74+ ) ) ,
7175 }
7276 }
7377
7478 fn with_label ( self , label : Self :: Label ) -> Self {
7579 Self {
76- error : self . error . with_label ( label) ,
80+ error : Box :: new ( self . error . with_label ( label) ) ,
7781 }
7882 }
7983
8084 fn merge ( self , other : Self ) -> Self {
81- let merged = self . error . merge ( other. error ) ;
82- Self { error : merged }
85+ let merged = self . error . merge ( * other. error ) ;
86+ Self {
87+ error : Box :: new ( merged) ,
88+ }
8389 }
8490}
8591
0 commit comments