-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[naga] parse and validate
@must_use
attribute (#6801)
* feat: parse and enforce `@must_use` attribute * feat: refuse `@must_use` of void function * generated naga/tests/out/ir * revert extraneous changes * fix clippy * update repeated attribute error to trunk format * struct members can't have `@must_use` * review fixes * Remove must_use from FunctionResult and revert the related changes --------- Co-authored-by: turbocrime <[email protected]> Co-authored-by: Jamie Nicol <[email protected]>
- Loading branch information
1 parent
426c1d3
commit b626020
Showing
10 changed files
with
552 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@compute @workgroup_size(1) | ||
fn main() {} | ||
|
||
@must_use | ||
fn use_me() -> i32 { return 10; } | ||
|
||
fn use_return() -> i32 { | ||
return use_me(); | ||
} | ||
|
||
fn use_assign_var() -> i32 { | ||
var q = use_me(); | ||
return q; | ||
} | ||
|
||
fn use_assign_let() -> i32 { | ||
let q = use_me(); | ||
return q; | ||
} | ||
|
||
fn use_phony_assign() { | ||
_ = use_me(); | ||
} |
Oops, something went wrong.