Repository: bytecodealliance/wasmtime
Pull request #1733 (2020-05-20 18:57:13)

Rename `anyref` to `externref` across the board


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 33dc454f5..4be5e4c19 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1640,9 +1640,9 @@ dependencies = [
 
 [[package]]
 name = "regalloc"
-version = "0.0.24"
+version = "0.0.23"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5842bece8a4b1690ffa6d9d959081c1d5d851ee4337a36c0a121fafe8c16add2"
+checksum = "b36727ea09f6e363ddebb29b2d2620052267cc1fc6e0da7da63317938eb4104c"
 dependencies = [
  "log",
  "rustc-hash",
diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml
index b86453c50..0bc1c3200 100644
--- a/cranelift/codegen/Cargo.toml
+++ b/cranelift/codegen/Cargo.toml
@@ -25,7 +25,7 @@ smallvec = { version = "1.0.0" }
 thiserror = "1.0.4"
 byteorder = { version = "1.3.2", default-features = false }
 peepmatic-runtime = { path = "../peepmatic/crates/runtime", optional = true }
-regalloc = "0.0.24"
+regalloc = "0.0.23"
 # It is a goal of the cranelift-codegen crate to have minimal external dependencies.
 # Please don't add any unless they are essential to the task of creating binary
 # machine code. Integration tests that need external dependencies can be
diff --git a/cranelift/codegen/src/isa/aarch64/inst/mod.rs b/cranelift/codegen/src/isa/aarch64/inst/mod.rs
index 12291c8c0..fd910522c 100644
--- a/cranelift/codegen/src/isa/aarch64/inst/mod.rs
+++ b/cranelift/codegen/src/isa/aarch64/inst/mod.rs
@@ -1168,29 +1168,29 @@ fn aarch64_get_regs(inst: &Inst, collector: &mut RegUsageCollector) {
 //=============================================================================
 // Instructions: map_regs
 
-fn aarch64_map_regs<RUM: RegUsageMapper>(inst: &mut Inst, mapper: &RUM) {
-    fn map_use<RUM: RegUsageMapper>(m: &RUM, r: &mut Reg) {
+fn aarch64_map_regs(inst: &mut Inst, mapper: &RegUsageMapper) {
+    fn map_use(m: &RegUsageMapper, r: &mut Reg) {
         if r.is_virtual() {
             let new = m.get_use(r.to_virtual_reg()).unwrap().to_reg();
             *r = new;
         }
     }
 
-    fn map_def<RUM: RegUsageMapper>(m: &RUM, r: &mut Writable<Reg>) {
+    fn map_def(m: &RegUsageMapper, r: &mut Writable<Reg>) {
         if r.to_reg().is_virtual() {
             let new = m.get_def(r.to_reg().to_virtual_reg()).unwrap().to_reg();
             *r = Writable::from_reg(new);
         }
     }
 
-    fn map_mod<RUM: RegUsageMapper>(m: &RUM, r: &mut Writable<Reg>) {
+    fn map_mod(m: &RegUsageMapper, r: &mut Writable<Reg>) {
         if r.to_reg().is_virtual() {
             let new = m.get_mod(r.to_reg().to_virtual_reg()).unwrap().to_reg();
             *r = Writable::from_reg(new);
         }
     }
 
-    fn map_mem<RUM: RegUsageMapper>(m: &RUM, mem: &mut MemArg) {
+    fn map_mem(m: &RegUsageMapper, mem: &mut MemArg) {
         // N.B.: we take only the pre-map here, but this is OK because the
         // only addressing modes that update registers (pre/post-increment on
         // AArch64) both read and write registers, so they are "mods" rather
@@ -1219,7 +1219,7 @@ fn aarch64_map_regs<RUM: RegUsageMapper>(inst: &mut Inst, mapper: &RUM) {
         };
     }
 
-    fn map_pairmem<RUM: RegUsageMapper>(m: &RUM, mem: &mut PairMemArg) {
+    fn map_pairmem(m: &RegUsageMapper, mem: &mut PairMemArg) {
         match mem {
             &mut PairMemArg::SignedOffset(ref mut reg, ..) => map_use(m, reg),
             &mut PairMemArg::PreIndexed(ref mut reg, ..) => map_def(m, reg),
@@ -1227,7 +1227,7 @@ fn aarch64_map_regs<RUM: RegUsageMapper>(inst: &mut Inst, mapper: &RUM) {
         }
     }
 
-    fn map_br<RUM: RegUsageMapper>(m: &RUM, br: &mut CondBrKind) {
+    fn map_br(m: &RegUsageMapper, br: &mut CondBrKind) {
         match br {
             &mut CondBrKind::Zero(ref mut reg) => map_use(m, reg),
             &mut CondBrKind::NotZero(ref mut reg) => map_use(m, reg),
@@ -1738,7 +1738,7 @@ impl MachInst for Inst {
         aarch64_get_regs(self, collector)
     }
 
-    fn map_regs<RUM: RegUsageMapper>(&mut self, mapper: &RUM) {
+    fn map_regs(&mut self, mapper: &RegUsageMapper) {
         aarch64_map_regs(self, mapper);
     }
 
diff --git a/cranelift/codegen/src/isa/x64/inst/mod.rs b/cranelift/codegen/src/isa/x64/inst/mod.rs
index 1f3eb0a1e..a42653915 100644
--- a/cranelift/codegen/src/isa/x64/inst/mod.rs
+++ b/cranelift/codegen/src/isa/x64/inst/mod.rs
@@ -576,21 +576,21 @@ fn x64_get_regs(inst: &Inst, collector: &mut RegUsageCollector) {
 //=============================================================================
 // Instructions and subcomponents: map_regs
 
-fn map_use<RUM: RegUsageMapper>(m: &RUM, r: &mut Reg) {
+fn map_use(m: &RegUsageMapper, r: &mut Reg) {
     if r.is_virtual() {
         let new = m.get_use(r.to_virtual_reg()).unwrap().to_reg();
         *r = new;
     }
 }
 
-fn map_def<RUM: RegUsageMapper>(m: &RUM, r: &mut Writable<Reg>) {
+fn map_def(m: &RegUsageMapper, r: &mut Writable<Reg>) {
     if r.to_reg().is_virtual() {
         let new = m.get_def(r.to_reg().to_virtual_reg()).unwrap().to_reg();
         *r = Writable::from_reg(new);
     }
 }
 
-fn map_mod<RUM: RegUsageMapper>(m: &RUM, r: &mut Writable<Reg>) {
+fn map_mod(m: &RegUsageMapper, r: &mut Writable<Reg>) {
     if r.to_reg().is_virtual() {
         let new = m.get_mod(r.to_reg().to_virtual_reg()).unwrap().to_reg();
         *r = Writable::from_reg(new);
@@ -598,7 +598,7 @@ fn map_mod<RUM: RegUsageMapper>(m: &RUM, r: &mut Writable<Reg>) {
 }
 
 impl Addr {
-    fn map_uses<RUM: RegUsageMapper>(&mut self, map: &RUM) {
+    fn map_uses(&mut self, map: &RegUsageMapper) {
         match self {
             Addr::IR {
                 simm32: _,
@@ -618,7 +618,7 @@ impl Addr {
 }
 
 impl RMI {
-    fn map_uses<RUM: RegUsageMapper>(&mut self, map: &RUM) {
+    fn map_uses(&mut self, map: &RegUsageMapper) {
         match self {
             RMI::R { ref mut reg } => map_use(map, reg),
             RMI::M { ref mut addr } => addr.map_uses(map),
@@ -628,7 +628,7 @@ impl RMI {
 }
 
 impl RM {
-    fn map_uses<RUM: RegUsageMapper>(&mut self, map: &RUM) {
+    fn map_uses(&mut self, map: &RegUsageMapper) {
         match self {
             RM::R { ref mut reg } => map_use(map, reg),
             RM::M { ref mut addr } => addr.map_uses(map),
@@ -636,7 +636,7 @@ impl RM {
     }
 }
 
-fn x64_map_regs<RUM: RegUsageMapper>(inst: &mut Inst, mapper: &RUM) {
+fn x64_map_regs(inst: &mut Inst, mapper: &RegUsageMapper) {
     // Note this must be carefully synchronized with x64_get_regs.
     match inst {
         // ** Nop
@@ -739,7 +739,7 @@ impl MachInst for Inst {
         x64_get_regs(&self, collector)
     }
 
-    fn map_regs<RUM: RegUsageMapper>(&mut self, mapper: &RUM) {
+    fn map_regs(&mut self, mapper: &RegUsageMapper) {
         x64_map_regs(self, mapper);
     }
 
diff --git a/cranelift/codegen/src/machinst/mod.rs b/cranelift/codegen/src/machinst/mod.rs
index 8a29b06c0..517c3ac81 100644
--- a/cranelift/codegen/src/machinst/mod.rs
+++ b/cranelift/codegen/src/machinst/mod.rs
@@ -138,7 +138,7 @@ pub trait MachInst: Clone + Debug {
 
     /// Map virtual registers to physical registers using the given virt->phys
     /// maps corresponding to the program points prior to, and after, this instruction.
-    fn map_regs<RUM: RegUsageMapper>(&mut self, maps: &RUM);
+    fn map_regs(&mut self, maps: &RegUsageMapper);
 
     /// If this is a simple move, return the (source, destination) tuple of registers.
     fn is_move(&self) -> Option<(Writable<Reg>, Reg)>;
diff --git a/cranelift/codegen/src/machinst/vcode.rs b/cranelift/codegen/src/machinst/vcode.rs
index ec28d3d2e..d4c13bff0 100644
--- a/cranelift/codegen/src/machinst/vcode.rs
+++ b/cranelift/codegen/src/machinst/vcode.rs
@@ -457,7 +457,7 @@ impl<I: VCodeInst> RegallocFunction for VCode<I> {
         insn.get_regs(collector)
     }
 
-    fn map_regs<RUM: RegUsageMapper>(insn: &mut I, mapper: &RUM) {
+    fn map_regs(insn: &mut I, mapper: &RegUsageMapper) {
         insn.map_regs(mapper);
     }
 
diff --git a/crates/c-api/macros/src/lib.rs b/crates/c-api/macros/src/lib.rs
index 91ec70253..304b95c4e 100644
--- a/crates/c-api/macros/src/lib.rs
+++ b/crates/c-api/macros/src/lib.rs
@@ -72,17 +72,17 @@ pub fn declare_ref(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
 
         #[no_mangle]
         pub extern fn #same(a: &#ty, b: &#ty) -> bool {
-            a.anyref().ptr_eq(&b.anyref())
+            a.externref().ptr_eq(&b.externref())
         }
 
         #[no_mangle]
         pub extern fn #get_host_info(a: &#ty) -> *mut std::os::raw::c_void {
-            crate::r#ref::get_host_info(&a.anyref())
+            crate::r#ref::get_host_info(&a.externref())
         }
 
         #[no_mangle]
         pub extern fn #set_host_info(a: &#ty, info: *mut std::os::raw::c_void) {
-            crate::r#ref::set_host_info(&a.anyref(), info, None)
+            crate::r#ref::set_host_info(&a.externref(), info, None)
         }
 
         #[no_mangle]
@@ -91,12 +91,12 @@ pub fn declare_ref(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
             info: *mut std::os::raw::c_void,
             finalizer: Option<extern "C" fn(*mut std::os::raw::c_void)>,
         ) {
-            crate::r#ref::set_host_info(&a.anyref(), info, finalizer)
+            crate::r#ref::set_host_info(&a.externref(), info, finalizer)
         }
 
         #[no_mangle]
         pub extern fn #as_ref(a: &#ty) -> Box<crate::wasm_ref_t> {
-            let r = a.anyref();
+            let r = a.externref();
             Box::new(crate::wasm_ref_t { r })
         }
 
diff --git a/crates/c-api/src/extern.rs b/crates/c-api/src/extern.rs
index b882082fa..025f23349 100644
--- a/crates/c-api/src/extern.rs
+++ b/crates/c-api/src/extern.rs
@@ -18,12 +18,12 @@ pub(crate) enum ExternHost {
 }
 
 impl wasm_extern_t {
-    fn anyref(&self) -> wasmtime::AnyRef {
+    fn externref(&self) -> wasmtime::ExternRef {
         match &self.which {
-            ExternHost::Func(f) => f.anyref(),
-            ExternHost::Global(f) => f.anyref(),
-            ExternHost::Memory(f) => f.anyref(),
-            ExternHost::Table(f) => f.anyref(),
+            ExternHost::Func(f) => f.externref(),
+            ExternHost::Global(f) => f.externref(),
+            ExternHost::Memory(f) => f.externref(),
+            ExternHost::Table(f) => f.externref(),
         }
     }
 }
diff --git a/crates/c-api/src/func.rs b/crates/c-api/src/func.rs
index 879248b23..0d3e3d10c 100644
--- a/crates/c-api/src/func.rs
+++ b/crates/c-api/src/func.rs
@@ -70,8 +70,8 @@ impl wasm_func_t {
         }
     }
 
-    fn anyref(&self) -> wasmtime::AnyRef {
-        self.func().anyref()
+    fn externref(&self) -> wasmtime::ExternRef {
+        self.func().externref()
     }
 }
 
diff --git a/crates/c-api/src/global.rs b/crates/c-api/src/global.rs
index fb3f163ba..b7ef6ebd7 100644
--- a/crates/c-api/src/global.rs
+++ b/crates/c-api/src/global.rs
@@ -26,8 +26,8 @@ impl wasm_global_t {
         }
     }
 
-    fn anyref(&self) -> wasmtime::AnyRef {
-        self.global().anyref()
+    fn externref(&self) -> wasmtime::ExternRef {
+        self.global().externref()
     }
 }
 
diff --git a/crates/c-api/src/instance.rs b/crates/c-api/src/instance.rs
index 0ac864f5c..6d528530d 100644
--- a/crates/c-api/src/instance.rs
+++ b/crates/c-api/src/instance.rs
@@ -22,8 +22,8 @@ impl wasm_instance_t {
         }
     }
 
-    fn anyref(&self) -> wasmtime::AnyRef {
-        self.instance.anyref()
+    fn externref(&self) -> wasmtime::ExternRef {
+        self.instance.externref()
     }
 }
 
diff --git a/crates/c-api/src/memory.rs b/crates/c-api/src/memory.rs
index d77f01c4e..48159b94e 100644
--- a/crates/c-api/src/memory.rs
+++ b/crates/c-api/src/memory.rs
@@ -26,8 +26,8 @@ impl wasm_memory_t {
         }
     }
 
-    fn anyref(&self) -> wasmtime::AnyRef {
-        self.memory().anyref()
+    fn externref(&self) -> wasmtime::ExternRef {
+        self.memory().externref()
     }
 }
 
diff --git a/crates/c-api/src/module.rs b/crates/c-api/src/module.rs
index 036363260..23c5eae36 100644
--- a/crates/c-api/src/module.rs
+++ b/crates/c-api/src/module.rs
@@ -15,8 +15,8 @@ pub struct wasm_module_t {
 wasmtime_c_api_macros::declare_ref!(wasm_module_t);
 
 impl wasm_module_t {
-    fn anyref(&self) -> wasmtime::AnyRef {
-        self.module.anyref()
+    fn externref(&self) -> wasmtime::ExternRef {
+        self.module.externref()
     }
 }
 
diff --git a/crates/c-api/src/ref.rs b/crates/c-api/src/ref.rs
index 4606cc41e..00f93865c 100644
--- a/crates/c-api/src/ref.rs
+++ b/crates/c-api/src/ref.rs
@@ -1,11 +1,11 @@
 use crate::HostInfoState;
 use std::os::raw::c_void;
-use wasmtime::AnyRef;
+use wasmtime::ExternRef;
 
 #[repr(C)]
 #[derive(Clone)]
 pub struct wasm_ref_t {
-    pub(crate) r: AnyRef,
+    pub(crate) r: ExternRef,
 }
 
 wasmtime_c_api_macros::declare_own!(wasm_ref_t);
@@ -20,7 +20,7 @@ pub extern "C" fn wasm_ref_same(a: &wasm_ref_t, b: &wasm_ref_t) -> bool {
     a.r.ptr_eq(&b.r)
 }
 
-pub(crate) fn get_host_info(r: &AnyRef) -> *mut c_void {
+pub(crate) fn get_host_info(r: &ExternRef) -> *mut c_void {
     let host_info = match r.host_info() {
         Some(info) => info,
         None => return std::ptr::null_mut(),
@@ -37,7 +37,7 @@ pub extern "C" fn wasm_ref_get_host_info(a: &wasm_ref_t) -> *mut c_void {
 }
 
 pub(crate) fn set_host_info(
-    r: &AnyRef,
+    r: &ExternRef,
     info: *mut c_void,
     finalizer: Option<extern "C" fn(*mut c_void)>,
 ) {
diff --git a/crates/c-api/src/table.rs b/crates/c-api/src/table.rs
index ab4ae3ff2..16626acf7 100644
--- a/crates/c-api/src/table.rs
+++ b/crates/c-api/src/table.rs
@@ -1,7 +1,7 @@
 use crate::{handle_result, wasm_func_t, wasm_ref_t, wasmtime_error_t};
 use crate::{wasm_extern_t, wasm_store_t, wasm_tabletype_t, ExternHost};
 use std::ptr;
-use wasmtime::{AnyRef, HostRef, Table, Val};
+use wasmtime::{ExternRef, HostRef, Table, Val};
 
 #[derive(Clone)]
 #[repr(transparent)]
@@ -28,8 +28,8 @@ impl wasm_table_t {
         }
     }
 
-    fn anyref(&self) -> wasmtime::AnyRef {
-        self.table().anyref()
+    fn externref(&self) -> wasmtime::ExternRef {
+        self.table().externref()
     }
 }
 
@@ -41,7 +41,7 @@ pub extern "C" fn wasm_table_new(
 ) -> Option<Box<wasm_table_t>> {
     let init: Val = match init {
         Some(init) => init.r.into(),
-        None => Val::AnyRef(AnyRef::Null),
+        None => Val::ExternRef(ExternRef::Null),
     };
     let table = Table::new(&store.store.borrow(), tt.ty().ty.clone(), init).ok()?;
     Some(Box::new(wasm_table_t {
@@ -60,7 +60,7 @@ pub extern "C" fn wasmtime_funcref_table_new(
 ) -> Option<Box<wasmtime_error_t>> {
     let init: Val = match init {
         Some(val) => Val::FuncRef(val.func().borrow().clone()),
-        None => Val::AnyRef(AnyRef::Null),
+        None => Val::ExternRef(ExternRef::Null),
     };
     handle_result(
         Table::new(&store.store.borrow(), tt.ty().ty.clone(), init),
@@ -84,7 +84,7 @@ pub extern "C" fn wasm_table_type(t: &wasm_table_t) -> Box<wasm_tabletype_t> {
 pub extern "C" fn wasm_table_get(t: &wasm_table_t, index: wasm_table_size_t) -> *mut wasm_ref_t {
     match t.table().borrow().get(index) {
         Some(val) => into_funcref(val),
-        None => into_funcref(Val::AnyRef(AnyRef::Null)),
+        None => into_funcref(Val::ExternRef(ExternRef::Null)),
     }
 }
 
@@ -99,7 +99,7 @@ pub extern "C" fn wasmtime_funcref_table_get(
             *ptr = match val {
                 // TODO: what do do about creating new `HostRef` handles here?
                 Val::FuncRef(f) => Box::into_raw(Box::new(HostRef::new(f).into())),
-                Val::AnyRef(AnyRef::Null) => ptr::null_mut(),
+                Val::ExternRef(ExternRef::Null) => ptr::null_mut(),
                 _ => return false,
             };
         }
@@ -127,20 +127,20 @@ pub extern "C" fn wasmtime_funcref_table_set(
 ) -> Option<Box<wasmtime_error_t>> {
     let val = match val {
         Some(val) => Val::FuncRef(val.func().borrow().clone()),
-        None => Val::AnyRef(AnyRef::Null),
+        None => Val::ExternRef(ExternRef::Null),
     };
     handle_result(t.table().borrow().set(index, val), |()| {})
 }
 
 fn into_funcref(val: Val) -> *mut wasm_ref_t {
-    if let Val::AnyRef(AnyRef::Null) = val {
+    if let Val::ExternRef(ExternRef::Null) = val {
         return ptr::null_mut();
     }
-    let anyref = match val.anyref() {
-        Some(anyref) => anyref,
+    let externref = match val.externref() {
+        Some(externref) => externref,
         None => return ptr::null_mut(),
     };
-    let r = Box::new(wasm_ref_t { r: anyref });
+    let r = Box::new(wasm_ref_t { r: externref });
     Box::into_raw(r)
 }
 
@@ -148,7 +148,7 @@ unsafe fn from_funcref(r: *mut wasm_ref_t) -> Val {
     if !r.is_null() {
         Box::from_raw(r).r.into()
     } else {
-        Val::AnyRef(AnyRef::Null)
+        Val::ExternRef(ExternRef::Null)
     }
 }
 
@@ -176,7 +176,7 @@ pub extern "C" fn wasmtime_funcref_table_grow(
 ) -> Option<Box<wasmtime_error_t>> {
     let val = match init {
         Some(val) => Val::FuncRef(val.func().borrow().clone()),
-        None => Val::AnyRef(AnyRef::Null),
+        None => Val::ExternRef(ExternRef::Null),
     };
     handle_result(t.table().borrow().grow(delta, val), |prev| {
         if let Some(ptr) = prev_size {
diff --git a/crates/c-api/src/trap.rs b/crates/c-api/src/trap.rs
index 67ca334d7..8a93cba14 100644
--- a/crates/c-api/src/trap.rs
+++ b/crates/c-api/src/trap.rs
@@ -17,8 +17,8 @@ impl wasm_trap_t {
         }
     }
 
-    fn anyref(&self) -> wasmtime::AnyRef {
-        self.trap.anyref()
+    fn externref(&self) -> wasmtime::ExternRef {
+        self.trap.externref()
     }
 }
 
diff --git a/crates/c-api/src/types/val.rs b/crates/c-api/src/types/val.rs
index 5333ec608..a421516b8 100644
--- a/crates/c-api/src/types/val.rs
+++ b/crates/c-api/src/types/val.rs
@@ -13,7 +13,7 @@ pub const WASM_I32: wasm_valkind_t = 0;
 pub const WASM_I64: wasm_valkind_t = 1;
 pub const WASM_F32: wasm_valkind_t = 2;
 pub const WASM_F64: wasm_valkind_t = 3;
-pub const WASM_ANYREF: wasm_valkind_t = 128;
+pub const WASM_EXTERNREF: wasm_valkind_t = 128;
 pub const WASM_FUNCREF: wasm_valkind_t = 129;
 
 #[no_mangle]
@@ -34,7 +34,7 @@ pub(crate) fn into_valtype(kind: wasm_valkind_t) -> ValType {
         WASM_I64 => ValType::I64,
         WASM_F32 => ValType::F32,
         WASM_F64 => ValType::F64,
-        WASM_ANYREF => ValType::AnyRef,
+        WASM_EXTERNREF => ValType::ExternRef,
         WASM_FUNCREF => ValType::FuncRef,
         _ => panic!("unexpected kind: {}", kind),
     }
@@ -46,7 +46,7 @@ pub(crate) fn from_valtype(ty: &ValType) -> wasm_valkind_t {
         ValType::I64 => WASM_I64,
         ValType::F32 => WASM_F32,
         ValType::F64 => WASM_F64,
-        ValType::AnyRef => WASM_ANYREF,
+        ValType::ExternRef => WASM_EXTERNREF,
         ValType::FuncRef => WASM_FUNCREF,
         _ => panic!("wasm_valkind_t has no known conversion for {:?}", ty),
     }
diff --git a/crates/fuzzing/src/oracles.rs b/crates/fuzzing/src/oracles.rs
index a6df5a56c..a3d960843 100644
--- a/crates/fuzzing/src/oracles.rs
+++ b/crates/fuzzing/src/oracles.rs
@@ -65,7 +65,7 @@ pub fn instantiate_with_config(wasm: &[u8], config: Config) {
         Ok(imps) => imps,
         Err(_) => {
             // There are some value types that we can't synthesize a
-            // dummy value for (e.g. anyrefs) and for modules that
+            // dummy value for (e.g. externrefs) and for modules that
             // import things of these types we skip instantiation.
             return;
         }
@@ -147,7 +147,7 @@ pub fn differential_execution(
             Ok(imps) => imps,
             Err(e) => {
                 // There are some value types that we can't synthesize a
-                // dummy value for (e.g. anyrefs) and for modules that
+                // dummy value for (e.g. externrefs) and for modules that
                 // import things of these types we skip instantiation.
                 eprintln!("Warning: failed to synthesize dummy imports: {}", e);
                 continue;
@@ -244,9 +244,8 @@ pub fn differential_execution(
                                 fail()
                             }
                         }
-                        (Val::AnyRef(_), Val::AnyRef(_)) | (Val::FuncRef(_), Val::FuncRef(_)) => {
-                            continue
-                        }
+                        (Val::ExternRef(_), Val::ExternRef(_))
+                        | (Val::FuncRef(_), Val::FuncRef(_)) => continue,
                         _ => fail(),
                     }
                 }
@@ -329,7 +328,7 @@ pub fn make_api_calls(api: crate::generators::api::ApiCalls) {
                     Ok(imps) => imps,
                     Err(_) => {
                         // There are some value types that we can't synthesize a
-                        // dummy value for (e.g. anyrefs) and for modules that
+                        // dummy value for (e.g. externrefs) and for modules that
                         // import things of these types we skip instantiation.
                         continue;
                     }
diff --git a/crates/fuzzing/src/oracles/dummy.rs b/crates/fuzzing/src/oracles/dummy.rs
index 2e904ec1a..1dc35ed3a 100644
--- a/crates/fuzzing/src/oracles/dummy.rs
+++ b/crates/fuzzing/src/oracles/dummy.rs
@@ -44,9 +44,9 @@ pub fn dummy_value(val_ty: &ValType) -> Result<Val, Trap> {
                 "dummy_value: unsupported function return type: v128".to_string(),
             ))
         }
-        ValType::AnyRef => {
+        ValType::ExternRef => {
             return Err(Trap::new(
-                "dummy_value: unsupported function return type: anyref".to_string(),
+                "dummy_value: unsupported function return type: externref".to_string(),
             ))
         }
         ValType::FuncRef => {
diff --git a/crates/wasmtime/src/func.rs b/crates/wasmtime/src/func.rs
index dda4fcee7..70bf2843b 100644
--- a/crates/wasmtime/src/func.rs
+++ b/crates/wasmtime/src/func.rs
@@ -298,7 +298,7 @@ impl Func {
     /// | `f32`              | `f32`            |
     /// | `f64`              | `f64`            |
     /// | (not supported)    | `v128`           |
-    /// | (not supported)    | `anyref`         |
+    /// | (not supported)    | `externref`         |
     ///
     /// Any of the Rust types can be returned from the closure as well, in
     /// addition to some extra types
diff --git a/crates/wasmtime/src/lib.rs b/crates/wasmtime/src/lib.rs
index 034283326..e08fbb15f 100644
--- a/crates/wasmtime/src/lib.rs
+++ b/crates/wasmtime/src/lib.rs
@@ -29,7 +29,7 @@ pub use crate::func::*;
 pub use crate::instance::Instance;
 pub use crate::linker::*;
 pub use crate::module::Module;
-pub use crate::r#ref::{AnyRef, HostRef};
+pub use crate::r#ref::{ExternRef, HostRef};
 pub use crate::runtime::*;
 pub use crate::trap::Trap;
 pub use crate::types::*;
diff --git a/crates/wasmtime/src/ref.rs b/crates/wasmtime/src/ref.rs
index 2083c183d..f78aaf0e9 100644
--- a/crates/wasmtime/src/ref.rs
+++ b/crates/wasmtime/src/ref.rs
@@ -38,7 +38,7 @@ pub struct OtherRef(Rc<RefCell<AnyAndHostInfo>>);
 
 /// Represents an opaque reference to any data within WebAssembly.
 #[derive(Clone)]
-pub enum AnyRef {
+pub enum ExternRef {
     /// A reference to no data.
     Null,
     /// A reference to data stored internally in `wasmtime`.
@@ -47,52 +47,54 @@ pub enum AnyRef {
     Other(OtherRef),
 }
 
-impl AnyRef {
-    /// Creates a new instance of `AnyRef` from `Box<dyn Any>`.
+impl ExternRef {
+    /// Creates a new instance of `ExternRef` from `Box<dyn Any>`.
     pub fn new(data: Box<dyn Any>) -> Self {
         let info = AnyAndHostInfo {
             any: data,
             host_info: None,
         };
-        AnyRef::Other(OtherRef(Rc::new(RefCell::new(info))))
+        ExternRef::Other(OtherRef(Rc::new(RefCell::new(info))))
     }
 
     /// Creates a `Null` reference.
     pub fn null() -> Self {
-        AnyRef::Null
+        ExternRef::Null
     }
 
     /// Returns the data stored in the reference if available.
     /// # Panics
-    /// Panics if the variant isn't `AnyRef::Other`.
+    /// Panics if the variant isn't `ExternRef::Other`.
     pub fn data(&self) -> cell::Ref<Box<dyn Any>> {
         match self {
-            AnyRef::Other(OtherRef(r)) => cell::Ref::map(r.borrow(), |r| &r.any),
-            _ => panic!("expected AnyRef::Other"),
+            ExternRef::Other(OtherRef(r)) => cell::Ref::map(r.borrow(), |r| &r.any),
+            _ => panic!("expected ExternRef::Other"),
         }
     }
 
-    /// Returns true if the two `AnyRef<T>`'s point to the same value (not just
+    /// Returns true if the two `ExternRef<T>`'s point to the same value (not just
     /// values that compare as equal).
-    pub fn ptr_eq(&self, other: &AnyRef) -> bool {
+    pub fn ptr_eq(&self, other: &ExternRef) -> bool {
         match (self, other) {
-            (AnyRef::Null, AnyRef::Null) => true,
-            (AnyRef::Ref(InternalRef(ref a)), AnyRef::Ref(InternalRef(ref b))) => {
+            (ExternRef::Null, ExternRef::Null) => true,
+            (ExternRef::Ref(InternalRef(ref a)), ExternRef::Ref(InternalRef(ref b))) => {
                 a.ptr_eq(b.as_ref())
             }
-            (AnyRef::Other(OtherRef(ref a)), AnyRef::Other(OtherRef(ref b))) => Rc::ptr_eq(a, b),
+            (ExternRef::Other(OtherRef(ref a)), ExternRef::Other(OtherRef(ref b))) => {
+                Rc::ptr_eq(a, b)
+            }
             _ => false,
         }
     }
 
     /// Returns a mutable reference to the host information if available.
     /// # Panics
-    /// Panics if `AnyRef` is already borrowed or `AnyRef` is `Null`.
+    /// Panics if `ExternRef` is already borrowed or `ExternRef` is `Null`.
     pub fn host_info(&self) -> Option<cell::RefMut<Box<dyn Any>>> {
         match self {
-            AnyRef::Null => panic!("null"),
-            AnyRef::Ref(r) => r.0.host_info(),
-            AnyRef::Other(r) => {
+            ExternRef::Null => panic!("null"),
+            ExternRef::Ref(r) => r.0.host_info(),
+            ExternRef::Other(r) => {
                 let info = cell::RefMut::map(r.0.borrow_mut(), |b| &mut b.host_info);
                 if info.is_none() {
                     return None;
@@ -102,26 +104,26 @@ impl AnyRef {
         }
     }
 
-    /// Sets the host information for an `AnyRef`.
+    /// Sets the host information for an `ExternRef`.
     /// # Panics
-    /// Panics if `AnyRef` is already borrowed or `AnyRef` is `Null`.
+    /// Panics if `ExternRef` is already borrowed or `ExternRef` is `Null`.
     pub fn set_host_info(&self, info: Option<Box<dyn Any>>) {
         match self {
-            AnyRef::Null => panic!("null"),
-            AnyRef::Ref(r) => r.0.set_host_info(info),
-            AnyRef::Other(r) => {
+            ExternRef::Null => panic!("null"),
+            ExternRef::Ref(r) => r.0.set_host_info(info),
+            ExternRef::Other(r) => {
                 r.0.borrow_mut().host_info = info;
             }
         }
     }
 }
 
-impl fmt::Debug for AnyRef {
+impl fmt::Debug for ExternRef {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
-            AnyRef::Null => write!(f, "null"),
-            AnyRef::Ref(_) => write!(f, "anyref"),
-            AnyRef::Other(_) => write!(f, "other ref"),
+            ExternRef::Null => write!(f, "null"),
+            ExternRef::Ref(_) => write!(f, "externref"),
+            ExternRef::Other(_) => write!(f, "other ref"),
         }
     }
 }
@@ -129,7 +131,7 @@ impl fmt::Debug for AnyRef {
 struct ContentBox<T> {
     content: T,
     host_info: Option<Box<dyn Any>>,
-    anyref_data: Weak<dyn InternalRefBase>,
+    externref_data: Weak<dyn InternalRefBase>,
 }
 
 /// Represents a piece of data located in the host environment.
@@ -138,11 +140,11 @@ pub struct HostRef<T>(Rc<RefCell<ContentBox<T>>>);
 impl<T: 'static> HostRef<T> {
     /// Creates a new `HostRef<T>` from `T`.
     pub fn new(item: T) -> HostRef<T> {
-        let anyref_data: Weak<HostRef<T>> = Weak::new();
+        let externref_data: Weak<HostRef<T>> = Weak::new();
         let content = ContentBox {
             content: item,
             host_info: None,
-            anyref_data,
+            externref_data,
         };
         HostRef(Rc::new(RefCell::new(content)))
     }
@@ -168,17 +170,17 @@ impl<T: 'static> HostRef<T> {
     }
 
     /// Returns an opaque reference to the wrapped data in the form of
-    /// an `AnyRef`.
+    /// an `ExternRef`.
     /// # Panics
     /// Panics if `HostRef<T>` is already mutably borrowed.
-    pub fn anyref(&self) -> AnyRef {
-        let r = self.0.borrow_mut().anyref_data.upgrade();
+    pub fn externref(&self) -> ExternRef {
+        let r = self.0.borrow_mut().externref_data.upgrade();
         if let Some(r) = r {
-            return AnyRef::Ref(InternalRef(r));
+            return ExternRef::Ref(InternalRef(r));
         }
-        let anyref_data: Rc<dyn InternalRefBase> = Rc::new(self.clone());
-        self.0.borrow_mut().anyref_data = Rc::downgrade(&anyref_data);
-        AnyRef::Ref(InternalRef(anyref_data))
+        let externref_data: Rc<dyn InternalRefBase> = Rc::new(self.clone());
+        self.0.borrow_mut().externref_data = Rc::downgrade(&externref_data);
+        ExternRef::Ref(InternalRef(externref_data))
     }
 }
 
diff --git a/crates/wasmtime/src/runtime.rs b/crates/wasmtime/src/runtime.rs
index f1a0b7892..2ba9f2fc4 100644
--- a/crates/wasmtime/src/runtime.rs
+++ b/crates/wasmtime/src/runtime.rs
@@ -172,7 +172,7 @@ impl Config {
     /// feature can be enabled through this method for appropriate wasm
     /// modules.
     ///
-    /// This feature gates items such as the `anyref` type and multiple tables
+    /// This feature gates items such as the `externref` type and multiple tables
     /// being in a module. Note that enabling the reference types feature will
     /// also enable the bulk memory feature.
     ///
diff --git a/crates/wasmtime/src/types.rs b/crates/wasmtime/src/types.rs
index 8bf966a04..5fe37eeea 100644
--- a/crates/wasmtime/src/types.rs
+++ b/crates/wasmtime/src/types.rs
@@ -62,7 +62,7 @@ pub enum ValType {
     /// A 128 bit number.
     V128,
     /// A reference to opaque data in the Wasm instance.
-    AnyRef, /* = 128 */
+    ExternRef, /* = 128 */
     /// A reference to a Wasm function.
     FuncRef,
 }
@@ -80,7 +80,7 @@ impl ValType {
     /// Returns true if `ValType` matches either of the reference types.
     pub fn is_ref(&self) -> bool {
         match self {
-            ValType::AnyRef | ValType::FuncRef => true,
+            ValType::ExternRef | ValType::FuncRef => true,
             _ => false,
         }
     }
@@ -321,7 +321,7 @@ impl GlobalType {
 /// A descriptor for a table in a WebAssembly module.
 ///
 /// Tables are contiguous chunks of a specific element, typically a `funcref` or
-/// an `anyref`. The most common use for tables is a function table through
+/// an `externref`. The most common use for tables is a function table through
 /// which `call_indirect` can invoke other functions.
 #[derive(Debug, Clone, Hash, Eq, PartialEq)]
 pub struct TableType {
diff --git a/crates/wasmtime/src/values.rs b/crates/wasmtime/src/values.rs
index 6eb8004d9..c0b8dd810 100644
--- a/crates/wasmtime/src/values.rs
+++ b/crates/wasmtime/src/values.rs
@@ -1,4 +1,4 @@
-use crate::r#ref::AnyRef;
+use crate::r#ref::ExternRef;
 use crate::{Func, Store, ValType};
 use anyhow::{bail, Result};
 use std::ptr;
@@ -25,10 +25,10 @@ pub enum Val {
     /// `f64::from_bits` to create an `f64` value.
     F64(u64),
 
-    /// An `anyref` value which can hold opaque data to the wasm instance itself.
+    /// An `externref` value which can hold opaque data to the wasm instance itself.
     ///
     /// Note that this is a nullable value as well.
-    AnyRef(AnyRef),
+    ExternRef(ExternRef),
 
     /// A first-class reference to a WebAssembly function.
     FuncRef(Func),
@@ -62,9 +62,9 @@ macro_rules! accessors {
 }
 
 impl Val {
-    /// Returns a null `anyref` value.
+    /// Returns a null `externref` value.
     pub fn null() -> Val {
-        Val::AnyRef(AnyRef::null())
+        Val::ExternRef(ExternRef::null())
     }
 
     /// Returns the corresponding [`ValType`] for this `Val`.
@@ -74,7 +74,7 @@ impl Val {
             Val::I64(_) => ValType::I64,
             Val::F32(_) => ValType::F32,
             Val::F64(_) => ValType::F64,
-            Val::AnyRef(_) => ValType::AnyRef,
+            Val::ExternRef(_) => ValType::ExternRef,
             Val::FuncRef(_) => ValType::FuncRef,
             Val::V128(_) => ValType::V128,
         }
@@ -115,10 +115,10 @@ impl Val {
     /// Attempt to access the underlying value of this `Val`, returning
     /// `None` if it is not the correct type.
     ///
-    /// This will return `Some` for both the `AnyRef` and `FuncRef` types.
-    pub fn anyref(&self) -> Option<AnyRef> {
+    /// This will return `Some` for both the `ExternRef` and `FuncRef` types.
+    pub fn externref(&self) -> Option<ExternRef> {
         match self {
-            Val::AnyRef(e) => Some(e.clone()),
+            Val::ExternRef(e) => Some(e.clone()),
             _ => None,
         }
     }
@@ -129,8 +129,8 @@ impl Val {
     /// # Panics
     ///
     /// Panics if `self` is not of the right type.
-    pub fn unwrap_anyref(&self) -> AnyRef {
-        self.anyref().expect("expected anyref")
+    pub fn unwrap_externref(&self) -> ExternRef {
+        self.externref().expect("expected externref")
     }
 
     pub(crate) fn comes_from_same_store(&self, store: &Store) -> bool {
@@ -138,10 +138,10 @@ impl Val {
             Val::FuncRef(f) => Store::same(store, f.store()),
 
             // TODO: need to implement this once we actually finalize what
-            // `anyref` will look like and it's actually implemented to pass it
+            // `externref` will look like and it's actually implemented to pass it
             // to compiled wasm as well.
-            Val::AnyRef(AnyRef::Ref(_)) | Val::AnyRef(AnyRef::Other(_)) => false,
-            Val::AnyRef(AnyRef::Null) => true,
+            Val::ExternRef(ExternRef::Ref(_)) | Val::ExternRef(ExternRef::Other(_)) => false,
+            Val::ExternRef(ExternRef::Null) => true,
 
             // Integers have no association with any particular store, so
             // they're always considered as "yes I came from that store",
@@ -174,9 +174,9 @@ impl From<f64> for Val {
     }
 }
 
-impl From<AnyRef> for Val {
-    fn from(val: AnyRef) -> Val {
-        Val::AnyRef(val)
+impl From<ExternRef> for Val {
+    fn from(val: ExternRef) -> Val {
+        Val::ExternRef(val)
     }
 }
 
@@ -194,7 +194,7 @@ pub(crate) fn into_checked_anyfunc(
         bail!("cross-`Store` values are not supported");
     }
     Ok(match val {
-        Val::AnyRef(AnyRef::Null) => wasmtime_runtime::VMCallerCheckedAnyfunc {
+        Val::ExternRef(ExternRef::Null) => wasmtime_runtime::VMCallerCheckedAnyfunc {
             func_ptr: ptr::null(),
             type_index: wasmtime_runtime::VMSharedSignatureIndex::default(),
             vmctx: ptr::null_mut(),
@@ -216,7 +216,7 @@ pub(crate) fn from_checked_anyfunc(
     store: &Store,
 ) -> Val {
     if item.type_index == wasmtime_runtime::VMSharedSignatureIndex::default() {
-        return Val::AnyRef(AnyRef::Null);
+        return Val::ExternRef(ExternRef::Null);
     }
     let instance_handle = unsafe { wasmtime_runtime::InstanceHandle::from_vmctx(item.vmctx) };
     let export = wasmtime_runtime::ExportFunction {
diff --git a/src/commands/run.rs b/src/commands/run.rs
index d25340209..e638606b8 100644
--- a/src/commands/run.rs
+++ b/src/commands/run.rs
@@ -337,8 +337,8 @@ impl RunCommand {
                 Val::I64(i) => println!("{}", i),
                 Val::F32(f) => println!("{}", f),
                 Val::F64(f) => println!("{}", f),
-                Val::AnyRef(_) => println!("<anyref>"),
-                Val::FuncRef(_) => println!("<anyref>"),
+                Val::ExternRef(_) => println!("<externref>"),
+                Val::FuncRef(_) => println!("<externref>"),
                 Val::V128(i) => println!("{}", i),
             }
         }


Test patch:
diff --git a/crates/wast/src/spectest.rs b/crates/wast/src/spectest.rs
index 60f6a6d09..ed10b7786 100644
--- a/crates/wast/src/spectest.rs
+++ b/crates/wast/src/spectest.rs
@@ -35,7 +35,7 @@ pub fn link_spectest(linker: &mut Linker) -> Result<()> {
     linker.define("spectest", "global_f64", g)?;
 
     let ty = TableType::new(ValType::FuncRef, Limits::new(10, Some(20)));
-    let table = Table::new(linker.store(), ty, Val::AnyRef(AnyRef::Null))?;
+    let table = Table::new(linker.store(), ty, Val::ExternRef(ExternRef::Null))?;
     linker.define("spectest", "table", table)?;
 
     let ty = MemoryType::new(Limits::new(1, Some(2)));
diff --git a/tests/all/externals.rs b/tests/all/externals.rs
index ba9978cbb..0919f1368 100644
--- a/tests/all/externals.rs
+++ b/tests/all/externals.rs
@@ -28,27 +28,47 @@ fn bad_tables() {
 
     // get out of bounds
     let ty = TableType::new(ValType::FuncRef, Limits::new(0, Some(1)));
-    let t = Table::new(&Store::default(), ty.clone(), Val::AnyRef(AnyRef::Null)).unwrap();
+    let t = Table::new(
+        &Store::default(),
+        ty.clone(),
+        Val::ExternRef(ExternRef::Null),
+    )
+    .unwrap();
     assert!(t.get(0).is_none());
     assert!(t.get(u32::max_value()).is_none());
 
     // set out of bounds or wrong type
     let ty = TableType::new(ValType::FuncRef, Limits::new(1, Some(1)));
-    let t = Table::new(&Store::default(), ty.clone(), Val::AnyRef(AnyRef::Null)).unwrap();
+    let t = Table::new(
+        &Store::default(),
+        ty.clone(),
+        Val::ExternRef(ExternRef::Null),
+    )
+    .unwrap();
     assert!(t.set(0, Val::I32(0)).is_err());
-    assert!(t.set(0, Val::AnyRef(AnyRef::Null)).is_ok());
-    assert!(t.set(1, Val::AnyRef(AnyRef::Null)).is_err());
+    assert!(t.set(0, Val::ExternRef(ExternRef::Null)).is_ok());
+    assert!(t.set(1, Val::ExternRef(ExternRef::Null)).is_err());
 
     // grow beyond max
     let ty = TableType::new(ValType::FuncRef, Limits::new(1, Some(1)));
-    let t = Table::new(&Store::default(), ty.clone(), Val::AnyRef(AnyRef::Null)).unwrap();
-    assert!(t.grow(0, Val::AnyRef(AnyRef::Null)).is_ok());
-    assert!(t.grow(1, Val::AnyRef(AnyRef::Null)).is_err());
+    let t = Table::new(
+        &Store::default(),
+        ty.clone(),
+        Val::ExternRef(ExternRef::Null),
+    )
+    .unwrap();
+    assert!(t.grow(0, Val::ExternRef(ExternRef::Null)).is_ok());
+    assert!(t.grow(1, Val::ExternRef(ExternRef::Null)).is_err());
     assert_eq!(t.size(), 1);
 
     // grow wrong type
     let ty = TableType::new(ValType::FuncRef, Limits::new(1, Some(2)));
-    let t = Table::new(&Store::default(), ty.clone(), Val::AnyRef(AnyRef::Null)).unwrap();
+    let t = Table::new(
+        &Store::default(),
+        ty.clone(),
+        Val::ExternRef(ExternRef::Null),
+    )
+    .unwrap();
     assert!(t.grow(1, Val::I32(0)).is_err());
     assert_eq!(t.size(), 1);
 }
@@ -68,7 +88,7 @@ fn cross_store() -> anyhow::Result<()> {
     let ty = MemoryType::new(Limits::new(1, None));
     let memory = Memory::new(&store2, ty);
     let ty = TableType::new(ValType::FuncRef, Limits::new(1, None));
-    let table = Table::new(&store2, ty, Val::AnyRef(AnyRef::Null))?;
+    let table = Table::new(&store2, ty, Val::ExternRef(ExternRef::Null))?;
 
     let need_func = Module::new(&store1, r#"(module (import "" "" (func)))"#)?;
     assert!(Instance::new(&need_func, &[func.into()]).is_err());
@@ -105,7 +125,7 @@ fn cross_store() -> anyhow::Result<()> {
 
     // ============ Cross-store funcs ==============
 
-    // TODO: need to actually fill this out once we support anyref params/locals
+    // TODO: need to actually fill this out once we support externref params/locals
     // let module = Module::new(&store1, r#"(module (func (export "a") (param funcref)))"#)?;
 
     Ok(())
diff --git a/tests/all/linker.rs b/tests/all/linker.rs
index efca28526..b84d7e9c1 100644
--- a/tests/all/linker.rs
+++ b/tests/all/linker.rs
@@ -56,11 +56,11 @@ fn link_twice_bad() -> Result<()> {
 
     // tables
     let ty = TableType::new(ValType::FuncRef, Limits::new(1, None));
-    let table = Table::new(&store, ty, Val::AnyRef(AnyRef::Null))?;
+    let table = Table::new(&store, ty, Val::ExternRef(ExternRef::Null))?;
     linker.define("", "", table.clone())?;
     assert!(linker.define("", "", table.clone()).is_err());
     let ty = TableType::new(ValType::FuncRef, Limits::new(2, None));
-    let table = Table::new(&store, ty, Val::AnyRef(AnyRef::Null))?;
+    let table = Table::new(&store, ty, Val::ExternRef(ExternRef::Null))?;
     assert!(linker.define("", "", table.clone()).is_err());
     Ok(())
 }
diff --git a/tests/all/table.rs b/tests/all/table.rs
index 8408cd905..f7599e87c 100644
--- a/tests/all/table.rs
+++ b/tests/all/table.rs
@@ -4,9 +4,9 @@ use wasmtime::*;
 fn get_none() {
     let store = Store::default();
     let ty = TableType::new(ValType::FuncRef, Limits::new(1, None));
-    let table = Table::new(&store, ty, Val::AnyRef(AnyRef::Null)).unwrap();
+    let table = Table::new(&store, ty, Val::ExternRef(ExternRef::Null)).unwrap();
     match table.get(0) {
-        Some(Val::AnyRef(AnyRef::Null)) => {}
+        Some(Val::ExternRef(ExternRef::Null)) => {}
         _ => panic!(),
     }
     assert!(table.get(1).is_none());
diff --git a/tests/all/use_after_drop.rs b/tests/all/use_after_drop.rs
index b1f45041c..67edfc158 100644
--- a/tests/all/use_after_drop.rs
+++ b/tests/all/use_after_drop.rs
@@ -11,7 +11,7 @@ fn use_func_after_drop() -> Result<()> {
             assert_eq!(closed_over_data, "abcd");
         });
         let ty = TableType::new(ValType::FuncRef, Limits::new(1, None));
-        table = Table::new(&store, ty, Val::AnyRef(AnyRef::Null))?;
+        table = Table::new(&store, ty, Val::ExternRef(ExternRef::Null))?;
         table.set(0, func.into())?;
     }
     let func = table.get(0).unwrap().funcref().unwrap().clone();