@@ -263,20 +263,20 @@ fn parse_stmt(
263263 in_loop : bool ,
264264 statements : & mut Vec < StmtInstruction > ,
265265 source_locations : & mut Vec < usize > ,
266- ) -> Result < usize , PestError > {
266+ ) -> Result < usize , Box < PestError > > {
267267 let stmt = first_child ( stmt) ;
268268 let ( line, _) = stmt. line_col ( ) ;
269269 source_locations. push ( line) ;
270270 let mut instruction_count = 1 ;
271271 match stmt. as_rule ( ) {
272272 Rule :: break_stmt => {
273273 if !in_loop {
274- return Err ( pest:: error:: Error :: new_from_span (
274+ return Err ( Box :: new ( pest:: error:: Error :: new_from_span (
275275 pest:: error:: ErrorVariant :: CustomError {
276276 message : "break outside of loop" . to_string ( ) ,
277277 } ,
278278 stmt. as_span ( ) ,
279- ) ) ;
279+ ) ) ) ;
280280 }
281281 statements. push ( StmtInstruction :: Break ) ;
282282 }
@@ -286,12 +286,12 @@ fn parse_stmt(
286286 Rule :: return_stmt => {
287287 // return ( "(" expr? ")" )?
288288 if !in_function {
289- return Err ( pest:: error:: Error :: new_from_span (
289+ return Err ( Box :: new ( pest:: error:: Error :: new_from_span (
290290 pest:: error:: ErrorVariant :: CustomError {
291291 message : "return outside of function" . to_string ( ) ,
292292 } ,
293293 stmt. as_span ( ) ,
294- ) ) ;
294+ ) ) ) ;
295295 }
296296 let mut inner = stmt. into_inner ( ) ;
297297 if let Some ( expr) = inner. next ( ) {
@@ -381,7 +381,7 @@ fn parse_stmt(
381381 Ok ( instruction_count)
382382}
383383
384- fn parse_function ( func : Pair < Rule > , file : Rc < str > ) -> Result < Function , PestError > {
384+ fn parse_function ( func : Pair < Rule > , file : Rc < str > ) -> Result < Function , Box < PestError > > {
385385 let mut function = func. into_inner ( ) ;
386386
387387 // define letter ( parameter_list ) auto_define_list statement_list end
@@ -586,7 +586,7 @@ pub fn parse_program(text: &str, file_path: Option<&str>) -> Result<Program, Par
586586 if let Err ( e) =
587587 parse_stmt ( stmt, false , false , & mut instructions, & mut source_locations)
588588 {
589- errors. push ( e) ;
589+ errors. push ( * e) ;
590590 }
591591 }
592592 }
@@ -595,7 +595,7 @@ pub fn parse_program(text: &str, file_path: Option<&str>) -> Result<Program, Par
595595 name : f. name ,
596596 function : f,
597597 } ) ,
598- Err ( e) => errors. push ( e) ,
598+ Err ( e) => errors. push ( * e) ,
599599 } ,
600600 Rule :: EOI => { }
601601 _ => unreachable ! ( ) ,
0 commit comments