更新libclamav库1.0.0版本

This commit is contained in:
2023-01-14 18:28:39 +08:00
parent b879ee0b2e
commit 45fe15f472
8531 changed files with 1222046 additions and 177272 deletions

View File

@@ -0,0 +1,40 @@
#![allow(unreachable_code)]
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct MyType;
#[wasm_bindgen]
pub async fn good1() { loop {} }
#[wasm_bindgen]
pub async fn good2() -> JsValue { loop {} }
#[wasm_bindgen]
pub async fn good3() -> u32 { loop {} }
#[wasm_bindgen]
pub async fn good4() -> MyType { loop {} }
#[wasm_bindgen]
pub async fn good5() -> Result<(), JsValue> { loop {} }
#[wasm_bindgen]
pub async fn good6() -> Result<JsValue, JsValue> { loop {} }
#[wasm_bindgen]
pub async fn good7() -> Result<u32, JsValue> { loop {} }
#[wasm_bindgen]
pub async fn good8() -> Result<MyType, JsValue> { loop {} }
#[wasm_bindgen]
pub async fn good9() -> Result<MyType, u32> { loop {} }
#[wasm_bindgen]
pub async fn good10() -> Result<MyType, MyType> { loop {} }
pub struct BadType;
#[wasm_bindgen]
pub async fn bad1() -> Result<(), ()> { loop {} }
#[wasm_bindgen]
pub async fn bad2() -> Result<(), BadType> { loop {} }
#[wasm_bindgen]
pub async fn bad3() -> BadType { loop {} }
#[wasm_bindgen]
pub async fn bad4() -> Result<BadType, JsValue> { loop {} }
fn main() {}

View File

