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

Make getters, setters, and constructors compiler errors for enums #4278

Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ad495c9
Make `getter`s, `setter`s, and `constructor`s compiler errors for enums
RunDevelopment Nov 18, 2024
e967962
Better error messages
RunDevelopment Nov 18, 2024
888ead1
rustfmt
RunDevelopment Nov 18, 2024
77c3696
Merge branch 'main' into error-enum-getter-setter-constructor
RunDevelopment Nov 29, 2024
f07b885
Add `rustversion` and `diagnostic` feature
RunDevelopment Nov 29, 2024
526400f
Different code gen for static asserts
RunDevelopment Nov 29, 2024
81f2d43
Use Rust 1.78.0 to run UI tests
RunDevelopment Nov 29, 2024
9342b6d
Fixed span
RunDevelopment Nov 29, 2024
0f75414
Updated other ui tests
RunDevelopment Nov 29, 2024
95715ec
Export marker traits under `::__rt::marker`
RunDevelopment Nov 29, 2024
4a83589
Merge branch 'main' into error-enum-getter-setter-constructor
RunDevelopment Dec 7, 2024
053c60e
Feature suggestions
RunDevelopment Dec 7, 2024
db953cc
Shared check struct
RunDevelopment Dec 7, 2024
ed462cc
Fixed main debug warning
RunDevelopment Dec 7, 2024
6ac1419
Terser error messages
RunDevelopment Dec 7, 2024
2802d40
Removed `extern crate rustversion`
RunDevelopment Dec 8, 2024
9355f5c
Merge branch 'main' into error-enum-getter-setter-constructor
RunDevelopment Dec 8, 2024
49f6c4d
Move `marker.rs` file under `rt`
RunDevelopment Dec 8, 2024
7512b07
Document `msrv` feature
RunDevelopment Dec 8, 2024
5e461ff
Remove useless `automatically_derived`
RunDevelopment Dec 8, 2024
bd9f847
Updated UI tests
RunDevelopment Dec 8, 2024
80ab2ef
Update changelog
RunDevelopment Dec 8, 2024
b240d26
Apply suggestions from code review
RunDevelopment Dec 8, 2024
e1d2358
Test MSRV and resolver v1 of new crate feature
daxpedda Dec 8, 2024
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
Prev Previous commit
Next Next commit
Updated other ui tests
RunDevelopment committed Nov 29, 2024
commit 0f7541476b17d4e952e61c83186c736fdfc5354c
2 changes: 1 addition & 1 deletion crates/macro/ui-tests/async-errors.stderr
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ error[E0277]: the trait bound `wasm_bindgen::JsValue: From<BadType>` is not sati
--> ui-tests/async-errors.rs:35:24
|
35 | pub async fn bad3() -> BadType { loop {} }
| ^^^^^^^ the trait `From<BadType>` is not implemented for `wasm_bindgen::JsValue`
| ^^^^^^^ the trait `From<BadType>` is not implemented for `wasm_bindgen::JsValue`, which is required by `BadType: IntoJsResult`
|
= help: the following other types implement trait `From<T>`:
<wasm_bindgen::JsValue as From<bool>>
8 changes: 8 additions & 0 deletions crates/macro/ui-tests/main-debug.stderr
Original file line number Diff line number Diff line change
@@ -3,3 +3,11 @@ error: the main function has to be called main
|
18 | fn fail() {}
| ^^^^

warning: unused variable: `f`
--> ui-tests/main-debug.rs:12:19
|
12 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
| ^ help: if this is intentional, prefix it with an underscore: `_f`
|
= note: `#[warn(unused_variables)]` on by default
17 changes: 17 additions & 0 deletions crates/macro/ui-tests/main-infallible.stderr
Original file line number Diff line number Diff line change
@@ -3,3 +3,20 @@ error: the main function has to be called main
|
10 | fn fail() {}
| ^^^^

warning: unreachable expression
--> ui-tests/main-infallible.rs:4:1
|
4 | #[wasm_bindgen(main)]
| ^^^^^^^^^^^^^^^^^^^^^
| |
| unreachable expression
| any code following this expression is unreachable
|
note: this expression has type `Infallible`, which is uninhabited
--> ui-tests/main-infallible.rs:4:1
|
4 | #[wasm_bindgen(main)]
| ^^^^^^^^^^^^^^^^^^^^^
= note: `#[warn(unreachable_code)]` on by default
= note: this warning originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
Comment on lines +6 to +22
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun. That's a bug. We should avoid emitting this warning somehow.
Not related to this PR.

35 changes: 35 additions & 0 deletions crates/macro/ui-tests/missing-catch.stderr
Original file line number Diff line number Diff line change
@@ -18,3 +18,38 @@ error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsVal
i128
and $N others
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: FromWasmAbi` is not satisfied
--> ui-tests/missing-catch.rs:3:1
|
3 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^ the trait `FromWasmAbi` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>`
|
= help: the following other types implement trait `FromWasmAbi`:
bool
char
isize
i8
i16
i32
i64
i128
and $N others
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: FromWasmAbi` is not satisfied
--> ui-tests/missing-catch.rs:6:18
|
6 | pub fn foo() -> Result<JsValue, JsValue>;
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromWasmAbi` is not implemented for `Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>`
|
= help: the following other types implement trait `FromWasmAbi`:
bool
char
isize
i8
i16
i32
i64
i128
and $N others
38 changes: 38 additions & 0 deletions crates/macro/ui-tests/traits-not-implemented.stderr
Original file line number Diff line number Diff line change
@@ -15,3 +15,41 @@ error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied
i128
and $N others
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied
--> ui-tests/traits-not-implemented.rs:8:19
|
8 | pub fn foo(a: A);
| ^ the trait `IntoWasmAbi` is not implemented for `A`
|
= help: the following other types implement trait `IntoWasmAbi`:
bool
char
isize
i8
i16
i32
i64
i128
and $N others

error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied
--> ui-tests/traits-not-implemented.rs:8:12
|
5 | #[wasm_bindgen]
| --------------- in this procedural macro expansion
...
8 | pub fn foo(a: A);
| ^^^ the trait `IntoWasmAbi` is not implemented for `A`
|
= help: the following other types implement trait `IntoWasmAbi`:
bool
char
isize
i8
i16
i32
i64
i128
and $N others
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
2 changes: 1 addition & 1 deletion crates/macro/ui-tests/wasm-bindgen.stderr
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ error[E0433]: failed to resolve: could not find `convert` in `test`
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
3 + use crate::test::test::convert;
3 + use crate::extern_test::convert;
|
3 + use wasm_bindgen::convert;
|