File: linking-errors.wast

package info (click to toggle)
rust-wasmtime 28.0.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 54,116 kB
  • sloc: ansic: 4,071; sh: 567; javascript: 548; cpp: 280; asm: 175; ml: 96; makefile: 55
file content (54 lines) | stat: -rw-r--r-- 1,788 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;;! reference_types = true

(module $m
  (global (export "g i32") i32 (i32.const 0))
  (global (export "g mut i32") (mut i32)  (i32.const 0))

  (table (export "t funcref") 0 funcref)
  (table (export "t externref") 0 externref)
  (memory (export "mem") 0)

  (func (export "f"))
  (func (export "f p1r2") (param f32) (result i32 i64) unreachable)
)

;; make sure the name of the import is in the message
(assert_unlinkable
  (module (import "m" "g i32" (global i64)))
  "incompatible import type for `m::g i32`")

;; errors on globals
(assert_unlinkable
  (module (import "m" "g i32" (global i64)))
  "expected global of type `i64`, found global of type `i32`")

(assert_unlinkable
  (module (import "m" "g i32" (global (mut i32))))
  "expected mutable global, found immutable global")

(assert_unlinkable
  (module (import "m" "g mut i32" (global i32)))
  "expected immutable global, found mutable global")

;; errors on tables
(assert_unlinkable
  (module (import "m" "t funcref" (table 1 funcref)))
  "expected table limits (min: 1, max: none) doesn't match provided table limits (min: 0, max: none)")

(assert_unlinkable
  (module (import "m" "t externref" (table 0 funcref)))
  "expected table of type `funcref`, found table of type `externref`")

;; errors on memories
(assert_unlinkable
  (module (import "m" "mem" (memory 1)))
  "expected memory limits (min: 1, max: none) doesn't match provided memory limits (min: 0, max: none)")

;; errors on functions
(assert_unlinkable
  (module (import "m" "f" (func (param i32))))
  "expected type `(func (param i32))`, found type `(func)`")

(assert_unlinkable
  (module (import "m" "f p1r2" (func (param i32 i32) (result f64))))
  "expected type `(func (param i32 i32) (result f64))`, found type `(func (param f32) (result i32 i64))`")