@@ -0,0 +1,68 @@
error[E0277]: the trait bound `Result<(), ()>: IntoJsResult` is not satisfied
--> ui-tests/async-errors.rs:30:1
|
30 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), ()>`
|
= help: the following implementations were found:
<Result<(), E> as IntoJsResult>
<Result<T, E> as IntoJsResult>
note: required by `into_js_result`
--> $WORKSPACE/src/lib.rs
|
| fn into_js_result(self) -> Result<JsValue, JsValue>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Result<(), BadType>: IntoJsResult` is not satisfied
--> ui-tests/async-errors.rs:32:1
|
32 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), BadType>`
|
= help: the following implementations were found:
<Result<(), E> as IntoJsResult>
<Result<T, E> as IntoJsResult>
note: required by `into_js_result`
--> $WORKSPACE/src/lib.rs
|
| fn into_js_result(self) -> Result<JsValue, JsValue>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `wasm_bindgen::JsValue: From<BadType>` is not satisfied
--> ui-tests/async-errors.rs:34:1
|
34 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^ the trait `From<BadType>` is not implemented for `wasm_bindgen::JsValue`
|
= help: the following implementations were found:
<wasm_bindgen::JsValue as From<&'a String>>
<wasm_bindgen::JsValue as From<&'a T>>
<wasm_bindgen::JsValue as From<&'a str>>
<wasm_bindgen::JsValue as From<JsError>>
and 73 others
= note: required because of the requirements on the impl of `Into<wasm_bindgen::JsValue>` for `BadType`
= note: required because of the requirements on the impl of `IntoJsResult` for `BadType`
note: required by `into_js_result`
--> $WORKSPACE/src/lib.rs
|
| fn into_js_result(self) -> Result<JsValue, JsValue>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Result<BadType, wasm_bindgen::JsValue>: IntoJsResult` is not satisfied
--> ui-tests/async-errors.rs:36:1
|
36 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<BadType, wasm_bindgen::JsValue>`
|
= help: the following implementations were found:
<Result<(), E> as IntoJsResult>
<Result<T, E> as IntoJsResult>
note: required by `into_js_result`
--> $WORKSPACE/src/lib.rs
|
| fn into_js_result(self) -> Result<JsValue, JsValue>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,6 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen(nonsense)]
pub fn foo() {}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: unknown attribute
--> $DIR/attribute-fails-to-parse.rs:3:16
|
3 | #[wasm_bindgen(nonsense)]
| ^^^^^^^^

View File

@@ -0,0 +1,13 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn foo() -> &u32 {}
#[wasm_bindgen]
extern "C" {
fn foo(Foo(x): Foo);
fn foo() -> &u32;
}
fn main() {}

View File

@@ -0,0 +1,17 @@
error: cannot return a borrowed ref with #[wasm_bindgen]
--> $DIR/bad-signatures.rs:4:17
|
4 | pub fn foo() -> &u32 {}
| ^^^^
error: unsupported pattern in #[wasm_bindgen] imported function
--> $DIR/bad-signatures.rs:8:12
|
8 | fn foo(Foo(x): Foo);
| ^^^^^^
error: cannot return references in #[wasm_bindgen] imports yet
--> $DIR/bad-signatures.rs:10:17
|
10 | fn foo() -> &u32;
| ^^^^

View File

@@ -0,0 +1,13 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "./foo.js")]
extern {
fn wut();
}
#[wasm_bindgen(module = "../foo.js")]
extern {
fn wut2();
}
fn main() {}

View File

@@ -0,0 +1,11 @@
error: relative module paths aren't supported yet
--> $DIR/import-local.rs:3:25
|
3 | #[wasm_bindgen(module = "./foo.js")]
| ^^^^^^^^^^
error: relative module paths aren't supported yet
--> $DIR/import-local.rs:8:25
|
8 | #[wasm_bindgen(module = "../foo.js")]
| ^^^^^^^^^^^

View File

@@ -0,0 +1,15 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen(x)]
pub fn foo() {}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(y)]
fn bar();
#[wasm_bindgen { }]
fn bar();
}
fn main() {}

View File

@@ -0,0 +1,17 @@
error: unknown attribute
--> $DIR/invalid-attr.rs:3:16
|
3 | #[wasm_bindgen(x)]
| ^
error: unknown attribute
--> $DIR/invalid-attr.rs:8:20
|
8 | #[wasm_bindgen(y)]
| ^
error: malformed #[wasm_bindgen] attribute
--> $DIR/invalid-attr.rs:11:5
|
11 | #[wasm_bindgen { }]
| ^^^^^^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,21 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
enum A {}
#[wasm_bindgen]
pub enum B {
D(u32),
}
#[wasm_bindgen]
pub enum C {
X = 1 + 3,
}
#[wasm_bindgen]
pub enum D {
X = 4294967296,
}
fn main() {}

View File

@@ -0,0 +1,23 @@
error: cannot export empty enums to JS
--> $DIR/invalid-enums.rs:4:1
|
4 | enum A {}
| ^^^^^^^^^
error: only C-Style enums allowed with #[wasm_bindgen]
--> $DIR/invalid-enums.rs:8:6
|
8 | D(u32),
| ^^^^^
error: enums with #[wasm_bindgen] may only have number literal values
--> $DIR/invalid-enums.rs:13:9
|
13 | X = 1 + 3,
| ^^^^^
error: enums with #[wasm_bindgen] can only support numbers that can be represented as u32
--> $DIR/invalid-enums.rs:18:9
|
18 | X = 4294967296,
| ^^^^^^^^^^

View File

@@ -0,0 +1,41 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
type A;
fn f() -> &'static u32;
#[wasm_bindgen(method)]
fn f1();
#[wasm_bindgen(method)]
fn f2(x: u32);
#[wasm_bindgen(method)]
fn f3(x: &&u32);
#[wasm_bindgen(method)]
fn f4(x: &foo::Bar);
#[wasm_bindgen(method)]
fn f4(x: &::Bar);
#[wasm_bindgen(method)]
fn f4(x: &Bar<T>);
#[wasm_bindgen(method)]
fn f4(x: &Fn(T));
#[wasm_bindgen(constructor)]
fn f();
#[wasm_bindgen(constructor)]
fn f() -> ::Bar;
#[wasm_bindgen(constructor)]
fn f() -> &Bar;
#[wasm_bindgen(catch)]
fn f() -> u32;
#[wasm_bindgen(catch)]
fn f() -> &u32;
#[wasm_bindgen(catch)]
fn f() -> Result<>;
#[wasm_bindgen(catch)]
fn f() -> Result<'a>;
}
fn main() {}

View File

@@ -0,0 +1,71 @@
error: it is currently not sound to use lifetimes in function signatures
--> $DIR/invalid-imports.rs:7:16
|
7 | fn f() -> &'static u32;
| ^^^^^^^
error: imported methods must have at least one argument
--> $DIR/invalid-imports.rs:10:5
|
10 | fn f1();
| ^^^^^^^^
error: first argument of method must be a shared reference
--> $DIR/invalid-imports.rs:12:14
|
12 | fn f2(x: u32);
| ^^^
error: first argument of method must be a path
--> $DIR/invalid-imports.rs:14:14
|
14 | fn f3(x: &&u32);
| ^^^^^
error: paths with type parameters are not supported yet
--> $DIR/invalid-imports.rs:20:15
|
20 | fn f4(x: &Bar<T>);
| ^^^^^^
error: paths with type parameters are not supported yet
--> $DIR/invalid-imports.rs:22:15
|
22 | fn f4(x: &Fn(T));
| ^^^^^
error: constructor returns must be bare types
--> $DIR/invalid-imports.rs:25:5
|
25 | fn f();
| ^^^^^^^
error: return value of constructor must be a bare path
--> $DIR/invalid-imports.rs:29:5
|
29 | fn f() -> &Bar;
| ^^^^^^^^^^^^^^^
error: must be Result<...>
--> $DIR/invalid-imports.rs:32:15
|
32 | fn f() -> u32;
| ^^^
error: must be Result<...>
--> $DIR/invalid-imports.rs:34:15
|
34 | fn f() -> &u32;
| ^^^^
error: must have at least one generic parameter
--> $DIR/invalid-imports.rs:36:15
|
36 | fn f() -> Result<>;
| ^^^^^^^^
error: it is currently not sound to use lifetimes in function signatures
--> $DIR/invalid-imports.rs:38:22
|
38 | fn f() -> Result<'a>;
| ^^

View File

@@ -0,0 +1,33 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
fn foo() {}
#[wasm_bindgen]
pub const fn foo2() {}
#[wasm_bindgen]
struct Foo<T>(T);
#[wasm_bindgen]
extern "C" {
static mut FOO: u32;
pub fn foo3(x: i32, ...);
}
#[wasm_bindgen]
extern "system" {
}
#[wasm_bindgen]
pub fn foo4<T>() {}
#[wasm_bindgen]
pub fn foo5<'a>() {}
#[wasm_bindgen]
pub fn foo6<'a, T>() {}
#[wasm_bindgen]
trait X {}
fn main() {}

View File

@@ -0,0 +1,59 @@
error: can only #[wasm_bindgen] public functions
--> $DIR/invalid-items.rs:4:1
|
4 | fn foo() {}
| ^^^^^^^^^^^
error: can only #[wasm_bindgen] non-const functions
--> $DIR/invalid-items.rs:7:5
|
7 | pub const fn foo2() {}
| ^^^^^
error: structs with #[wasm_bindgen] cannot have lifetime or type parameters currently
--> $DIR/invalid-items.rs:10:11
|
10 | struct Foo<T>(T);
| ^^^
error: cannot import mutable globals yet
--> $DIR/invalid-items.rs:14:12
|
14 | static mut FOO: u32;
| ^^^
error: can't #[wasm_bindgen] variadic functions
--> $DIR/invalid-items.rs:16:25
|
16 | pub fn foo3(x: i32, ...);
| ^^^
error: only foreign mods with the `C` ABI are allowed
--> $DIR/invalid-items.rs:20:8
|
20 | extern "system" {
| ^^^^^^^^
error: can't #[wasm_bindgen] functions with lifetime or type parameters
--> $DIR/invalid-items.rs:24:12
|
24 | pub fn foo4<T>() {}
| ^^^
error: can't #[wasm_bindgen] functions with lifetime or type parameters
--> $DIR/invalid-items.rs:26:12
|
26 | pub fn foo5<'a>() {}
| ^^^^
error: can't #[wasm_bindgen] functions with lifetime or type parameters
--> $DIR/invalid-items.rs:28:12
|
28 | pub fn foo6<'a, T>() {}
| ^^^^^^^
error: #[wasm_bindgen] can only be applied to a function, struct, enum, impl, or extern block
--> $DIR/invalid-items.rs:31:1
|
31 | trait X {}
| ^^^^^^^^^^

View File

@@ -0,0 +1,42 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct A;
#[wasm_bindgen]
default impl A {
}
#[wasm_bindgen]
unsafe impl A {
}
#[wasm_bindgen]
impl Clone for A {
}
#[wasm_bindgen]
impl<T> A {
}
#[wasm_bindgen]
impl &'static A {
}
macro_rules! x { () => () }
#[wasm_bindgen]
impl A {
const X: u32 = 3;
type Y = u32;
x!();
// pub default fn foo() {} // TODO: compiler's pretty printer totally broken
}
#[wasm_bindgen]
impl A {
pub const fn foo() {}
}
fn main() {}

View File

@@ -0,0 +1,61 @@
error: #[wasm_bindgen] default impls are not supported
--> $DIR/invalid-methods.rs:7:1
|
7 | default impl A {
| ^^^^^^^
error: #[wasm_bindgen] unsafe impls are not supported
--> $DIR/invalid-methods.rs:11:1
|
11 | unsafe impl A {
| ^^^^^^
error: #[wasm_bindgen] trait impls are not supported
--> $DIR/invalid-methods.rs:15:6
|
15 | impl Clone for A {
| ^^^^^
error: #[wasm_bindgen] generic impls aren't supported
--> $DIR/invalid-methods.rs:19:5
|
19 | impl<T> A {
| ^^^
error: unsupported self type in #[wasm_bindgen] impl
--> $DIR/invalid-methods.rs:23:6
|
23 | impl &'static A {
| ^^^^^^^^^^
error: const definitions aren't supported with #[wasm_bindgen]
--> $DIR/invalid-methods.rs:30:5
|
30 | const X: u32 = 3;
| ^^^^^^^^^^^^^^^^^
error: type definitions in impls aren't supported with #[wasm_bindgen]
--> $DIR/invalid-methods.rs:31:5
|
31 | type Y = u32;
| ^^^^^^^^^^^^^
error: macros in impls aren't supported
--> $DIR/invalid-methods.rs:32:5
|
32 | x!();
| ^^^^^
error: can only #[wasm_bindgen] non-const functions
--> $DIR/invalid-methods.rs:39:9
|
39 | pub const fn foo() {}
| ^^^^^
warning: unused macro definition
--> $DIR/invalid-methods.rs:26:1
|
26 | macro_rules! x { () => () }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_macros)]` on by default

