File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use core::mem;
33
44fn main ( ) -> Result < ( ) , String > {
55 // Create the JIT instance, which manages all generated functions and data.
6- let mut jit = jit:: JIT :: new ( ) ;
6+ let mut jit = jit:: JIT :: default ( ) ;
77 println ! ( "the answer is: {}" , run_foo( & mut jit) ?) ;
88 println ! (
99 "recursive_fib(10) = {}" ,
Original file line number Diff line number Diff line change @@ -24,9 +24,8 @@ pub struct JIT {
2424 module : SimpleJITModule ,
2525}
2626
27- impl JIT {
28- /// Create a new `JIT` instance.
29- pub fn new ( ) -> Self {
27+ impl Default for JIT {
28+ fn default ( ) -> Self {
3029 let builder = SimpleJITBuilder :: new ( cranelift_module:: default_libcall_names ( ) ) ;
3130 let module = SimpleJITModule :: new ( builder) ;
3231 Self {
@@ -36,7 +35,9 @@ impl JIT {
3635 module,
3736 }
3837 }
38+ }
3939
40+ impl JIT {
4041 /// Compile a string in the toy language into machine code.
4142 pub fn compile ( & mut self , input : & str ) -> Result < * const u8 , String > {
4243 // First, parse the string, producing AST nodes.
You can’t perform that action at this time.
0 commit comments