Skip to content

Use conventional meta-item syntax for attributes #2875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 8 additions & 8 deletions benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ use web_sys::Node;

#[wasm_bindgen(raw_module = "../globals.js")]
extern "C" {
#[wasm_bindgen(js_name = jsthunk)]
#[wasm_bindgen(js_name = "jsthunk")]
fn js_thunk();
#[wasm_bindgen(js_name = add)]
#[wasm_bindgen(js_name = "add")]
fn js_add(a: i32, b: i32) -> i32;

pub type Foo;
#[wasm_bindgen(method, final, js_name = bar)]
#[wasm_bindgen(method, final, js_name = "bar")]
fn bar_final(this: &Foo);
#[wasm_bindgen(method, structural, js_name = bar)]
#[wasm_bindgen(method, structural, js_name = "bar")]
fn bar_structural(this: &Foo);

#[wasm_bindgen(js_name = jsthunk)]
#[wasm_bindgen(js_name = "jsthunk")]
fn doesnt_throw();
#[wasm_bindgen(catch, js_name = jsthunk)]
#[wasm_bindgen(catch, js_name = "jsthunk")]
fn doesnt_throw_catch() -> Result<(), JsValue>;
}

Expand Down Expand Up @@ -102,9 +102,9 @@ pub fn call_doesnt_throw_with_catch_n_times(n: usize) {
extern "C" {
pub type Element;

#[wasm_bindgen(method, js_name = firstChild, final, getter)]
#[wasm_bindgen(method, js_name = "firstChild", final, getter)]
fn first_child_final(this: &Element) -> Element;
#[wasm_bindgen(method, js_name = firstChild, structural, getter)]
#[wasm_bindgen(method, js_name = "firstChild", structural, getter)]
fn first_child_structural(this: &Element) -> Element;
}

Expand Down
1 change: 1 addition & 0 deletions crates/backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extra-traits = ["syn/extra-traits"]

[dependencies]
bumpalo = "3.0.0"
darling = "0.14.1"
lazy_static = "1.0.2"
log = "0.4"
proc-macro2 = "1.0"
Expand Down
6 changes: 6 additions & 0 deletions crates/backend/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ impl From<Error> for Diagnostic {
}
}

impl From<darling::Error> for Diagnostic {
fn from(err: darling::Error) -> Self {
Self::from(Error::from(err))
}
}

fn extract_spans(node: &dyn ToTokens) -> Option<(Span, Span)> {
let mut t = TokenStream::new();
node.to_tokens(&mut t);
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/tests/wasm-bindgen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ fn namespace_global_and_noglobal_works() {
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "fs")]
extern "C" {
#[wasm_bindgen(js_namespace = window)]
#[wasm_bindgen(js_namespace = "window")]
fn t1();
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = window)]
#[wasm_bindgen(js_namespace = "window")]
fn t2();
}
#[wasm_bindgen]
Expand Down Expand Up @@ -189,7 +189,7 @@ fn bin_crate_works() {
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = console)]
#[wasm_bindgen(js_namespace = "console")]
fn log(data: &str);
}

Expand Down
6 changes: 3 additions & 3 deletions crates/futures/src/task/multithread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ fn wait_async(ptr: &AtomicI32, current_value: i32) -> Option<js_sys::Promise> {
type Atomics;
type WaitAsyncResult;

#[wasm_bindgen(static_method_of = Atomics, js_name = waitAsync)]
#[wasm_bindgen(static_method_of = "Atomics", js_name = "waitAsync")]
fn wait_async(buf: &js_sys::Int32Array, index: i32, value: i32) -> WaitAsyncResult;

#[wasm_bindgen(static_method_of = Atomics, js_name = waitAsync, getter)]
#[wasm_bindgen(static_method_of = "Atomics", js_name = "waitAsync", getter)]
fn get_wait_async() -> JsValue;

#[wasm_bindgen(method, getter, structural, js_name = async)]
#[wasm_bindgen(method, getter, structural, js_name = "async")]
fn async_(this: &WaitAsyncResult) -> bool;

#[wasm_bindgen(method, getter, structural)]
Expand Down
200 changes: 100 additions & 100 deletions crates/js-sys/src/Temporal.rs

Large diffs are not rendered by default.

Loading