View File

@@ -0,0 +1,18 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
type A;
#[wasm_bindgen(setter, method)]
fn a(this: &A, b: i32);
#[wasm_bindgen(setter = x, method)]
fn b(this: &A, b: i32);
#[wasm_bindgen(setter, method, js_name = x)]
fn c(this: &A, b: i32);
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: setters must start with `set_`, found: a
--> $DIR/invalid-setter.rs:9:8
|
9 | fn a(this: &A, b: i32);
| ^

View File

@@ -0,0 +1,9 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen]
pub fn foo() -> Result<JsValue, JsValue>;
}
fn main() {}

View File

@@ -0,0 +1,17 @@
error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: FromWasmAbi` is not satisfied
--> $DIR/missing-catch.rs:6:9
|
6 | pub fn foo() -> Result<JsValue, JsValue>;
| ^^^ the trait `FromWasmAbi` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>`
|
note: required by a bound in `FromWasmAbi`
--> $DIR/traits.rs:23:1
|
23 | / pub trait FromWasmAbi: WasmDescribe {
24 | | /// The wasm ABI type that this converts from when coming back out from the
25 | | /// ABI boundary.
26 | | type Abi: WasmAbi;
... |
35 | | unsafe fn from_abi(js: Self::Abi) -> Self;
36 | | }
| |_^ required by this bound in `FromWasmAbi`

