diff --git a/tests/spec/testsuite b/tests/spec/testsuite index c6a690f89a..1651919b1a 160000 --- a/tests/spec/testsuite +++ b/tests/spec/testsuite @@ -1 +1 @@ -Subproject commit c6a690f89a0dda3c79700aa6377d8b5d8a970eba +Subproject commit 1651919b1acb8052121c5d644254c0388339700a diff --git a/validation/src/lib.rs b/validation/src/lib.rs index 9a93f63ac3..a51a49f03c 100644 --- a/validation/src/lib.rs +++ b/validation/src/lib.rs @@ -262,7 +262,7 @@ pub fn validate_module(module: &Module) -> Result { - context.require_global(global_index, Some(false))?; + context.require_global(global_index, None)?; } Internal::Memory(memory_index) => { context.require_memory(memory_index)?; @@ -281,14 +281,7 @@ pub fn validate_module(module: &Module) -> Result { context.require_function_type(function_type_index)?; } - External::Global(ref global_type) => { - if global_type.is_mutable() { - return Err(Error(format!( - "trying to import mutable global {}", - import.field() - ))); - } - } + External::Global(_) => {} External::Memory(ref memory_type) => { validate_memory_type(memory_type)?; } diff --git a/validation/src/tests.rs b/validation/src/tests.rs index c6794cf3e9..480225d926 100644 --- a/validation/src/tests.rs +++ b/validation/src/tests.rs @@ -239,7 +239,7 @@ fn globals() { .build(); assert!(validate_module(&m).is_ok()); - // import mutable global is invalid. + // import mutable global is legal. let m = module() .with_import(ImportEntry::new( "env".into(), @@ -247,7 +247,7 @@ fn globals() { External::Global(GlobalType::new(ValueType::I32, true)), )) .build(); - assert!(validate_module(&m).is_err()); + assert!(validate_module(&m).is_ok()); } #[test]