Skip to content
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

Revert "Allow using 'static lifetimes in functions (#3856)" #3865

Merged
merged 1 commit into from
Mar 2, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
* Add support for `Option<*const T>`, `Option<*mut T>` and `NonNull<T>`.
[#3852](https://github.com/rustwasm/wasm-bindgen/pull/3852)

### 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`.
Expand Down
12 changes: 5 additions & 7 deletions crates/macro-support/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
41 changes: 0 additions & 41 deletions crates/macro/ui-tests/invalid-imports-1.rs

This file was deleted.

65 changes: 0 additions & 65 deletions crates/macro/ui-tests/invalid-imports-1.stderr

This file was deleted.

8 changes: 0 additions & 8 deletions crates/macro/ui-tests/invalid-imports-2.rs

This file was deleted.

5 changes: 0 additions & 5 deletions crates/macro/ui-tests/invalid-imports-2.stderr

This file was deleted.

2 changes: 0 additions & 2 deletions crates/macro/ui-tests/invalid-imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
6 changes: 6 additions & 0 deletions crates/macro/ui-tests/invalid-imports.stderr
Original file line number Diff line number Diff line change
@@ -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
|
Expand Down