View File

@@ -0,0 +1,6 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
fn foo() {}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: can only #[wasm_bindgen] public functions
--> $DIR/non-public-function.rs:4:1
|
4 | fn foo() {}
| ^^^^^^^^^^^

View File

@@ -0,0 +1,8 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct A {
pub field: String,
}
fn main() {}

View File

@@ -0,0 +1,12 @@
error[E0277]: the trait bound `String: std::marker::Copy` is not satisfied
--> $DIR/pub-not-copy.rs:5:16
|
5 | pub field: String,
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `String`
|
note: required by a bound in `assert_copy`
--> $DIR/pub-not-copy.rs:3:1
|
3 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^ required by this bound in `assert_copy`
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,33 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
pub fn foo() {}
#[wasm_bindgen(start)]
pub fn foo2(x: u32) {}
#[wasm_bindgen(start)]
pub fn foo3<T>() {}
#[wasm_bindgen(start)]
pub fn foo4() -> Result<(), JsValue> { Ok(()) }
#[wasm_bindgen(start)]
pub fn foo5() -> Result<JsValue, ()> { Err(()) }
#[wasm_bindgen(start)]
pub fn foo6() -> Result<JsValue, JsValue> { Ok(JsValue::from(1u32)) }
#[wasm_bindgen(start)]
pub async fn foo_async1() {}
#[wasm_bindgen(start)]
pub async fn foo_async2() -> Result<(), JsValue> { Ok(()) }
#[wasm_bindgen(start)]
pub async fn foo_async3() -> Result<JsValue, ()> { Err(()) }
#[wasm_bindgen(start)]
pub async fn foo_async4() -> Result<JsValue, JsValue> { Ok(JsValue::from(1u32)) }
fn main() {}

