diff --git a/src/module/mod.rs b/src/module/mod.rs index 61d568ce..c642189e 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -2197,16 +2197,10 @@ impl Module { }) .for_each(|f| { let hash = module.set_script_fn(f.clone()); + let f = module.functions.as_mut().unwrap().get_mut(&hash).unwrap(); // Encapsulate AST environment - match module - .functions - .as_mut() - .unwrap() - .get_mut(&hash) - .unwrap() - .func - { + match f.func { CallableFunction::Script(.., ref mut e) => *e = Some(environ.clone()), _ => (), } diff --git a/src/tests.rs b/src/tests.rs index ebf6ebee..d4560a3f 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -31,14 +31,18 @@ fn check_struct_sizes() { size_of::>(), if IS_32_BIT { 12 } else { 16 } ); - assert_eq!( - size_of::(), - if IS_32_BIT { 12 } else { 24 } - ); - assert_eq!( - size_of::(), - if IS_32_BIT { 16 } else { 32 } - ); + + #[cfg(feature = "internals")] + { + assert_eq!( + size_of::(), + if IS_32_BIT { 12 } else { 24 } + ); + assert_eq!( + size_of::(), + if IS_32_BIT { 16 } else { 32 } + ); + } #[cfg(target_pointer_width = "64")] {