mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-28 04:22:38 +03:00
bdec2582aa
* Make ConvertToAst trait fallible It's got some panics, and we'll be switching those to errors! * First example of a diagnostic-driven error Add a diagnostic-driven error `#[wasm_bindgen]` being attached to public functions, and add some macros to boot to make it easier to generate errors! * Result-ify `src/parser.rs` This commit converts all of `src/parser.rs` away from panics to using `Diagnostic` instead. Along the way this adds a test case per changed `panic!`, ensuring that we don't regress in these areas!
39 lines
502 B
Rust
39 lines
502 B
Rust
#![feature(use_extern_macros)]
|
|
|
|
extern crate wasm_bindgen;
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
#[wasm_bindgen]
|
|
fn foo() {}
|
|
|
|
#[wasm_bindgen]
|
|
pub unsafe fn foo1() {}
|
|
|
|
#[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 {}
|