View File

@@ -0,0 +1,71 @@
error: the start function cannot have arguments
--> ui-tests/start-function.rs:7:13
|
7 | pub fn foo2(x: u32) {}
| ^^^^^^
error: the start function cannot have generics
--> ui-tests/start-function.rs:10:12
|
10 | pub fn foo3<T>() {}
| ^^^
error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, ()>: wasm_bindgen::__rt::Start` is not satisfied
--> ui-tests/start-function.rs:15:1
|
15 | #[wasm_bindgen(start)]
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result<wasm_bindgen::JsValue, ()>`
|
= help: the following implementations were found:
<Result<(), E> as wasm_bindgen::__rt::Start>
note: required by `start`
--> $WORKSPACE/src/lib.rs
|
| fn start(self);
| ^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: wasm_bindgen::__rt::Start` is not satisfied
--> ui-tests/start-function.rs:18:1
|
18 | #[wasm_bindgen(start)]
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>`
|
= help: the following implementations were found:
<Result<(), E> as wasm_bindgen::__rt::Start>
note: required by `start`
--> $WORKSPACE/src/lib.rs
|
| fn start(self);
| ^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, ()>: wasm_bindgen::__rt::Start` is not satisfied
--> ui-tests/start-function.rs:27:1
|
27 | #[wasm_bindgen(start)]
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result<wasm_bindgen::JsValue, ()>`
|
= help: the following implementations were found:
<Result<(), E> as wasm_bindgen::__rt::Start>
note: required by `start`
--> $WORKSPACE/src/lib.rs
|
| fn start(self);
| ^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: wasm_bindgen::__rt::Start` is not satisfied
--> ui-tests/start-function.rs:30:1
|
30 | #[wasm_bindgen(start)]
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>`
|
= help: the following implementations were found:
<Result<(), E> as wasm_bindgen::__rt::Start>
note: required by `start`
--> $WORKSPACE/src/lib.rs
|
| fn start(self);
| ^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,11 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
type Foo;
#[wasm_bindgen(method, structural, final)]
fn bar(this: &Foo);
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: cannot specify both `structural` and `final`
--> $DIR/structural-and-final.rs:7:40
|
7 | #[wasm_bindgen(method, structural, final)]
| ^^^^^

View File

@@ -0,0 +1,11 @@
use wasm_bindgen::prelude::*;
struct A;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen]
pub fn foo(a: A);
}
fn main() {}

View File

