Skip to content

Fix Rust edition 2024 compatibility #4259

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

Merged
merged 1 commit into from
Nov 9, 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
4 changes: 2 additions & 2 deletions crates/backend/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1894,9 +1894,9 @@ fn respan(input: TokenStream, span: &dyn ToTokens) -> TokenStream {

for (i, token) in spans.into_iter().enumerate() {
if i == 0 {
first_span = token.span();
first_span = Span::call_site().located_at(token.span());
}
last_span = token.span();
last_span = Span::call_site().located_at(token.span());
}

let mut new_tokens = Vec::new();
Expand Down
4 changes: 4 additions & 0 deletions crates/macro/ui-tests/missing-catch.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: FromWasmAbi` is not satisfied
--> ui-tests/missing-catch.rs:6:9
|
3 | #[wasm_bindgen]
| --------------- in this procedural macro expansion
...
6 | pub fn foo() -> Result<JsValue, JsValue>;
| ^^^ the trait `FromWasmAbi` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>`
|
Expand All @@ -14,3 +17,4 @@ error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsVal
i64
usize
and $N others
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
3 changes: 3 additions & 0 deletions crates/macro/ui-tests/pub-not-copy.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
error[E0277]: the trait bound `String: std::marker::Copy` is not satisfied
--> $DIR/pub-not-copy.rs:5:16
|
3 | #[wasm_bindgen]
| --------------- in this procedural macro expansion
4 | pub struct A {
5 | pub field: String,
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `String`
|
Expand Down
3 changes: 3 additions & 0 deletions crates/macro/ui-tests/struct-fields.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
error[E0277]: the trait bound `Foo: std::marker::Copy` is not satisfied
--> ui-tests/struct-fields.rs:10:12
|
8 | #[wasm_bindgen]
| --------------- in this procedural macro expansion
9 | struct Bar {
10 | pub a: Foo,
| ^^^ the trait `std::marker::Copy` is not implemented for `Foo`
|
Expand Down
6 changes: 6 additions & 0 deletions crates/macro/ui-tests/unknown-type-in-import.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ help: you might be missing a type parameter
|
6 | pub fn foo<A>(a: A);
| +++

error[E0412]: cannot find type `A` in this scope
--> ui-tests/unknown-type-in-import.rs:6:19
|
6 | pub fn foo(a: A);
| ^ not found in this scope