mirror of
https://github.com/tlsnotary/wasm-bindgen.git
synced 2026-01-09 15:08:01 -05:00
@@ -21,11 +21,6 @@
|
||||
* Allow overriding the URL used for headless tests by setting `WASM_BINDGEN_TEST_ADDRESS`.
|
||||
[#3861](https://github.com/rustwasm/wasm-bindgen/pull/3861)
|
||||
|
||||
### Changed
|
||||
|
||||
* Allow using `'static` lifetimes in functions marked with `#[wasm_bindgen]`. This does not allow references where they were not allowed before!
|
||||
[#3856](https://github.com/rustwasm/wasm-bindgen/pull/3856)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Make .wasm output deterministic when using `--reference-types`.
|
||||
|
||||
@@ -1652,14 +1652,12 @@ fn assert_no_lifetimes(sig: &syn::Signature) -> Result<(), Diagnostic> {
|
||||
}
|
||||
|
||||
impl<'ast> syn::visit::Visit<'ast> for Walk {
|
||||
fn visit_lifetime(&mut self, lifetime: &'ast syn::Lifetime) {
|
||||
if lifetime.ident != "static" {
|
||||
self.diagnostics.push(err_span!(
|
||||
lifetime,
|
||||
"it is currently not sound to use lifetimes in function \
|
||||
fn visit_lifetime(&mut self, i: &'ast syn::Lifetime) {
|
||||
self.diagnostics.push(err_span!(
|
||||
i,
|
||||
"it is currently not sound to use lifetimes in function \
|
||||
signatures"
|
||||
));
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
let mut walk = Walk {
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
type A;
|
||||
|
||||
#[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: &dyn 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>;
|
||||
#[wasm_bindgen(catch)]
|
||||
fn f() -> Result<&'static u32>;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -1,65 +0,0 @@
|
||||
error: imported methods must have at least one argument
|
||||
--> ui-tests/invalid-imports-1.rs:8:5
|
||||
|
|
||||
8 | fn f1();
|
||||
| ^^^^^^^^
|
||||
|
||||
error: first argument of method must be a shared reference
|
||||
--> ui-tests/invalid-imports-1.rs:10:14
|
||||
|
|
||||
10 | fn f2(x: u32);
|
||||
| ^^^
|
||||
|
||||
error: first argument of method must be a path
|
||||
--> ui-tests/invalid-imports-1.rs:12:15
|
||||
|
|
||||
12 | fn f3(x: &&u32);
|
||||
| ^^^^
|
||||
|
||||
error: paths with type parameters are not supported yet
|
||||
--> ui-tests/invalid-imports-1.rs:18:15
|
||||
|
|
||||
18 | fn f4(x: &Bar<T>);
|
||||
| ^^^^^^
|
||||
|
||||
error: first argument of method must be a path
|
||||
--> ui-tests/invalid-imports-1.rs:20:15
|
||||
|
|
||||
20 | fn f4(x: &dyn Fn(T));
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: constructor returns must be bare types
|
||||
--> ui-tests/invalid-imports-1.rs:23:5
|
||||
|
|
||||
23 | fn f();
|
||||
| ^^^^^^^
|
||||
|
||||
error: return value of constructor must be a bare path
|
||||
--> ui-tests/invalid-imports-1.rs:27:5
|
||||
|
|
||||
27 | fn f() -> &Bar;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: must be Result<...>
|
||||
--> ui-tests/invalid-imports-1.rs:30:15
|
||||
|
|
||||
30 | fn f() -> u32;
|
||||
| ^^^
|
||||
|
||||
error: must be Result<...>
|
||||
--> ui-tests/invalid-imports-1.rs:32:15
|
||||
|
|
||||
32 | fn f() -> &u32;
|
||||
| ^^^^
|
||||
|
||||
error: must have at least one generic parameter
|
||||
--> ui-tests/invalid-imports-1.rs:34:15
|
||||
|
|
||||
34 | fn f() -> Result<>;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: it is currently not sound to use lifetimes in function signatures
|
||||
--> ui-tests/invalid-imports-1.rs:36:22
|
||||
|
|
||||
36 | fn f() -> Result<'a>;
|
||||
| ^^
|
||||
@@ -1,8 +0,0 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
fn f() -> &'static u32;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -1,5 +0,0 @@
|
||||
error: cannot return references in #[wasm_bindgen] imports yet
|
||||
--> ui-tests/invalid-imports-2.rs:5:15
|
||||
|
|
||||
5 | fn f() -> &'static u32;
|
||||
| ^^^^^^^^^^^^
|
||||
@@ -36,8 +36,6 @@ extern "C" {
|
||||
fn f() -> Result<>;
|
||||
#[wasm_bindgen(catch)]
|
||||
fn f() -> Result<'a>;
|
||||
#[wasm_bindgen(catch)]
|
||||
fn f() -> Result<&'static u32>;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
error: it is currently not sound to use lifetimes in function signatures
|
||||
--> ui-tests/invalid-imports.rs:7:16
|
||||
|
|
||||
7 | fn f() -> &'static u32;
|
||||
| ^^^^^^^
|
||||
|
||||
error: imported methods must have at least one argument
|
||||
--> ui-tests/invalid-imports.rs:10:5
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user