@@ -0,0 +1,18 @@
error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied
--> $DIR/traits-not-implemented.rs:5:1
|
5 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^ the trait `IntoWasmAbi` is not implemented for `A`
|
note: required by a bound in `IntoWasmAbi`
--> $DIR/traits.rs:9:1
|
9 | / pub trait IntoWasmAbi: WasmDescribe {
10 | | /// The wasm ABI type that this converts into when crossing the ABI
11 | | /// boundary.
12 | | type Abi: WasmAbi;
... |
16 | | fn into_abi(self) -> Self::Abi;
17 | | }
| |_^ required by this bound in `IntoWasmAbi`
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,10 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen]
pub fn foo(a: A);
}
fn main() {}

View File

@@ -0,0 +1,7 @@
error[E0412]: cannot find type `A` in this scope
--> $DIR/unknown-type-in-import.rs:6:19
|
6 | pub fn foo(a: A);
| - ^ not found in this scope
| |
| help: you might be missing a type parameter: `<A>`

View File

@@ -0,0 +1,32 @@
#![deny(unused_variables)]
use wasm_bindgen::prelude::*;
struct A {}
#[wasm_bindgen]
impl A {
#[wasm_bindgen(method)]
pub fn foo() {}
}
#[wasm_bindgen]
pub struct MyStruct {
hello: String,
}
#[wasm_bindgen(getter, typescript_custom_section)]
pub const FOO: &'static str = "FOO";
#[wasm_bindgen(readonly)]
pub fn bar() {}
#[wasm_bindgen(getter_with_clone, final)]
impl MyStruct {
#[wasm_bindgen(getter, typescript_type = "Thing[]")]
pub fn hello(&self) -> String {
self.hello.clone()
}
}
fn main() {}

View File

@@ -0,0 +1,41 @@
error: unused variable: `method`
--> ui-tests/unused-attributes.rs:9:20
|
9 | #[wasm_bindgen(method)]
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_method`
|
note: the lint level is defined here
--> ui-tests/unused-attributes.rs:1:9
|
1 | #![deny(unused_variables)]
| ^^^^^^^^^^^^^^^^
error: unused variable: `getter`
--> ui-tests/unused-attributes.rs:18:16
|
18 | #[wasm_bindgen(getter, typescript_custom_section)]
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_getter`
error: unused variable: `readonly`
--> ui-tests/unused-attributes.rs:21:16
|
21 | #[wasm_bindgen(readonly)]
| ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_readonly`
error: unused variable: `getter_with_clone`
--> ui-tests/unused-attributes.rs:24:16
|
24 | #[wasm_bindgen(getter_with_clone, final)]
| ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_getter_with_clone`
error: unused variable: `final`
--> ui-tests/unused-attributes.rs:24:35
|
24 | #[wasm_bindgen(getter_with_clone, final)]
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_final`
error: unused variable: `typescript_type`
--> ui-tests/unused-attributes.rs:26:28
|
26 | #[wasm_bindgen(getter, typescript_type = "Thing[]")]
| ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_typescript_type`

View File

@@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
# A script to update the references for all tests. The idea is that
# you do a run, which will generate files in the build directory
# containing the (normalized) actual output of the compiler. You then
# run this script, which will copy those files over. If you find
# yourself manually editing a foo.stderr file, you're doing it wrong.
#
# See all `update-references.sh`, if you just want to update a single test.
MY_DIR=$(dirname $0)
cd $MY_DIR
find . -name '*.rs' | xargs ./update-references.sh

View File

@@ -0,0 +1,42 @@
#!/bin/bash
#
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
# A script to update the references for particular tests. The idea is
# that you do a run, which will generate files in the build directory
# containing the (normalized) actual output of the compiler. This
# script will then copy that output and replace the "expected output"
# files. You can then commit the changes.
#
# If you find yourself manually editing a foo.stderr file, you're
# doing it wrong.
MYDIR=$(dirname $0)
BUILD_DIR="../../../target/tests/ui"
while [[ "$1" != "" ]]; do
STDERR_NAME="${1/%.rs/.stderr}"
STDOUT_NAME="${1/%.rs/.stdout}"
shift
if [ -f $BUILD_DIR/$STDOUT_NAME ] && \
! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then
echo updating $MYDIR/$STDOUT_NAME
cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME
fi
if [ -f $BUILD_DIR/$STDERR_NAME ] && \
! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then
echo updating $MYDIR/$STDERR_NAME
cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME
fi
done