repo string | pull_number int64 | instance_id string | issue_numbers list | base_commit string | patch string | test_patch string | problem_statement string | hints_text string | created_at string | version string | updated_at string | environment_setup_commit string | FAIL_TO_PASS list | PASS_TO_PASS list | FAIL_TO_FAIL list | PASS_TO_FAIL list |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JohnnyMorganz/StyLua | 469 | JohnnyMorganz__StyLua-469 | [
"448"
] | 56f144f15b2628282fb4a84344e8daad9b8d6666 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- `--output-format=json` now outputs all (error) messages in JSON format ([#453](https://github.com/JohnnyMorganz/StyLua/issues/453)... | diff --git /dev/null b/tests/inputs-ignore/ignore-table-field.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/ignore-table-field.lua
@@ -0,0 +1,20 @@
+local foo = {
+ -- stylua: ignore
+ x = 2,
+ y = 3,
+ z = " he " ,
+}
+
+local bar = {
+ x = 2,
+ -- stylua: ignore
+ y = 3,
+ z... | Allow ignore comments to be used in places other than before statements
Currently, the only place ignore comments will be registered if they are leading trivia before statements.
This can be confusing, especially when you place a comment somewhere but it does not do anything.
We should be able to handle ignore comm... | 2022-06-25T19:22:24Z | 0.13 | 2022-06-25T12:18:38Z | 69c9278e551be7681578e01e6ab16cf6b05c82c5 | [
"test_ignores"
] | [
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments",
"tests::test_config_call_parentheses",
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2",
"formatters::trivia_util::tests::test_token_contains_singleline_comments",
"tests::test_config_indent_type",
... | [] | [] | |
JohnnyMorganz/StyLua | 422 | JohnnyMorganz__StyLua-422 | [
"421"
] | 30c713bc68d31b45fcfba1227bc6fbd4df97cba2 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed issue through static linking where Windows binary would not execute due to missing `VCRUNTIME140.dll`. ([#413](https://git... | diff --git a/tests/test_ignore.rs b/tests/test_ignore.rs
--- a/tests/test_ignore.rs
+++ b/tests/test_ignore.rs
@@ -211,3 +211,48 @@ local bar = baz
local bar = baz
"###);
}
+
+#[test]
+fn test_multiline_block_ignore_multiple_comments_in_leading_trivia() {
+ insta::assert_snapshot!(
+ format(
... | Block ignore is not applied to all back-to-back blocks
When `--stylua: ignore start/end` comments are applied back-to-back, they take effect on every second ignored block. This might be considered as a non-issue because they can be merged into one single ignored block, but it might be inconvenient when they are separat... | Yeah, this is a bug - it seems as though we are not correctly re-opening an ignore section when we see the `--stylua: ignore start` comment.
This code is actually parsed as these separate statements:
```lua
--stylua: ignore start
local a = 1
---------------------------
--stylua: ignore end
--stylua: igno... | 2022-03-27T21:08:32Z | 0.12 | 2022-03-27T13:12:43Z | a369d02342f3b1432ff89c619c97129a57678141 | [
"test_multiline_block_ignore_multiple_comments_in_leading_trivia"
] | [
"formatters::trivia_util::tests::test_token_contains_singleline_comments",
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2",
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments",
"tests::test_config_call_parentheses",
"tests::test_config_column_width",
... | [] | [] |
JohnnyMorganz/StyLua | 131 | JohnnyMorganz__StyLua-131 | [
"78"
] | aa9d9319d0314a853c4f56d3c120525668dc1a8a | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,10 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Parentheses around conditions are now removed, as they are not required in Lua. `if (foo and (not bar or baz)) ... | diff --git /dev/null b/src/shape.rs
new file mode 100644
--- /dev/null
+++ b/src/shape.rs
@@ -0,0 +1,125 @@
+use crate::context::Context;
+use std::fmt::Display;
+use std::ops::Add;
+
+#[derive(Clone, Copy, Debug)]
+pub struct Shape {
+ /// The current block indentation level. The base indentation level is 0. Note: ... | Turns readable multi-line function calls into harder to read, single line ones, but are under the column width
I'm not sure if this is something that's able to be fixed, but this is the before and after. I much prefer the before.
.unwrap();
}
+ #[test]
+ fn test_cwd_configuration_respected_when_formatting_from_stdin() {
+ let cwd = construct_tree!({
+ "stylua.toml": "quote... | after new release stdin does not repsect .stylua.toml by default
unless must set config-path .. before no need

| Looks like a mistake in https://github.com/JohnnyMorganz/StyLua/blob/1daf4c18fb6baf687cc41082f1cc6905ced226a4/src/cli/config.rs#L96, we forget to check the current directory if stdin file path was not provided. Thanks for reporting!
As a work around, you can use `--stdin-filepath` to specify the file path for the file... | 2024-11-30T20:21:18Z | 2.0 | 2024-11-30T12:36:13Z | f581279895a7040a36abaea4a6c8a6f50f112cd7 | [
"tests::test_cwd_configuration_respected_when_formatting_from_stdin"
] | [
"editorconfig::tests::test_collapse_simple_statement_always",
"editorconfig::tests::test_call_parentheses_always",
"editorconfig::tests::test_collapse_simple_statement_conditional_only",
"editorconfig::tests::test_call_parentheses_no_single_string",
"editorconfig::tests::test_collapse_simple_statement_funct... | [] | [] |
JohnnyMorganz/StyLua | 926 | JohnnyMorganz__StyLua-926 | [
"925"
] | 08e536f3a02d9a07b0991726897e0013ff78dd21 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Fixed
+
+- Fixed CLI overrides not applying on top of a resolved `stylua.toml` file ([#925](https://github.com/Johnny... | diff --git a/src/cli/main.rs b/src/cli/main.rs
--- a/src/cli/main.rs
+++ b/src/cli/main.rs
@@ -953,4 +950,74 @@ mod tests {
cwd.close().unwrap();
}
+
+ #[test]
+ fn test_uses_cli_overrides_instead_of_default_configuration() {
+ let cwd = construct_tree!({
+ "foo.lua": "local x = ... | CLI overrides not applied when formatting files in v2.0.0
I tried to run it both from Windows and from Docker for Windows
`stylua.exe --line-endings Windows --check .`
`stylua.exe --line-endings Unix --check .`
The result is the same, it gives errors in all files. Example of the first two files
```
Diff i... | Hm, this does look like line endings changing for some reason. Which is weird, since I don't think we touched that at all.
Do you by any chance have an example file I can test this with? Either in a public repo, or attaching a code file here (not in a code block since we need to preserve the line endings)
Yes, sure
... | 2024-11-18T05:01:53Z | 2.0 | 2024-11-17T21:06:05Z | f581279895a7040a36abaea4a6c8a6f50f112cd7 | [
"tests::test_uses_cli_overrides_instead_of_found_configuration"
] | [
"editorconfig::tests::test_call_parentheses_no_single_string",
"editorconfig::tests::test_call_parentheses_no_single_table",
"editorconfig::tests::test_call_parentheses_always",
"editorconfig::tests::test_call_parentheses_none",
"editorconfig::tests::test_collapse_simple_statement_always",
"editorconfig::... | [] | [] |
JohnnyMorganz/StyLua | 916 | JohnnyMorganz__StyLua-916 | [
"831",
"915"
] | d7d532b4baf2bcf2adf1925d7248f659788e5b58 | diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -229,7 +229,8 @@ StyLua has opinionated defaults, but also provides a few options that can be set
### Finding the configuration
-The CLI looks for `stylua.toml` or `.stylua.toml` in the directory where the tool was executed.
+The CLI looks for a... | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update internal Lua parser version (full-moon) to v1.1.0. This includes parser performance improvements. ([#854](https://github.com/Johnn... | feat: Use closest `stylua.toml` config to file being formatted
It would be nice if the formatter can be configured to stop looking for config files when reached a Git root (e.g. `git rev-parse --show-toplevel`) this will be useful such that when inside a lua repo and inside submodule, we stop at first `.stylelua` file,... | > we stop at first .stylelua file, somehow it does not stop and merges
this sounds incorrect to me, we don't merge two stylua files together. That sounds like the underlying issue here, rather than adding something else to stop at git roots.
Ah maybe you start the discovery of the style file from the current workin... | 2024-11-17T19:57:54Z | 0.20 | 2024-11-17T16:13:53Z | 26047670e05ba310afe9c1c1f91be6749e1f3ac9 | [
"tests::test_configuration_is_used_closest_to_the_file",
"tests::test_configuration_is_searched_next_to_file",
"tests::test_stdin_filepath_respects_cwd_configuration_for_nested_file"
] | [
"editorconfig::tests::test_call_parentheses_no_single_table",
"editorconfig::tests::test_call_parentheses_no_single_string",
"editorconfig::tests::test_call_parentheses_always",
"editorconfig::tests::test_call_parentheses_none",
"editorconfig::tests::test_collapse_simple_statement_always",
"editorconfig::... | [] | [] |
JohnnyMorganz/StyLua | 852 | JohnnyMorganz__StyLua-852 | [
"845"
] | bc3ce881eaaee46e8eb851366d33cba808d2a1f7 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The CLI tool will now only write files if the contents differ, and not modify if no change ([#827](https://github.com/JohnnyMorganz/StyLua/... | diff --git a/src/cli/main.rs b/src/cli/main.rs
--- a/src/cli/main.rs
+++ b/src/cli/main.rs
@@ -769,4 +769,21 @@ mod tests {
cwd.close().unwrap();
}
+
+ #[test]
+ fn test_respect_ignores_directory_no_glob() {
+ // https://github.com/JohnnyMorganz/StyLua/issues/845
+ let cwd = construc... | `--respect-ignores`: does not correctly ignore folders without the globbing pattern
Problem: `.styluaignore` does not ignore **folders** or **directories** like `.gitignore`, `.rgignore`, etc. do. Instead, full globbing patterns (`*.lua` or `**/*.lua`) would be needed to ignore all files under a directory.
EDIT: Th... | We use the ignore crate to provide gitignore-style ignores: https://docs.rs/ignore/latest/ignore/. This may actually be an issue upstream, but I will verify it myself first
(Ignore my previous response - I did not read your issue properly!)
Yes, I find that ignoring a (sub)directory works when scanning, i.e., "stylua ... | 2024-01-20T20:13:59Z | 0.19 | 2024-01-20T12:37:21Z | bc3ce881eaaee46e8eb851366d33cba808d2a1f7 | [
"tests::test_respect_ignores_directory_no_glob"
] | [
"editorconfig::tests::test_call_parentheses_always",
"editorconfig::tests::test_call_parentheses_no_single_table",
"editorconfig::tests::test_call_parentheses_no_single_string",
"editorconfig::tests::test_call_parentheses_none",
"editorconfig::tests::test_collapse_simple_statement_always",
"editorconfig::... | [] | [] |
JohnnyMorganz/StyLua | 752 | JohnnyMorganz__StyLua-752 | [
"750"
] | fdf9f0c5952cb1565ba6449929514eb94ac5ef3f | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Fixed
+
+- Fixed LuaJIT suffixes `LL`/`ULL` causing a panic when running in `--verify` mode ([#750](https://github.co... | diff --git a/src/verify_ast.rs b/src/verify_ast.rs
--- a/src/verify_ast.rs
+++ b/src/verify_ast.rs
@@ -305,6 +311,16 @@ mod tests {
assert!(!ast_verifier.compare(input_ast, output_ast));
}
+ #[test]
+ #[cfg(feature = "lua52")]
+ fn test_equivalent_luajit_numbers() {
+ let input_ast = ful... | Panic when format luajit type with `--verify` flag
installed by `cargo install stylua --features lua52`
```
$ echo "return 2^63LL " | RUST_BACKTRACE=1 stylua -
return 2 ^ 63LL
$ echo "return 2^63LL " | RUST_BACKTRACE=1 stylua --verify -
thread '<unnamed>' panicked at 'internal error: entered unreachable code',... | 2023-09-02T08:18:04Z | 0.18 | 2023-09-02T00:44:03Z | 095e2b0c79df0bac21915dd2deee9a0a25a9b382 | [
"verify_ast::tests::test_equivalent_luajit_numbers",
"test_global",
"test_local",
"test_empty_root",
"test_root",
"test_stylua_toml",
"test_lua54"
] | [
"editorconfig::tests::test_call_parentheses_always",
"editorconfig::tests::test_call_parentheses_no_single_table",
"editorconfig::tests::test_call_parentheses_no_single_string",
"editorconfig::tests::test_call_parentheses_none",
"editorconfig::tests::test_collapse_simple_statement_always",
"editorconfig::... | [] | [] | |
JohnnyMorganz/StyLua | 666 | JohnnyMorganz__StyLua-666 | [
"665"
] | 46457ad4e4130d07ee0f9a5cf95ac10023c8ceeb | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bumped internal parser dependency which should fix parsing problems for comments with Chinese characters, and multiline string escapes
-... | diff --git a/tests/tests.rs b/tests/tests.rs
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -127,3 +127,40 @@ fn test_sort_requires() {
.unwrap());
})
}
+
+#[test]
+fn test_crlf_in_multiline_comments() {
+ // We need to do this outside of insta since it normalises line endings to LF
+ let code = r###... | Line endings appear to not be converted when they occur in multiline comments (?)
Heyo, we've run into an odd formatting glitch that causes huge git diffs in combination with VS Code's LF/CRLF setting.
In this example file, we have CRLFs present in the comment but LFs everywhere else (as created by StyLua, using the... | Definitely unintended, let me take a look. Thanks for the report! | 2023-03-30T23:38:41Z | 0.17 | 2023-03-30T15:47:25Z | 5c6d59135f419274121349799a5227be467358b1 | [
"test_global",
"test_root",
"test_local",
"test_stylua_toml",
"test_crlf_in_multiline_strings",
"test_crlf_in_multiline_comments",
"test_lua54"
] | [
"editorconfig::tests::test_call_parentheses_always",
"editorconfig::tests::test_call_parentheses_no_single_string",
"editorconfig::tests::test_call_parentheses_no_single_table",
"editorconfig::tests::test_call_parentheses_none",
"editorconfig::tests::test_collapse_simple_statement_always",
"editorconfig::... | [] | [] |
JohnnyMorganz/StyLua | 645 | JohnnyMorganz__StyLua-645 | [
"75"
] | 15c1f0d4880dbcfe37dd2828da10745f95a13825 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,10 @@ enabled = true
Note: we assume that all requires are **pure** with no side effects. It is not recommended to use this feature if the ordering of your requires matter.
+- Added support for [EditorConfig](https://editor... | diff --git a/.gitattributes b/.gitattributes
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,3 +1,3 @@
* text=auto
*.lua text eol=lf
-tests/inputs/* linguist-vendored
\ No newline at end of file
+tests/inputs/* linguist-vendored
diff --git /dev/null b/src/editorconfig.rs
new file mode 100644
--- /dev/null
+++ b/src/e... | [Suggestion] Support .editorconfig
Given that [.editorconfig file](https://editorconfig.org/) provides some settings that are supported by stylua, it could be handy to read that file to avoid duplicating these settings.
| I believe the way prettier does this is to allow an option to defer to the `.editorconfig` file. Would probably be a good option here as well.
Interesting idea, which might be nice to have.
I think I'll most likely support project-level editorconfig, rather than a global one, so that it is more noticeable what kind o... | 2023-02-04T22:22:18Z | 0.16 | 2023-11-20T17:38:32Z | 12d3f3d31b203d90d615183d6ac356b3cb71b913 | [
"test_lua54"
] | [
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments",
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2",
"formatters::trivia_util::tests::test_token_contains_singleline_comments",
"sort_requires::tests::fail_extracting_non_identifier_token",
"tests::test_... | [] | [] |
JohnnyMorganz/StyLua | 631 | JohnnyMorganz__StyLua-631 | [
"618"
] | 3699358f0ceebe6651789cff25f289d3ac84c937 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Unnecessary parentheses around Luau types will now be removed ([#611](https://github.com/JohnnyMorganz/StyLua/issues/611))
+- ... | diff --git a/tests/tests.rs b/tests/tests.rs
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -89,3 +89,25 @@ fn test_collapse_single_statement() {
.unwrap());
})
}
+
+// Collapse simple statement for goto
+#[test]
+#[cfg(feature = "lua52")]
+fn test_collapse_single_statement_lua_52() {
+ insta::assert_sn... | `collapse_simple_statement` for goto
using `collapse_simple_statement = "Always"`:
```lua
-- won't collapse
if key == "s" then
goto continue
end
-- on the other hand something like this does collapse
local modes = { "n", "v" }
if key == "p" then modes = { "n" } end
-- ...
```
| 2022-12-18T22:08:23Z | 0.15 | 2023-01-04T20:16:33Z | 540ecfb832e3bccf86e0e037b9c855aa464fc4e7 | [
"test_collapse_single_statement_lua_52",
"test_lua54"
] | [
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments",
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2",
"formatters::trivia_util::tests::test_token_contains_singleline_comments",
"tests::test_config_call_parentheses",
"tests::test_config_column_width",
... | [] | [] | |
Zokrates/ZoKrates | 101 | Zokrates__ZoKrates-101 | [
"38"
] | 97c2a30e59a799e06344b5553554768c868e0ae9 | diff --git /dev/null b/examples/left_side_call.code
new file mode 100644
--- /dev/null
+++ b/examples/left_side_call.code
@@ -0,0 +1,6 @@
+def foo():
+ return 1
+
+def main():
+ foo() + (1 + 44*3) == 1
+ return 1
diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -879,6 +879,41 @@ fn ... | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -1592,6 +1627,22 @@ mod tests {
}
}
+ mod parse_statement1 {
+ use super::*;
+ #[test]
+ fn left_call_in_assertion() {
+ let pos = Position { line: 45, col: 121 };
+ let st... | Inline constraints cannot take function calls as left expression
```
foo() == 1 // syntax error
1 == foo() // OK
```
| 2018-08-09T17:44:22Z | 0.2 | 2018-09-26T12:30:47Z | 97c2a30e59a799e06344b5553554768c868e0ae9 | [
"parser::tests::parse_statement1::left_call_in_assertion"
] | [
"field::tests::bigint_assertions",
"field::tests::field_prime::addition",
"field::tests::field_prime::addition_negative",
"field::tests::field_prime::dec_string_ser_deser",
"field::tests::field_prime::addition_negative_small",
"field::tests::field_prime::bytes_ser_deser",
"field::tests::field_prime::mul... | [] | [] | |
Zokrates/ZoKrates | 97 | Zokrates__ZoKrates-97 | [
"96"
] | 3c36637521495d9632c8c5c524e790cf61081f6e | diff --git /dev/null b/examples/argument_reassign.code
new file mode 100644
--- /dev/null
+++ b/examples/argument_reassign.code
@@ -0,0 +1,6 @@
+def sub(a):
+ a = a + 3
+ return a
+
+def main():
+ return sub(4)
\ No newline at end of file
diff --git a/src/flatten.rs b/src/flatten.rs
--- a/src/flatten.rs
+++ b/src/f... | diff --git a/src/flatten.rs b/src/flatten.rs
--- a/src/flatten.rs
+++ b/src/flatten.rs
@@ -920,6 +921,48 @@ mod multiple_definition {
);
}
+ #[test]
+ fn redefine_argument() {
+
+ // def foo(a)
+ // a = a + 1
+ // return 1
+
+ // should flatten to no redefinitio... | [Runtime Crash] Cannot re-assign function parameter when it is used in assignment
Assume the following sample code
```
def sub(a):
a = a + 3
return a
def main():
a = 4
return sub(a)
```
It compiles fine, however when computing a witness it crashes with:
```
thread 'main' panicked at 'Variab... | 2018-08-02T00:15:14Z | 0.2 | 2018-08-03T07:51:23Z | 97c2a30e59a799e06344b5553554768c868e0ae9 | [
"flatten::multiple_definition::redefine_argument"
] | [
"direct_substitution::tests::two_separators",
"direct_substitution::tests::insert_binary_variable",
"direct_substitution::tests::insert_simple_variable",
"direct_substitution::tests::insert_twice_with_same_prefix",
"field::tests::bigint_assertions",
"field::tests::field_prime::bytes_ser_deser",
"field::... | [
"helpers::tests::sha256libsnark::execute",
"integration::run_integration_tests"
] | [] | |
gfx-rs/naga | 1,611 | gfx-rs__naga-1611 | [
"1545"
] | 33c1daeceef9268a9502df0720d69c9aa9b464da | diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs
--- a/src/front/wgsl/mod.rs
+++ b/src/front/wgsl/mod.rs
@@ -3470,9 +3470,20 @@ impl Parser {
lexer.expect(Token::Paren(')'))?;
let accept = self.parse_block(lexer, context.reborrow(), false)?;
+
... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -215,7 +215,7 @@ fn parse_if() {
if (0 != 1) {}
if (false) {
return;
- } elseif (true) {
+ } else if (true) {
re... | The else if statement is not supported
Naga does not allow an if_statement inside an else_statement, but the [spec](https://www.w3.org/TR/WGSL/#if-statement) allows for it.
```
if (true) {} else if (false) {}
```
```
Parse Error: expected '{', found 'if'
```
| 2021-12-17T23:11:03Z | 0.7 | 2021-12-17T16:19:39Z | 33c1daeceef9268a9502df0720d69c9aa9b464da | [
"front::wgsl::tests::parse_if"
] | [
"arena::tests::fetch_or_append_unique",
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::test_logical_layout_in_words",
... | [] | [] | |
gfx-rs/naga | 1,567 | gfx-rs__naga-1567 | [
"1533"
] | cadc052ab33084d884ba484a1c2be1bcaf8e440b | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,21 @@
# Change Log
+## v0.7.2 (2021-12-01)
+ - validator:
+ - check stores for proper pointer class
+ - HLSL-out:
+ - fix stores into `mat3`
+ - respect array strides
+ - SPV-out:
+ - fix multi-word constants
+ ... | diff --git a/src/proc/namer.rs b/src/proc/namer.rs
--- a/src/proc/namer.rs
+++ b/src/proc/namer.rs
@@ -224,3 +250,11 @@ impl Namer {
}
}
}
+
+#[test]
+fn test() {
+ let mut namer = Namer::default();
+ assert_eq!(namer.call("x"), "x");
+ assert_eq!(namer.call("x"), "x_1");
+ assert_eq!(namer.c... | Naga validation doesn't reject stores to read-only variables
[EDIT: I originally misidentified which rule was being broken here. The lead para has been changed.]
Naga fails to reject assignments to variables in the `storage` storage class declared with a default access mode. WGSL says that the default for such varia... | 2021-12-02T08:36:02Z | 0.7 | 2021-12-02T03:07:28Z | 33c1daeceef9268a9502df0720d69c9aa9b464da | [
"proc::namer::test",
"wrong_access_mode"
] | [
"back::msl::test_error_size",
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 1,549 | gfx-rs__naga-1549 | [
"1546"
] | 7fd172515dd6348fd9b35b81366686c62e41d69c | diff --git a/src/back/wgsl/mod.rs b/src/back/wgsl/mod.rs
--- a/src/back/wgsl/mod.rs
+++ b/src/back/wgsl/mod.rs
@@ -1,4 +1,3 @@
-mod keywords;
mod writer;
use thiserror::Error;
diff --git a/src/back/wgsl/writer.rs b/src/back/wgsl/writer.rs
--- a/src/back/wgsl/writer.rs
+++ b/src/back/wgsl/writer.rs
@@ -72,8 +72,12 @... | diff --git a/tests/in/access.wgsl b/tests/in/access.wgsl
--- a/tests/in/access.wgsl
+++ b/tests/in/access.wgsl
@@ -30,7 +30,7 @@ fn foo([[builtin(vertex_index)]] vi: u32) -> [[builtin(position)]] vec4<f32> {
let a = bar.data[arrayLength(&bar.data) - 2u];
// test pointer types
- let pointer: ptr<storage, i32, read... | [wgsl-in] naga should not accept keywords as identifiers
The code `let sampler = 0;` is accepted by naga, but according to the spec, an identifier [must not have the same spelling as a keyword or as a reserved word](https://gpuweb.github.io/gpuweb/wgsl/#identifiers), and `sampler` [is a keyword](https://gpuweb.github.i... | 2021-11-24T21:29:25Z | 0.7 | 2021-11-24T21:41:31Z | 33c1daeceef9268a9502df0720d69c9aa9b464da | [
"reserved_keyword"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constan... | [] | [] | |
gfx-rs/naga | 1,534 | gfx-rs__naga-1534 | [
"1533"
] | 1dcde48d09245b81cc08b15b13a14281f75f7a0e | diff --git a/src/proc/mod.rs b/src/proc/mod.rs
--- a/src/proc/mod.rs
+++ b/src/proc/mod.rs
@@ -184,6 +184,21 @@ impl super::TypeInner {
}
}
+impl super::StorageClass {
+ pub fn access(self) -> crate::StorageAccess {
+ use crate::StorageAccess as Sa;
+ match self {
+ crate::StorageCla... | diff --git a/tests/in/bounds-check-zero.wgsl b/tests/in/bounds-check-zero.wgsl
--- a/tests/in/bounds-check-zero.wgsl
+++ b/tests/in/bounds-check-zero.wgsl
@@ -7,7 +7,7 @@ struct Globals {
m: mat3x4<f32>;
};
-[[group(0), binding(0)]] var<storage> globals: Globals;
+[[group(0), binding(0)]] var<storage, read_writ... | Naga validation doesn't reject stores to read-only variables
[EDIT: I originally misidentified which rule was being broken here. The lead para has been changed.]
Naga fails to reject assignments to variables in the `storage` storage class declared with a default access mode. WGSL says that the default for such varia... | 2021-11-16T14:47:52Z | 0.7 | 2021-12-02T03:20:01Z | 33c1daeceef9268a9502df0720d69c9aa9b464da | [
"wrong_access_mode"
] | [
"back::msl::test_error_size",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 1,510 | gfx-rs__naga-1510 | [
"1508"
] | 28c45321e53c3dac8a613e2402d0e336d886ad49 | diff --git a/src/proc/namer.rs b/src/proc/namer.rs
--- a/src/proc/namer.rs
+++ b/src/proc/namer.rs
@@ -2,6 +2,7 @@ use crate::{arena::Handle, FastHashMap, FastHashSet};
use std::borrow::Cow;
pub type EntryPointIndex = u16;
+const SEPARATOR: char = '_';
#[derive(Debug, Eq, Hash, PartialEq)]
pub enum NameKey {
di... | diff --git a/src/proc/namer.rs b/src/proc/namer.rs
--- a/src/proc/namer.rs
+++ b/src/proc/namer.rs
@@ -258,3 +251,11 @@ impl Namer {
}
}
}
+
+#[test]
+fn test() {
+ let mut namer = Namer::default();
+ assert_eq!(namer.call("x"), "x");
+ assert_eq!(namer.call("x"), "x_1");
+ assert_eq!(namer.c... | water example triggers shader compiler error
On a M1 MacBook, doing `cargo run --example water` results in the following.
```
Finished dev [unoptimized + debuginfo] target(s) in 0.15s
Running `target/debug/examples/water`
Using Apple M1 (Metal)
[2021-11-02T03:41:04Z ERROR wgpu::backend::direct] Handling... | Looks like we are spewing the shader code that uses variable shadowing. We shouldn't be doing this. | 2021-11-04T02:08:36Z | 0.7 | 2021-12-02T03:19:49Z | 33c1daeceef9268a9502df0720d69c9aa9b464da | [
"proc::namer::test"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] |
gfx-rs/naga | 1,139 | gfx-rs__naga-1139 | [
"1138"
] | e97c8f944121a58bbc908ecb64bdf97d4ada039d | diff --git a/src/proc/mod.rs b/src/proc/mod.rs
--- a/src/proc/mod.rs
+++ b/src/proc/mod.rs
@@ -101,11 +101,15 @@ impl super::TypeInner {
kind: _,
width,
} => (size as u8 * width) as u32,
+ // matrices are treated as arrays of aligned columns
Self::M... | diff --git a/src/proc/mod.rs b/src/proc/mod.rs
--- a/src/proc/mod.rs
+++ b/src/proc/mod.rs
@@ -318,3 +322,17 @@ impl super::SwizzleComponent {
}
}
}
+
+#[test]
+fn test_matrix_size() {
+ let constants = crate::Arena::new();
+ assert_eq!(
+ crate::TypeInner::Matrix {
+ columns: cra... | [wgsl-in] Size of nx3 matrices is not to spec, resulting in overlapping fields
This struct declaration:
```
struct Foo {
m: mat3x3<f32>;
f: f32;
};
```
Produces this spir-v:
```
; SPIR-V
; Version: 1.0
; Generator: Khronos; 28
; Bound: 7
; Schema: 0
OpCapability Shader
... | 2021-07-26T22:37:50Z | 0.5 | 2021-07-26T14:40:50Z | c39810233274b0973fe0fcbfedb3ced8c9f685b6 | [
"proc::test_matrix_size"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 1,006 | gfx-rs__naga-1006 | [
"1003"
] | 3a4d6fa29584228e206ecb1d0eeac6dd565cdb1c | diff --git a/src/front/glsl/ast.rs b/src/front/glsl/ast.rs
--- a/src/front/glsl/ast.rs
+++ b/src/front/glsl/ast.rs
@@ -955,6 +955,7 @@ pub enum TypeQualifier {
WorkGroupSize(usize, u32),
Sampling(Sampling),
Layout(StructLayout),
+ Precision(Precision),
EarlyFragmentTests,
}
diff --git a/src/fr... | diff --git a/src/front/glsl/parser_tests.rs b/src/front/glsl/parser_tests.rs
--- a/src/front/glsl/parser_tests.rs
+++ b/src/front/glsl/parser_tests.rs
@@ -246,6 +246,15 @@ fn declarations() {
&entry_points,
)
.unwrap();
+
+ let _program = parse_program(
+ r#"
+ #version 450
+ ... | [glsl-in] precision statement is not parsed
As a statement, `precision highp float;` shouldn't cause an error.
| 2021-06-22T04:33:55Z | 0.5 | 2021-06-21T20:37:09Z | c39810233274b0973fe0fcbfedb3ced8c9f685b6 | [
"front::glsl::parser_tests::declarations"
] | [
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::writer:... | [] | [] | |
gfx-rs/naga | 933 | gfx-rs__naga-933 | [
"931"
] | 61bfb29963fba9a7e8807bdd7ca1c5e5a8b76fec | diff --git a/src/front/glsl/ast.rs b/src/front/glsl/ast.rs
--- a/src/front/glsl/ast.rs
+++ b/src/front/glsl/ast.rs
@@ -12,11 +12,17 @@ use crate::{
};
#[derive(Debug, Clone, Copy)]
-pub enum GlobalLookup {
+pub enum GlobalLookupKind {
Variable(Handle<GlobalVariable>),
BlockSelect(Handle<GlobalVariable>, u... | diff --git a/tests/snapshots.rs b/tests/snapshots.rs
--- a/tests/snapshots.rs
+++ b/tests/snapshots.rs
@@ -348,15 +348,13 @@ fn convert_spv_shadow() {
}
#[cfg(feature = "glsl-in")]
-// TODO: Reenable tests later
-#[allow(dead_code)]
fn convert_glsl(
name: &str,
entry_points: naga::FastHashMap<String, nag... | [glsl-in] expression already in scope with constant above function
```glsl
#version 450
const int constant = 10;
float function() {
return 0.0;
}
```
fails to validate with the following error:
```
Function [1] 'function' is invalid:
Expression [1] can't be introduced - it's already in scope
```
Ch... | Thank you for your report, this is an issue with emitting that I have already fixed in my local fork and will make a PR soon | 2021-06-02T02:31:43Z | 0.4 | 2021-07-05T11:13:04Z | 575304a50c102f2e2a3a622b4be567c0ccf6e6c0 | [
"convert_glsl_quad"
] | [
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"front::glsl::constants::tests::access",
"front::glsl::constants::test... | [] | [] |
gfx-rs/naga | 929 | gfx-rs__naga-929 | [
"865"
] | e384bce771db1d7dd156e9e29afe9d9235984924 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
## TBD
- API:
+ - atomic types and functions
- WGSL `select()` order of true/false is swapped
## v0.5 (2021-06-18)
diff --git a/src/back/dot/mod.rs b/src/back/dot/mod.rs
--- a/src/back/dot/mod.rs
+++ b/src/ba... | diff --git a/src/back/msl/writer.rs b/src/back/msl/writer.rs
--- a/src/back/msl/writer.rs
+++ b/src/back/msl/writer.rs
@@ -2496,8 +2598,8 @@ fn test_stack_size() {
}
let stack_size = addresses.end - addresses.start;
// check the size (in debug only)
- // last observed macOS value: 1766... | Atomic operations
See https://github.com/gpuweb/gpuweb/pull/1448
| There is quite a few choices here on how to approach this.
First, for the type system:
1. `TypeInner::Scalar { kind, width, atomic: bool }` - becomes very annoying since in 99% of cases `atomic==false`
2. `TypeInner::Atomic { kind, width }` - less annoying
In both cases the `Typifier` needs a hack: `Expressi... | 2021-06-01T14:08:39Z | 0.5 | 2021-08-11T01:48:05Z | c39810233274b0973fe0fcbfedb3ced8c9f685b6 | [
"back::msl::writer::test_stack_size",
"front::wgsl::type_inner_tests::to_wgsl",
"convert_wgsl"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::writer:... | [] | [] |
gfx-rs/naga | 898 | gfx-rs__naga-898 | [
"887"
] | 99fbb34bd6b07ca0a0cc2cf01c151d8264789965 | diff --git a/src/front/glsl/ast.rs b/src/front/glsl/ast.rs
--- a/src/front/glsl/ast.rs
+++ b/src/front/glsl/ast.rs
@@ -25,7 +25,7 @@ pub struct FunctionSignature {
#[derive(Debug, Clone)]
pub struct FunctionDeclaration {
- pub parameters: Vec<ParameterQualifier>,
+ pub qualifiers: Vec<ParameterQualifier>,
... | diff --git a/src/front/glsl/parser_tests.rs b/src/front/glsl/parser_tests.rs
--- a/src/front/glsl/parser_tests.rs
+++ b/src/front/glsl/parser_tests.rs
@@ -369,6 +369,22 @@ fn functions() {
&entry_points,
)
.unwrap();
+
+ parse_program(
+ r#"
+ # version 450
+ void fun(vec2 in... | [glsl-in] Builtin global have empty storage access
```glsl
#version 450
void main() {
gl_Position = vec4(1.0, 1.0, 1,0, 1.0);
}
```
```bash
Global variable [1] 'gl_Position' is invalid:
Storage access LOAD | STORE exceeds the allowed (empty)
thread 'main' panicked at 'called `Option::unwrap()`... | 2021-05-23T03:41:52Z | 0.4 | 2021-07-05T11:13:04Z | 575304a50c102f2e2a3a622b4be567c0ccf6e6c0 | [
"front::glsl::parser_tests::functions"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 863 | gfx-rs__naga-863 | [
"862"
] | 057d03ad86f18e3bb3866b20901d8d4e892dd3d6 | diff --git a/src/front/spv/flow.rs b/src/front/spv/flow.rs
--- a/src/front/spv/flow.rs
+++ b/src/front/spv/flow.rs
@@ -797,12 +797,13 @@ impl FlowGraph {
Terminator::Branch { target_id } => {
let target_index = self.block_to_node[&target_id];
- let ... | diff --git /dev/null b/tests/in/standard.param.ron
new file mode 100644
--- /dev/null
+++ b/tests/in/standard.param.ron
@@ -0,0 +1,5 @@
+(
+ spv_version: (1, 0),
+ spv_capabilities: [ Shader ],
+ spv_adjust_coordinate_space: false,
+)
diff --git /dev/null b/tests/in/standard.wgsl
new file mode 100644
--- /dev/null
+++ ... | Error: unknown type: `fwidth`
I have started to translate my glsl shaders into wgsl but ran into an issue on this line:
`let derivative = fwitdth(coords);` which gave me the error that's the title of this issue. [According to the wgsl spec](https://gpuweb.github.io/gpuweb/wgsl/#derivative-builtin-functions) `fwidth`... | 2021-05-14T21:45:57Z | 0.4 | 2021-05-14T14:19:44Z | 575304a50c102f2e2a3a622b4be567c0ccf6e6c0 | [
"convert_wgsl"
] | [
"arena::tests::append_non_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::test_physical_layout_in_words",
"front::glsl::constan... | [] | [] | |
gfx-rs/naga | 2,510 | gfx-rs__naga-2510 | [
"2412",
"2234"
] | 3bcb114adbf144544cb46497b000adf3e7e71181 | diff --git a/src/back/glsl/mod.rs b/src/back/glsl/mod.rs
--- a/src/back/glsl/mod.rs
+++ b/src/back/glsl/mod.rs
@@ -1129,7 +1129,8 @@ impl<'a, W: Write> Writer<'a, W> {
let ty_name = &self.names[&NameKey::Type(global.ty)];
let block_name = format!(
"{}_block_{}{:?}",
- ty_name,
... | diff --git a/src/proc/namer.rs b/src/proc/namer.rs
--- a/src/proc/namer.rs
+++ b/src/proc/namer.rs
@@ -268,4 +276,6 @@ fn test() {
assert_eq!(namer.call("x"), "x");
assert_eq!(namer.call("x"), "x_1");
assert_eq!(namer.call("x1"), "x1_");
+ assert_eq!(namer.call("__x"), "_x");
+ assert_eq!(namer.cal... | [glsl-out] Rename identifiers containing two consecutive underscores since they are reserved
> In addition, all identifiers containing two consecutive underscores (__) are reserved for use by underlying software layers. Defining such a name in a shader does not itself result in an error, but may result in unintended be... |
## first underscore
when type name is ends with number, it put the underscore

## last underscore in code:
in naga\src\back\glsl\mod.rs, write_interface_block function, as follow:

//
"main",
+ // Naga utilities:
+ super::MODF_FUNCTION,
+ ... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -456,10 +456,11 @@ fn binary_expression_mixed_scalar_and_vector_operands() {
#[test]
fn parse_pointers() {
parse_str(
- "fn foo() {
+ "fn foo(a: ptr<private, f32>) -> f32 { ... | Change frexp and modf to work with structures
See https://github.com/gpuweb/gpuweb/pull/1973
I think this change needs to be done at IR level.
Change frexp and modf to return structures
Closes #1161
TODO:
- [x] IR
- [x] validation
- [x] typifier
- [ ] frontends (except WGSL)
- [ ] backends (except WGSL)
| Similar work needs to be done for atomic compare+exchange - https://github.com/gpuweb/gpuweb/pull/2113
I think all of this should wait for #1419 first.
This isn't urgent for the release.
Currently bumping up against this when targeting WebGPU, as wgpu's water example uses modf.
This should be simpler now that #2256 is... | 2023-08-24T00:48:00Z | 0.13 | 2023-09-03T21:16:06Z | a17a93ef8f6a06ed8dfc3145276663786828df03 | [
"convert_wgsl"
] | [
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constants::tests::access",
"back::msl... | [] | [] |
gfx-rs/naga | 2,440 | gfx-rs__naga-2440 | [
"2439"
] | 7a19f3af909202c7eafd36633b5584bfbb353ecb | diff --git a/src/front/wgsl/lower/mod.rs b/src/front/wgsl/lower/mod.rs
--- a/src/front/wgsl/lower/mod.rs
+++ b/src/front/wgsl/lower/mod.rs
@@ -504,13 +504,25 @@ impl<'source, 'temp, 'out> ExpressionContext<'source, 'temp, 'out> {
}
/// Insert splats, if needed by the non-'*' operations.
+ ///
+ /// Se... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -387,6 +387,54 @@ fn parse_expressions() {
}").unwrap();
}
+#[test]
+fn binary_expression_mixed_scalar_and_vector_operands() {
+ for (operand, expect_splat) in [
+ ('<', false)... | [wgsl-in] Comparing scalar with vector type incorrectly passes validation
Spec says both sides of the comparision need to have the same type.
https://www.w3.org/TR/WGSL/#comparison-expr
The following snippet should therefore not pass validation.
```
const some_vec = vec3<f32>(1.0, 1.0, 1.0);
@fragment
fn main... | 2023-08-16T18:09:02Z | 0.13 | 2023-08-18T13:08:28Z | a17a93ef8f6a06ed8dfc3145276663786828df03 | [
"front::wgsl::tests::binary_expression_mixed_scalar_and_vector_operands"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_unique",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer:... | [] | [] | |
gfx-rs/naga | 2,353 | gfx-rs__naga-2353 | [
"1929"
] | 273ff5d829f8207d8d93b70e32e2889362246d33 | diff --git a/src/back/hlsl/writer.rs b/src/back/hlsl/writer.rs
--- a/src/back/hlsl/writer.rs
+++ b/src/back/hlsl/writer.rs
@@ -121,13 +121,40 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
self.need_bake_expressions.insert(fun_handle);
}
- if let Expression::Math { fun, arg... | diff --git /dev/null b/tests/out/hlsl/bits.hlsl
new file mode 100644
--- /dev/null
+++ b/tests/out/hlsl/bits.hlsl
@@ -0,0 +1,131 @@
+
+[numthreads(1, 1, 1)]
+void main()
+{
+ int i = (int)0;
+ int2 i2_ = (int2)0;
+ int3 i3_ = (int3)0;
+ int4 i4_ = (int4)0;
+ uint u = (uint)0;
+ uint2 u2_ = (uint2)0;
+... | Missing extractBits and insertBits implementations for HLSL
Seems they were implemented for other backends in #1449 but not for HLSL.
| I think all the other functions from that PR are missing too:
- pack4x8snorm
- pack4x8unorm
- pack2x16snorm
- pack2x16unorm
- pack2x16float
- unpack4x8snorm
- unpack4x8unorm
- unpack2x16snorm
- unpack2x16unorm
- unpack2x16float | 2023-05-25T12:07:20Z | 0.12 | 2023-06-23T13:52:23Z | 04ef22f6dc8d9c4b958dc6575bbb3be9d7719ee0 | [
"convert_wgsl"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::writer:... | [] | [] |
gfx-rs/naga | 2,342 | gfx-rs__naga-2342 | [
"2312"
] | 423a069dcddc790fdf27d8c389fa4487f07fcc0a | diff --git a/src/front/wgsl/parse/mod.rs b/src/front/wgsl/parse/mod.rs
--- a/src/front/wgsl/parse/mod.rs
+++ b/src/front/wgsl/parse/mod.rs
@@ -84,6 +84,18 @@ impl<'a> ExpressionContext<'a, '_, '_> {
}
Ok(accumulator)
}
+
+ fn declare_local(&mut self, name: ast::Ident<'a>) -> Result<Handle<ast:... | diff --git a/tests/in/lexical-scopes.wgsl b/tests/in/lexical-scopes.wgsl
--- a/tests/in/lexical-scopes.wgsl
+++ b/tests/in/lexical-scopes.wgsl
@@ -1,45 +1,41 @@
fn blockLexicalScope(a: bool) {
- let a = 1.0;
{
let a = 2;
{
- let a = true;
+ let a = 2.0;
}
- ... | [wgsl-in] Redefining parameter is incorreclty allowed
The following snippet redefines an incoming parameter which should not compile (and Tint will complain about it!):
```
fn fun(t: f32) -> f32 {
let t = t + 1.0;
return t;
}
```
| 2023-05-15T23:41:22Z | 0.12 | 2023-05-30T11:55:39Z | 04ef22f6dc8d9c4b958dc6575bbb3be9d7719ee0 | [
"function_param_redefinition_as_local",
"function_param_redefinition_as_param"
] | [
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::writer:... | [] | [] | |
gfx-rs/naga | 2,233 | gfx-rs__naga-2233 | [
"2169"
] | 6be394dac31bc9796d4ae4bb450a40c6b6ee0b08 | diff --git a/src/front/wgsl/error.rs b/src/front/wgsl/error.rs
--- a/src/front/wgsl/error.rs
+++ b/src/front/wgsl/error.rs
@@ -134,7 +134,7 @@ pub enum NumberError {
pub enum InvalidAssignmentType {
Other,
Swizzle,
- ImmutableBinding,
+ ImmutableBinding(Span),
}
#[derive(Clone, Debug)]
diff --git a... | diff --git a/tests/wgsl-errors.rs b/tests/wgsl-errors.rs
--- a/tests/wgsl-errors.rs
+++ b/tests/wgsl-errors.rs
@@ -1624,13 +1624,56 @@ fn assign_to_let() {
}
",
r###"error: invalid left-hand side of assignment
- ┌─ wgsl:4:10
+ ┌─ wgsl:3:17
│
+3 │ let a = 10;
+ │ ... | [wgsl-in] Invalid assignment diagnostic doesn't extend to derived expressions
Given this code:
```rs
fn main() {
let a = 1;
a = 2;
}
```
Naga errors with:
```rs
error: invalid left-hand side of assignment
┌─ wgsl:3:2
│
3 │ a = 2;
│ ^ cannot assign to this expression
│
= note: 'a... | 2023-02-01T00:50:40Z | 0.11 | 2023-02-01T11:38:30Z | da8e911d9d207a7571241e875f7ac066856e8b3f | [
"assign_to_let"
] | [
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 2,056 | gfx-rs__naga-2056 | [
"2052"
] | 4f8db997b0b1e73fc1e2cac070485333a5b61925 | diff --git a/src/front/wgsl/lexer.rs b/src/front/wgsl/lexer.rs
--- a/src/front/wgsl/lexer.rs
+++ b/src/front/wgsl/lexer.rs
@@ -273,7 +273,7 @@ impl<'a> Lexer<'a> {
if next.0 == expected {
Ok(next.1)
} else {
- Err(Error::Unexpected(next, ExpectedToken::Token(expected)))
+ ... | diff --git a/tests/wgsl-errors.rs b/tests/wgsl-errors.rs
--- a/tests/wgsl-errors.rs
+++ b/tests/wgsl-errors.rs
@@ -1597,3 +1597,83 @@ fn break_if_bad_condition() {
)
}
}
+
+#[test]
+fn swizzle_assignment() {
+ check(
+ "
+ fn f() {
+ var v = vec2(0);
+ v.xy = vec2(1... | Assignment to swizzle produces unhelpful error message
Given the program:
```
fn f() {
var v = vec2(0);
v.xy = vec2(1);
}
```
Naga complains:
```
error: the left-hand side of an assignment must be a reference
┌─ assign-to-swizzle.wgsl:2:20
│
2 │ var v = vec2(0);
│ ╭────────────────... | We could bake in some detection for this case and add it as note to the diagnostic, it would look something like this:
```
error: the left-hand side of an assignment must be a reference
┌─ test.wgsl:3:4
│
3 │ v.xy = vec2(1);
│ ^^^^ expression is not a reference
│
= You seem to be trying to assig... | 2022-09-14T16:05:36Z | 0.9 | 2023-02-01T17:40:31Z | 4f8db997b0b1e73fc1e2cac070485333a5b61925 | [
"assign_to_expr",
"assign_to_let",
"binary_statement",
"swizzle_assignment"
] | [
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] |
gfx-rs/naga | 2,055 | gfx-rs__naga-2055 | [
"2053"
] | 1a99c1cf066de8d660904f1fb681f5647bc45205 | diff --git a/src/front/wgsl/lexer.rs b/src/front/wgsl/lexer.rs
--- a/src/front/wgsl/lexer.rs
+++ b/src/front/wgsl/lexer.rs
@@ -163,6 +163,8 @@ fn is_word_part(c: char) -> bool {
pub(super) struct Lexer<'a> {
input: &'a str,
pub(super) source: &'a str,
+ // The byte offset of the end of the last non-trivia... | diff --git a/tests/wgsl-errors.rs b/tests/wgsl-errors.rs
--- a/tests/wgsl-errors.rs
+++ b/tests/wgsl-errors.rs
@@ -640,11 +640,11 @@ fn reserved_keyword() {
r#"
var bool: bool = true;
"#,
- r###"error: name ` bool: bool = true;` is a reserved keyword
- ┌─ wgsl:2:16
+ r###"e... | Spans on expressions are bad
Given the input:
```
fn f() {
var v = vec2(0);
v.xy = vec2(1);
}
```
Naga produces the error message:
```
error: the left-hand side of an assignment must be a reference
┌─ assign-to-swizzle.wgsl:2:20
│
2 │ var v = vec2(0);
│ ╭───────────────────^
3 │ │... | 2022-09-14T02:11:09Z | 0.9 | 2022-09-15T07:19:20Z | 4f8db997b0b1e73fc1e2cac070485333a5b61925 | [
"module_scope_identifier_redefinition",
"reserved_keyword"
] | [
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 2,024 | gfx-rs__naga-2024 | [
"2021"
] | b209d911681c4ef563f7d9048623667743e6248f | diff --git a/src/front/mod.rs b/src/front/mod.rs
--- a/src/front/mod.rs
+++ b/src/front/mod.rs
@@ -14,6 +14,7 @@ pub mod wgsl;
use crate::{
arena::{Arena, Handle, UniqueArena},
proc::{ResolveContext, ResolveError, TypeResolution},
+ FastHashMap,
};
use std::ops;
diff --git a/src/front/mod.rs b/src/fro... | diff --git /dev/null b/tests/in/lexical-scopes.wgsl
new file mode 100644
--- /dev/null
+++ b/tests/in/lexical-scopes.wgsl
@@ -0,0 +1,58 @@
+fn blockLexicalScope(a: bool) {
+ let a = 1.0;
+ {
+ let a = 2;
+ {
+ let a = true;
+ }
+ let test = a == 3;
+ }
+ let test = a =... | [wgsl-in] let declarations from different scopes merged?
Shadowed let declarations can get incorrectly hoisted out of conditional scopes.
See example WGSL:
```
@vertex
fn main(@location(0) cond: f32) -> @location(0) f32 {
let value = 1.;
if cond > 0. {
let value = 2.;
return 3.;
}
... | 2022-08-07T03:59:14Z | 0.9 | 2022-09-03T15:30:55Z | 4f8db997b0b1e73fc1e2cac070485333a5b61925 | [
"convert_wgsl"
] | [
"arena::tests::fetch_or_append_unique",
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"front::glsl::constants::tests::cast",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::layout::test_physica... | [] | [] | |
gfx-rs/naga | 2,005 | gfx-rs__naga-2005 | [
"1782"
] | e7ddd3564c214d8acf554a03915d9bb179e0b772 | diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -69,7 +69,7 @@ validate-wgsl: $(SNAPSHOTS_BASE_OUT)/wgsl/*.wgsl
cargo run $${file}; \
done
-validate-hlsl-dxc: SHELL:=/bin/bash # required because config files uses arrays
+validate-hlsl-dxc: SHELL:=/usr/bin/env bash # required because config file... | diff --git a/tests/in/push-constants.param.ron b/tests/in/push-constants.param.ron
--- a/tests/in/push-constants.param.ron
+++ b/tests/in/push-constants.param.ron
@@ -8,4 +8,11 @@
writer_flags: (bits: 0),
binding_map: {},
),
+ hlsl: (
+ shader_model: V5_1,
+ binding_map: {},
+ fake_missing_bindings: true,
+ ... | [hlsl-out] Implement push constants
Tracking issue for implementing push constants for the HLSL backend
https://github.com/gfx-rs/naga/blob/f90e563c281cfc71c794e0426ebcced9e3999202/src/back/hlsl/writer.rs#L583
| 2022-07-11T01:36:08Z | 0.9 | 2022-08-29T10:58:03Z | 4f8db997b0b1e73fc1e2cac070485333a5b61925 | [
"convert_wgsl"
] | [
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::writer:... | [] | [] | |
gfx-rs/naga | 1,993 | gfx-rs__naga-1993 | [
"1831"
] | ea832a9eec13560560c017072d4318d5d942e5e5 | diff --git a/src/back/dot/mod.rs b/src/back/dot/mod.rs
--- a/src/back/dot/mod.rs
+++ b/src/back/dot/mod.rs
@@ -81,11 +81,15 @@ impl StatementGraph {
S::Loop {
ref body,
ref continuing,
+ break_if,
} => {
... | diff --git /dev/null b/tests/in/break-if.wgsl
new file mode 100644
--- /dev/null
+++ b/tests/in/break-if.wgsl
@@ -0,0 +1,32 @@
+@compute @workgroup_size(1)
+fn main() {}
+
+fn breakIfEmpty() {
+ loop {
+ continuing {
+ break if true;
+ }
+ }
+}
+
+fn breakIfEmptyBody(a: bool) {
+ loop ... | [wgsl-in] Add break-if as optional at end of continuing
Spec PR: https://github.com/gpuweb/gpuweb/pull/2618
| 2022-06-17T23:05:15Z | 0.8 | 2022-06-25T00:47:08Z | ea832a9eec13560560c017072d4318d5d942e5e5 | [
"convert_wgsl",
"break_if_bad_condition",
"misplaced_break_if"
] | [
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::msl::test_error_size",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::writer:... | [] | [] | |
gfx-rs/naga | 1,917 | gfx-rs__naga-1917 | [
"1896"
] | ab2806e05fbd69a502b4b25a85f99ae4d3e82278 | diff --git a/src/front/wgsl/construction.rs b/src/front/wgsl/construction.rs
--- a/src/front/wgsl/construction.rs
+++ b/src/front/wgsl/construction.rs
@@ -184,12 +184,15 @@ fn parse_constructor_type<'a>(
Ok(Some(ConstructorType::Vector { size, kind, width }))
}
(Token::Paren('<'), Constru... | diff --git a/tests/wgsl-errors.rs b/tests/wgsl-errors.rs
--- a/tests/wgsl-errors.rs
+++ b/tests/wgsl-errors.rs
@@ -810,6 +810,39 @@ fn module_scope_identifier_redefinition() {
);
}
+#[test]
+fn matrix_with_bad_type() {
+ check(
+ r#"
+ fn main() {
+ let m = mat2x2<i32>();
+ ... | [wgsl-in] Error on matrices with non float scalar kinds
The following works (on naga master cf32c2b):
````wgsl
@group(0) @binding(0)
var<storage, write> output_0: vec3<f32>;
@compute @workgroup_size(1)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
let zero: f32 = 0.0;
let zero_vec = vec3<f... | According to the latest version of the WGSL spec only floating point matrices are allowed.
See https://gpuweb.github.io/gpuweb/wgsl/#matrix-types
OK, thanks, that makes sense (I guess there's probably some platform that doesn't support it and WGSL therefore restricts to floats).
I would then suggest to improve t... | 2022-05-14T10:47:25Z | 0.8 | 2022-05-14T15:00:16Z | ea832a9eec13560560c017072d4318d5d942e5e5 | [
"matrix_with_bad_type"
] | [
"back::msl::test_error_size",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] |
gfx-rs/naga | 1,790 | gfx-rs__naga-1790 | [
"1774"
] | 012f2a6b2e9328e93939429705fdf9102d9f69b7 | diff --git /dev/null b/src/front/wgsl/construction.rs
new file mode 100644
--- /dev/null
+++ b/src/front/wgsl/construction.rs
@@ -0,0 +1,649 @@
+use crate::{
+ proc::TypeResolution, Arena, ArraySize, Bytes, Constant, ConstantInner, Expression, Handle,
+ ScalarKind, ScalarValue, Span as NagaSpan, Type, TypeInner, ... | diff --git a/tests/in/operators.wgsl b/tests/in/operators.wgsl
--- a/tests/in/operators.wgsl
+++ b/tests/in/operators.wgsl
@@ -58,6 +58,21 @@ fn constructors() -> f32 {
0.0, 0.0, 0.0, 1.0,
);
+ // zero value constructors
+ var _ = bool();
+ var _ = i32();
+ var _ = u32();
+ var _ = f32();... | WGSL constructor doesn't check length
The following code produces an error message that was unhelpful
```
@stage(vertex)
fn passthrough(@location(0) pos: vec2<f32>) -> @builtin(position) vec4<f32> {
return vec4<f32>(pos);
}
```
The error is:
```
[2022-03-13T21:53:32Z ERROR naga::valid::function] Retu... | 2022-03-27T00:38:42Z | 0.8 | 2022-03-30T08:34:25Z | ea832a9eec13560560c017072d4318d5d942e5e5 | [
"convert_wgsl",
"bad_type_cast",
"constructor_parameter_type_mismatch",
"type_not_constructible",
"unexpected_constructor_parameters",
"type_not_inferrable"
] | [
"arena::tests::append_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constants::tests::cast",
"back::spv::layout::test_physical_... | [] | [] | |
gfx-rs/naga | 1,787 | gfx-rs__naga-1787 | [
"1721"
] | 05f050fad485763bf7bf6e1ad4206007b52bc345 | diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs
--- a/src/front/wgsl/mod.rs
+++ b/src/front/wgsl/mod.rs
@@ -3743,6 +3743,40 @@ impl Parser {
Some(crate::Statement::Loop { body, continuing })
}
+ "while" => {
+ let _ = l... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -262,6 +262,32 @@ fn parse_loop() {
",
)
.unwrap();
+ parse_str(
+ "
+ fn main() {
+ var found: bool = false;
+ var i: i32 = 0;
+ ... | While loop in WGSL
See https://github.com/gpuweb/gpuweb/pull/2590
| 2022-03-22T18:25:33Z | 0.8 | 2022-03-23T09:44:47Z | ea832a9eec13560560c017072d4318d5d942e5e5 | [
"front::wgsl::tests::parse_loop",
"convert_wgsl"
] | [
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"arena::tests::append_non_unique",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::test_physical_layout_in_words",
"front::glsl::constan... | [] | [] | |
gfx-rs/naga | 1,725 | gfx-rs__naga-1725 | [
"1720"
] | d40522329bd74bf49df05a80dd95d8712ea93b99 | diff --git a/src/back/wgsl/writer.rs b/src/back/wgsl/writer.rs
--- a/src/back/wgsl/writer.rs
+++ b/src/back/wgsl/writer.rs
@@ -691,9 +691,9 @@ impl<W: Write> Writer<W> {
ref reject,
} => {
write!(self.out, "{}", level)?;
- write!(self.out, "if (")?;
+ ... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -206,6 +206,26 @@ fn parse_statement() {
#[test]
fn parse_if() {
+ parse_str(
+ "
+ fn main() {
+ if true {
+ discard;
+ } else {}
+ ... | Remove parenthesis from conditional statements
https://github.com/gpuweb/gpuweb/pull/2585
| 2022-02-15T18:12:11Z | 0.8 | 2022-02-15T18:05:06Z | ea832a9eec13560560c017072d4318d5d942e5e5 | [
"front::wgsl::tests::parse_parentheses_switch",
"front::wgsl::tests::parse_if",
"front::wgsl::tests::parse_loop",
"convert_wgsl"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constan... | [] | [] | |
gfx-rs/naga | 1,675 | gfx-rs__naga-1675 | [
"1582"
] | 76814a83a20391b690ecf4e4a455d8a5768ac3be | diff --git a/src/front/wgsl/lexer.rs b/src/front/wgsl/lexer.rs
--- a/src/front/wgsl/lexer.rs
+++ b/src/front/wgsl/lexer.rs
@@ -356,9 +356,47 @@ fn consume_token(mut input: &str, generic: bool) -> (Token<'_>, &str) {
(Token::UnterminatedString, quote_content)
}
}
- '/' if ch... | diff --git a/src/front/wgsl/lexer.rs b/src/front/wgsl/lexer.rs
--- a/src/front/wgsl/lexer.rs
+++ b/src/front/wgsl/lexer.rs
@@ -673,6 +711,14 @@ fn test_tokens() {
sub_test("No好", &[Token::Word("No"), Token::Unknown('好')]);
sub_test("_No", &[Token::Word("_No")]);
sub_test("\"\u{2}ПЀ\u{0}\"", &[Token::Stri... | error occurs in validating the block comment in WGSL
WGSL allows the block comment, and it works fine in WebGPU apps. Here is an example of using block (or multi-line) comment from the official WGSL site (https://www.w3.org/TR/WGSL/#comments):
EXAMPLE: COMMENTS
let f = 1.5; // This is line-ending comment.
let g... | We need to implement block comments in WGSL. | 2022-01-19T22:45:35Z | 0.8 | 2022-01-19T19:48:05Z | ea832a9eec13560560c017072d4318d5d942e5e5 | [
"front::wgsl::lexer::test_tokens"
] | [
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] |
gfx-rs/naga | 1,663 | gfx-rs__naga-1663 | [
"1642"
] | 894530e5b4814e08ec38afc674ffd558eeaedde4 | diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,5 @@ Cargo.lock
/*.frag
/*.comp
/*.wgsl
+/*.hlsl
+/*.txt
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Change Log
+### v0.8.2 (2022-01-11)
+ - validator:
+ - check structure ... | diff --git a/tests/in/image.wgsl b/tests/in/image.wgsl
--- a/tests/in/image.wgsl
+++ b/tests/in/image.wgsl
@@ -10,6 +10,8 @@ var image_storage_src: texture_storage_2d<rgba8uint, read>;
var image_array_src: texture_2d_array<u32>;
[[group(0), binding(6)]]
var image_dup_src: texture_storage_1d<r32uint,read>; // for #13... | Naga generates bad MSL for `textureLoad` access on 1d textures
Naga compiles the following WGSL input to Metal Shading Language that does not validate:
```
// Load a texel from a 1d texture.
[[group(0), binding(0)]]
var tex: texture_1d<u32>;
[[stage(compute), workgroup_size(16)]]
fn main(
[[builtin(local... | The same problem arises with WGSL's `textureDimensions`: it accepts a `level` argument, but MSL requires that it be a constexpr equal to zero. | 2022-01-12T11:46:14Z | 0.8 | 2022-01-12T03:52:06Z | ea832a9eec13560560c017072d4318d5d942e5e5 | [
"let_type_mismatch",
"var_type_mismatch"
] | [
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] |
gfx-rs/naga | 1,658 | gfx-rs__naga-1658 | [
"1655"
] | 70b5ddaaad46b68ffb4e298b1d10d920544d3ca0 | diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,5 @@ Cargo.lock
/*.frag
/*.comp
/*.wgsl
+/*.hlsl
+/*.txt
diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs
--- a/src/front/wgsl/mod.rs
+++ b/src/front/wgsl/mod.rs
@@ -164,7 +164,7 @@ pub enum Error<'a> {
ZeroSizeOrAlign... | diff --git a/tests/wgsl-errors.rs b/tests/wgsl-errors.rs
--- a/tests/wgsl-errors.rs
+++ b/tests/wgsl-errors.rs
@@ -461,28 +461,56 @@ fn let_type_mismatch() {
r#"
let x: i32 = 1.0;
"#,
- r#"error: the type of `x` is expected to be [1]
+ r#"error: the type of `x` is expected t... | Confusing error messages on type mismatch
Consider the following wgsl code:
```
[[stage(compute), workgroup_size(1)]]
fn main() {
var x: u32 = 0;
}
```
Attempting to evaluate it leads to a naga output of:
```
ERROR naga::front::wgsl] Given type Scalar { kind: Uint, width: 4 } doesn't match expected Scalar ... | 2022-01-10T21:10:57Z | 0.8 | 2022-01-12T03:53:58Z | ea832a9eec13560560c017072d4318d5d942e5e5 | [
"let_type_mismatch",
"var_type_mismatch"
] | [
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::append_non_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 1,402 | gfx-rs__naga-1402 | [
"1019"
] | dc8a41de04068b4766c1e74f9d77f765e815172a | diff --git a/src/valid/function.rs b/src/valid/function.rs
--- a/src/valid/function.rs
+++ b/src/valid/function.rs
@@ -135,6 +135,11 @@ bitflags::bitflags! {
}
}
+struct BlockInfo {
+ stages: ShaderStages,
+ finished: bool,
+}
+
struct BlockContext<'a> {
abilities: ControlFlowAbility,
info: &'a... | diff --git a/tests/wgsl-errors.rs b/tests/wgsl-errors.rs
--- a/tests/wgsl-errors.rs
+++ b/tests/wgsl-errors.rs
@@ -848,3 +848,34 @@ fn invalid_local_vars() {
if local_var_name == "not_okay"
}
}
+
+#[test]
+fn dead_code() {
+ check_validation_error! {
+ "
+ fn dead_code_after_if(condition... | Naga doesn't detect unreachable code
The following test, if added to `wgsl-errors.rs`, should fail, but it passes:
```
check_validation_error! {
"
fn dead_code_after_if(condition: bool) -> i32 {
if (condition) {
return 1;
} else {
return 2;
}
r... | 2021-09-20T23:46:59Z | 0.6 | 2021-09-24T14:11:33Z | 2e7d629aefe6857ade4f96fe2c3dc1a09f0fa4db | [
"dead_code"
] | [
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constan... | [] | [] | |
gfx-rs/naga | 1,390 | gfx-rs__naga-1390 | [
"1386"
] | d7ca7d43b987c17f553db2823d833646ff1d48e0 | diff --git a/src/front/wgsl/lexer.rs b/src/front/wgsl/lexer.rs
--- a/src/front/wgsl/lexer.rs
+++ b/src/front/wgsl/lexer.rs
@@ -336,7 +336,7 @@ fn consume_token(mut input: &str, generic: bool) -> (Token<'_>, &str) {
}
}
'0'..='9' => consume_number(input),
- 'a'..='z' | 'A'..='Z' | '... | diff --git a/src/front/wgsl/lexer.rs b/src/front/wgsl/lexer.rs
--- a/src/front/wgsl/lexer.rs
+++ b/src/front/wgsl/lexer.rs
@@ -655,6 +655,7 @@ fn test_tokens() {
);
sub_test("No¾", &[Token::Word("No"), Token::Unknown('¾')]);
sub_test("No好", &[Token::Word("No"), Token::Unknown('好')]);
+ sub_test("_No",... | naga should reject identifiers beginning with underscore
This should fail compilation. But Naga allows it.
```
let _123 = 123;
```
| 2021-09-18T04:35:00Z | 0.6 | 2021-09-24T14:12:35Z | 2e7d629aefe6857ade4f96fe2c3dc1a09f0fa4db | [
"front::wgsl::lexer::test_tokens"
] | [
"back::msl::test_error_size",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constan... | [] | [] | |
gfx-rs/naga | 1,384 | gfx-rs__naga-1384 | [
"1382"
] | 73f9d072079246ccf119c4e27de2b624afa6e466 | diff --git a/src/back/wgsl/writer.rs b/src/back/wgsl/writer.rs
--- a/src/back/wgsl/writer.rs
+++ b/src/back/wgsl/writer.rs
@@ -51,56 +51,6 @@ enum Indirection {
Reference,
}
-/// Return the sort of indirection that `expr`'s plain form evaluates to.
-///
-/// An expression's 'plain form' is the most general rend... | diff --git /dev/null b/tests/in/pointers.param.ron
new file mode 100644
--- /dev/null
+++ b/tests/in/pointers.param.ron
@@ -0,0 +1,7 @@
+(
+ spv: (
+ version: (1, 2),
+ debug: true,
+ adjust_coordinate_space: false,
+ ),
+)
diff --git /dev/null b/tests/in/pointers.wgsl
new file mode 100644
--- /dev/null
+++ b/tests/... | Naga produces incorrect WGSL for let-bound pointers
The following WGSL input generates incorrect WGSL output:
```
fn f() {
var v: vec2<i32>;
let px = &v.x;
*px = 10;
}
```
The output omits the `*`:
```
fn f() {
var v: vec2<i32>;
let px: ptr<function, i32> = (&v.x);
px = 10;
... | 2021-09-17T09:50:57Z | 0.6 | 2021-09-28T17:03:01Z | 2e7d629aefe6857ade4f96fe2c3dc1a09f0fa4db | [
"convert_wgsl",
"pointer_type_equivalence"
] | [
"arena::tests::fetch_or_append_unique",
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constan... | [] | [] | |
gfx-rs/naga | 1,367 | gfx-rs__naga-1367 | [
"1356"
] | 933ecc4a443cb882bce0283fe77897bba6007080 | diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs
--- a/src/front/wgsl/mod.rs
+++ b/src/front/wgsl/mod.rs
@@ -165,9 +165,9 @@ pub enum Error<'a> {
MissingType(Span),
InvalidAtomicPointer(Span),
InvalidAtomicOperandType(Span),
+ Pointer(&'static str, Span),
NotPointer(Span),
- AddressO... | diff --git a/tests/wgsl-errors.rs b/tests/wgsl-errors.rs
--- a/tests/wgsl-errors.rs
+++ b/tests/wgsl-errors.rs
@@ -493,6 +493,44 @@ fn local_var_missing_type() {
);
}
+#[test]
+fn postfix_pointers() {
+ check(
+ r#"
+ fn main() {
+ var v: vec4<f32> = vec4<f32>(1.0, 1.0, 1.0, ... | [wgsl-in] Missing parentheses around dereference
https://github.com/gfx-rs/naga/pull/1348 fixed this for wgsl-out, but the following still incorrectly validates:
```
[[stage(vertex)]]
fn main() -> [[builtin(position)]] vec4<f32> {
var v: vec4<f32> = vec4<f32>(1.0, 1.0, 1.0, 1.0);
let pv = &v;
let a ... | I've reproduced this. Indeed, `*pv[3]` parenthesizes as `*(pv[3])`, which is ill-typed.
Naga's WGSL front end doesn't follow the grammar in the spec very closely, so I think there are a number of problems along these lines. See also #1352.
This was not fixed by #1360. The [approach](https://github.com/gfx-rs/naga/bl... | 2021-09-15T11:04:10Z | 0.6 | 2021-09-15T22:52:26Z | 2e7d629aefe6857ade4f96fe2c3dc1a09f0fa4db | [
"postfix_pointers",
"valid_access"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] |
gfx-rs/naga | 1,304 | gfx-rs__naga-1304 | [
"1017"
] | 28547e3d3b61a7872cdba66638f0bae17154f031 | diff --git a/src/back/spv/block.rs b/src/back/spv/block.rs
--- a/src/back/spv/block.rs
+++ b/src/back/spv/block.rs
@@ -1013,6 +1013,11 @@ impl<'w> BlockContext<'w> {
Instruction::switch(selector_id, default_id, &raw_cases),
);
+ let inner_context = Loop... | diff --git a/tests/in/control-flow.wgsl b/tests/in/control-flow.wgsl
--- a/tests/in/control-flow.wgsl
+++ b/tests/in/control-flow.wgsl
@@ -30,3 +30,30 @@ fn main([[builtin(global_invocation_id)]] global_id: vec3<u32>) {
}
}
}
+
+fn switch_default_break(i: i32) {
+ switch (i) {
+ default: {
+ break;
+ ... | Naga panics translating valid WGSL to SPIR-V
This may be a duplicate, but filing it just in case: The following WGSL program passes validation, but panics in `back/spv/writer.rs`:
```
fn loop_switch_continue(x: i32) {
loop {
switch (x) {
case 1: {
continue;
}
... | I think it'll be a challenge to generate SPIR-V for this. SPIR-V §2.11, "Structured Control Flow", includes this rule:
> each header block must strictly dominate its merge block, unless the merge block is unreachable in the CFG
Control flow in shaders is required to be structured, which means that the WGSL `switc... | 2021-08-28T06:46:03Z | 0.6 | 2021-09-01T21:55:46Z | 2e7d629aefe6857ade4f96fe2c3dc1a09f0fa4db | [
"convert_wgsl"
] | [
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_unique",
"front::glsl::parser_tests::constants",
"front::glsl::constants::tests::cast",
"front::glsl::parser_tests::control_flow",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"front::glsl::parser_tests::de... | [] | [] |
gfx-rs/naga | 1,292 | gfx-rs__naga-1292 | [
"1266"
] | 7a45d73465d90a11fbfdb6892f5a15c050c6d3bb | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
# Change Log
+## v0.6.1 (2021-08-24)
+ - HLSL-out fixes:
+ - array arguments
+ - pointers to array arguments
+ - switch statement
+ - rewritten interface matching
+ - SPV-in fixes:
+ - array storage textu... | diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- rust: [1.43.0, nightly]
+ rust: ["1.43.0", nightly]
steps:
- ... | [glsl-out] Operands to "%" must be integral
### Example:
This valid glsl:
```glsl
float out = mod(1.0,1.0);
```
Translates to this wgls
```rs
let out: f32 = 1.0 % 1.0;
```
And this wgls translates to this glsl:
```glsl
float out = 1.0 % 1.0;
```
The resulting shader does not work.
When run with wgpu it ... | 2021-08-25T06:12:39Z | 0.6 | 2021-08-24T22:17:23Z | 2e7d629aefe6857ade4f96fe2c3dc1a09f0fa4db | [
"convert_wgsl"
] | [
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"front::glsl::parser_tests::declarations",
"front::glsl::constants::tests::unary_op",
"back::spv::layout::test_physical_layout_in_words",
"front::glsl::... | [] | [] | |
gfx-rs/naga | 1,265 | gfx-rs__naga-1265 | [
"1261"
] | 70be72d9b9615557fa8726829813755ee6b52279 | diff --git a/src/back/glsl/mod.rs b/src/back/glsl/mod.rs
--- a/src/back/glsl/mod.rs
+++ b/src/back/glsl/mod.rs
@@ -1441,11 +1441,6 @@ impl<'a, W: Write> Writer<'a, W> {
for sta in case.body.iter() {
self.write_stmt(sta, ctx, indent + 2)?;
}
-
- ... | diff --git a/tests/in/control-flow.wgsl b/tests/in/control-flow.wgsl
--- a/tests/in/control-flow.wgsl
+++ b/tests/in/control-flow.wgsl
@@ -3,4 +3,30 @@ fn main([[builtin(global_invocation_id)]] global_id: vec3<u32>) {
//TODO: execution-only barrier?
storageBarrier();
workgroupBarrier();
+
+ var pos: i32;
+ // swi... | [hlsl-out] Unimplemented Switch
One of the shaders that is in my dependency tree ([wgpu_glyph shader](https://github.com/hecrj/wgpu_glyph/blob/master/src/shader/glyph.wgsl)) uses a switch statement, which causes a panic because of unimplemented switch writer in hlsl. It's especially problematic because DX12 is the defa... | 2021-08-21T04:39:34Z | 0.6 | 2021-08-24T22:15:33Z | 2e7d629aefe6857ade4f96fe2c3dc1a09f0fa4db | [
"convert_wgsl"
] | [
"back::msl::test_error_size",
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"arena::tests::fetch_or_append_unique",
"front::glsl::constants::tests::access",
"back::spv::writer::test_writ... | [] | [] | |
gfx-rs/naga | 1,249 | gfx-rs__naga-1249 | [
"1237"
] | fc47008d0c01fd1658626f6ed7fa4a7a695da3be | diff --git a/src/front/glsl/ast.rs b/src/front/glsl/ast.rs
--- a/src/front/glsl/ast.rs
+++ b/src/front/glsl/ast.rs
@@ -1,6 +1,6 @@
use std::fmt;
-use super::{builtins::MacroCall, SourceMetadata};
+use super::{builtins::MacroCall, context::ExprPos, SourceMetadata};
use crate::{
BinaryOperator, Binding, Constant... | diff --git a/src/front/glsl/parser_tests.rs b/src/front/glsl/parser_tests.rs
--- a/src/front/glsl/parser_tests.rs
+++ b/src/front/glsl/parser_tests.rs
@@ -812,4 +812,19 @@ fn expressions() {
"#,
)
.unwrap();
+
+ // Dynamic indexing of array
+ parser
+ .parse(
+ &Option... | [glsl-in] cannot index into const array
The following:
```glsl
#version 450
void main() {
const vec2 positions[3] = {
vec2(0, 0.5),
vec2(-0.5, -0.5),
vec2(0.5, -0.5)
};
gl_Position = vec4(positions[gl_VertexIndex], 0, 1);
}
```
produces the error (naga 0.6.0):
... | 2021-08-20T05:16:22Z | 0.6 | 2021-08-19T23:59:48Z | 2e7d629aefe6857ade4f96fe2c3dc1a09f0fa4db | [
"front::glsl::parser_tests::expressions"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_unique",
"front::glsl::parser_tests::declarations",
"back::spv::writer::test_write_physical_layout",
"front::glsl::parser_tests::fu... | [] | [] | |
gfx-rs/naga | 546 | gfx-rs__naga-546 | [
"542"
] | 50e5904addf8d5e1d486a26a0464914d978d5d1b | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,6 +22,7 @@ thiserror = "1.0.21"
serde = { version = "1.0", features = ["derive"], optional = true }
petgraph = { version ="0.5", optional = true }
pp-rs = { git = "https://github.com/Kangz/glslpp-rs", rev = "4f2f72a", optional = true }
+#e... | diff --git a/tests/out/boids.msl.snap b/tests/out/boids.msl.snap
--- a/tests/out/boids.msl.snap
+++ b/tests/out/boids.msl.snap
@@ -36,8 +36,6 @@ typedef metal::uint3 type4;
typedef int type5;
-typedef bool type6;
-
constexpr constant int NUM_PARTICLES = 1500;
constexpr constant float const_0f = 0.0;
constexpr c... | Real SSA based on pointer semantics for variables
Right now, the `LocalVariable` and `GlobalVariable` aren't really pointers. They are "transparent" values, they materialize only when `Load` is issued. This harms the type checking, which isn't able to properly assess the `Access` and `AccessIndex` semantics. It will be... | So far I've tried different approaches to this and haven't found one that would fit:
1. Just plain consider the non-`Handle` variables to be pointers. Main blocker is the type resolution for `Access*`: when on matrices or vectors, if behind pointers, it needs to generate the pointers to their components. So it would... | 2021-03-05T23:21:52Z | 0.3 | 2021-03-06T16:01:17Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_wgsl_texture_array",
"convert_wgsl_shadow",
"convert_wgsl_boids",
"convert_wgsl_skybox",
"convert_wgsl_collatz"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constants::tests::cast",
"back::spv::... | [] | [] |
gfx-rs/naga | 528 | gfx-rs__naga-528 | [
"474"
] | 04b1f44396604b4038606b83014423e309bc215c | diff --git a/src/arena.rs b/src/arena.rs
--- a/src/arena.rs
+++ b/src/arena.rs
@@ -1,11 +1,11 @@
-use std::{cmp::Ordering, fmt, hash, marker::PhantomData, num::NonZeroU32};
+use std::{cmp::Ordering, fmt, hash, marker::PhantomData, num::NonZeroU32, ops};
/// An unique index in the arena array that a handle points to.... | diff --git a/tests/out/boids.spvasm.snap b/tests/out/boids.spvasm.snap
--- a/tests/out/boids.spvasm.snap
+++ b/tests/out/boids.spvasm.snap
@@ -5,64 +5,64 @@ expression: dis
; SPIR-V
; Version: 1.0
; Generator: rspirv
-; Bound: 286
+; Bound: 233
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel... | [glsl-out]: bake frequently used expressions
Uses the results of analysis to bake frequently used expressions and avoid exponential explosions when writing
| Will need to be rebased on #472 when merged | 2021-02-27T10:45:14Z | 0.3 | 2021-03-03T21:57:33Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_wgsl_texture_array",
"convert_wgsl_empty",
"convert_wgsl_shadow",
"convert_wgsl_quad",
"convert_wgsl_boids",
"convert_wgsl_skybox",
"convert_wgsl_collatz",
"convert_spv_shadow"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"arena::tests::fetch_or_append_unique",
"back::spv::writer::test_writer_generate_id",
"fron... | [] | [] |
gfx-rs/naga | 429 | gfx-rs__naga-429 | [
"362"
] | 708751a8053019cb737ec256dd143f10c4370db9 | diff --git a/src/front/glsl/ast.rs b/src/front/glsl/ast.rs
--- a/src/front/glsl/ast.rs
+++ b/src/front/glsl/ast.rs
@@ -245,3 +245,9 @@ pub enum StorageQualifier {
StorageClass(StorageClass),
Const,
}
+
+#[derive(Debug, Clone)]
+pub enum StructLayout {
+ Binding(Binding),
+ PushConstant,
+}
diff --git a... | diff --git a/tests/snapshots.rs b/tests/snapshots.rs
--- a/tests/snapshots.rs
+++ b/tests/snapshots.rs
@@ -188,3 +188,9 @@ fn convert_wgsl_collatz() {
fn convert_wgsl_shadow() {
convert_wgsl("shadow", Language::METAL | Language::SPIRV);
}
+
+#[cfg(feature = "wgsl-in")]
+#[test]
+fn convert_wgsl_texture_array() {... | Push constants support
These are not a part of WebGPU upstream, but useful for webgpu-native as well as regular SPIR-V related use cases.
See also - https://github.com/gfx-rs/wgpu/issues/1162
| 2021-02-07T10:04:30Z | 0.3 | 2021-02-07T17:55:53Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_wgsl_texture_array"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::layout_tests::test_instruction_add_operands",
"back::spv::layout_tests::test_instruction_add_operand",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout_tests::test_instruct... | [] | [] | |
gfx-rs/naga | 421 | gfx-rs__naga-421 | [
"420"
] | f9f41fc9bf27ecca091e492892538afcdacd1419 | diff --git a/src/arena.rs b/src/arena.rs
--- a/src/arena.rs
+++ b/src/arena.rs
@@ -126,6 +126,16 @@ impl<T> Arena<T> {
})
}
+ /// Returns a iterator over the items stored in this arena,
+ /// returning both the item's handle and a mutable reference to it.
+ pub fn iter_mut(&mut self) -> impl Do... | diff --git a/src/back/spv/writer.rs b/src/back/spv/writer.rs
--- a/src/back/spv/writer.rs
+++ b/src/back/spv/writer.rs
@@ -2113,9 +2124,9 @@ mod tests {
fn test_writer_generate_id() {
let mut writer = create_writer();
- assert_eq!(writer.id_count, 0);
+ assert_eq!(writer.id_count, 2);
... | Turn function calls into statements
This would fix #416 naturally.
| 2021-02-05T23:56:01Z | 0.3 | 2021-02-06T15:42:58Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"back::spv::writer::tests::test_write_physical_layout",
"back::spv::writer::tests::test_writer_generate_id",
"convert_wgsl_collatz",
"convert_wgsl_empty",
"convert_wgsl_shadow",
"convert_wgsl_boids",
"convert_wgsl_quad",
"convert_wgsl_skybox"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::layout_tests::test_instruction_add_operand",
"back::spv::layout_tests::test_instruction_set_result",
"back::spv::layout_tests::test_instructio... | [] | [] | |
gfx-rs/naga | 417 | gfx-rs__naga-417 | [
"412"
] | c496c05ba413af699c1d2621ce741d45ab04d499 | diff --git a/src/back/glsl/mod.rs b/src/back/glsl/mod.rs
--- a/src/back/glsl/mod.rs
+++ b/src/back/glsl/mod.rs
@@ -1338,6 +1338,74 @@ impl<'a, W: Write> Writer<'a, W> {
}
write!(self.out, ")")?;
}
+ // Query translates into one of the:
+ // - textureS... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -155,7 +155,7 @@ fn parse_texture_load() {
"
var t: texture_multisampled_2d_array<i32>;
fn foo() {
- const r: vec4<i32> = textureLoad(t, vec2<i32>(10, 20), 2, 3... | Image queries
Getting the size, LOD count, sample counts of images.
| 2021-02-05T15:06:03Z | 0.3 | 2021-02-05T20:26:49Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"front::wgsl::tests::parse_texture_query"
] | [
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout_tests::test_instruction_set_type",
"back::spv::layout_tests::test_instruction_set_result_twice",
"back::spv::layout_tests::test_instruc... | [] | [] | |
gfx-rs/naga | 377 | gfx-rs__naga-377 | [
"367"
] | 292304b66f27c7f07b855c929bdf671c14dd904d | diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs
--- a/src/front/wgsl/mod.rs
+++ b/src/front/wgsl/mod.rs
@@ -265,24 +265,31 @@ enum Composition {
}
impl Composition {
+ //TODO: could be `const fn` once MSRV allows
+ fn letter_pos(letter: char) -> u32 {
+ match letter {
+ 'x' | 'r' ... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -150,5 +150,7 @@ fn parse_texture_load() {
#[test]
fn parse_postfix() {
+ parse_str("fn foo() { const x: f32 = vec4<f32>(1.0, 2.0, 3.0, 4.0).xyz.rgbr.aaaa.wz.g; }")
+ .unwrap();
... | Accessor rgba doesn't work
` ParseError { error: BadAccessor("r"), scopes: [FunctionDecl, Block, Statement, GeneralExpr, SingularExpr], pos: (36, 32) }'`
It seems it is supposed to according to the specs.
```wgsl
fn main() {
var test: vec2<f32> = vec2<f32>(1.0, 1.0);
out_target = vec4<f32>( test.r, 1.0... | 2021-01-27T05:55:16Z | 0.2 | 2021-01-26T22:04:17Z | 292304b66f27c7f07b855c929bdf671c14dd904d | [
"front::wgsl::tests::parse_postfix"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::layout_tests::test_instruction_add_operand",
"back::spv::layout_tests::test_instruction_set_result",
"back::spv::layout_tests::test_instructio... | [] | [] | |
gfx-rs/naga | 376 | gfx-rs__naga-376 | [
"368"
] | 986550aff8767fe541fb9e2fc3a7e01e16f1dc21 | diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs
--- a/src/front/wgsl/mod.rs
+++ b/src/front/wgsl/mod.rs
@@ -947,12 +947,13 @@ impl Parser {
Some(expr) => ctx.expressions.append(expr),
None => {
*lexer = backup;
- let handle = self.parse_primary_expres... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -147,3 +147,8 @@ fn parse_texture_load() {
)
.unwrap();
}
+
+#[test]
+fn parse_postfix() {
+ parse_str("fn foo() { const x: f32 = fract(vec2<f32>(0.5, 1.0)).x; }").unwrap();
+}
| Cannot swizzle the return value of a function
I couldn't swizzle function return values such as `textureSample( ... ).x`
`ParseError { error: Unexpected(Separator('.')), scopes: [FunctionDecl, Block, Statement], pos: (34, 86) }',`
```wgsl
[[stage(fragment)]]
fn main() {
var test: vec2<f32> = vec2<f32>(1.0... | 2021-01-27T05:40:56Z | 0.2 | 2021-01-26T21:44:23Z | 292304b66f27c7f07b855c929bdf671c14dd904d | [
"front::wgsl::tests::parse_postfix"
] | [
"arena::tests::append_unique",
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::layout_tests::test_instruction_add_operand",
"back::spv::layout_tests::test_instruction_add_operands",
"back::spv::layout_tests::test_instruct... | [] | [] | |
gfx-rs/naga | 187 | gfx-rs__naga-187 | [
"100"
] | 0129aa2ca699070497e7d0c6c749fc872e395623 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -34,5 +34,5 @@ wgsl-in = []
[dev-dependencies]
difference = "2.0"
env_logger = "0.6"
-ron = "0.5"
+ron = "0.6"
serde = { version = "1.0", features = ["derive"] }
diff --git a/examples/convert.rs b/examples/convert.rs
--- a/examples/convert.rs... | diff --git a/src/front/spv/mod.rs b/src/front/spv/mod.rs
--- a/src/front/spv/mod.rs
+++ b/src/front/spv/mod.rs
@@ -15,6 +15,8 @@ mod convert;
mod error;
mod flow;
mod function;
+#[cfg(test)]
+mod rosetta;
use convert::*;
use error::Error;
diff --git /dev/null b/src/front/spv/rosetta.rs
new file mode 100644
--- /... | Don't use pointers for accessing global variables
In spir-v any access to variables is done via load/stores in pointers. In WGSL that pointer step is skipped.
I think we should change the SPIR-V front-end to ignore the indirection, and write the IR validation accordingly (#59).
| 2020-09-11T04:27:23Z | 0.2 | 2020-09-11T19:24:43Z | 292304b66f27c7f07b855c929bdf671c14dd904d | [
"convert_cube"
] | [
"arena::tests::append_non_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"back::spv::instructions::tests::test_instruction_capability",
"back::spv::instructions::tests::test_instruction_constant",
"back::spv::instructions::test... | [] | [] | |
gfx-rs/naga | 817 | gfx-rs__naga-817 | [
"583"
] | bb7ebed23a0cdd3cf7d62b927f3a4483f90d82d2 | diff --git a/src/back/dot/mod.rs b/src/back/dot/mod.rs
--- a/src/back/dot/mod.rs
+++ b/src/back/dot/mod.rs
@@ -42,6 +42,7 @@ impl StatementGraph {
S::Break => "Break", //TODO: loop context
S::Continue => "Continue", //TODO: loop context
S::Kill => "Kill", ... | diff --git /dev/null b/tests/in/control-flow.param.ron
new file mode 100644
--- /dev/null
+++ b/tests/in/control-flow.param.ron
@@ -0,0 +1,7 @@
+(
+ spv_version: (1, 1),
+ spv_capabilities: [ Shader ],
+ spv_debug: false,
+ spv_adjust_coordinate_space: false,
+ msl_custom: false,
+)
diff --git /dev/null b/tests/in/cont... | Control barriers
Upstream - https://github.com/gpuweb/gpuweb/issues/1374
Example - https://github.com/gfx-rs/wgpu/issues/1264
> thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnsupportedInstruction(Function, ControlBarrier)', bin/convert.rs:108:64
| 2021-05-03T12:28:51Z | 0.4 | 2021-05-06T18:05:10Z | 575304a50c102f2e2a3a622b4be567c0ccf6e6c0 | [
"convert_wgsl"
] | [
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constan... | [] | [] | |
gfx-rs/naga | 749 | gfx-rs__naga-749 | [
"646"
] | 36bace2b41a776caa12d2e0ecac9991c08204aa6 | diff --git a/src/back/msl/writer.rs b/src/back/msl/writer.rs
--- a/src/back/msl/writer.rs
+++ b/src/back/msl/writer.rs
@@ -138,7 +138,12 @@ impl<'a> Display for TypeContext<'a> {
};
let (texture_str, msaa_str, kind, access) = match class {
crate::ImageClass::Sample... | diff --git a/tests/in/image-copy.wgsl /dev/null
--- a/tests/in/image-copy.wgsl
+++ /dev/null
@@ -1,16 +0,0 @@
-[[group(0), binding(1)]]
-var image_src: [[access(read)]] texture_storage_2d<rgba8uint>;
-[[group(0), binding(2)]]
-var image_dst: [[access(write)]] texture_storage_1d<r32uint>;
-
-[[stage(compute), workgroup_... | Implement image queries in SPIR-V backend
`Expression::ImageQuery { .. }` support is missing
| 2021-04-22T13:42:10Z | 0.3 | 2021-04-23T16:31:37Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_wgsl"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 723 | gfx-rs__naga-723 | [
"635"
] | daf4c82376e10d03488d7c71773b2acc1b9f7de4 | diff --git a/src/back/spv/instructions.rs b/src/back/spv/instructions.rs
--- a/src/back/spv/instructions.rs
+++ b/src/back/spv/instructions.rs
@@ -433,12 +433,12 @@ impl super::Instruction {
}
pub(super) fn store(
- pointer_type_id: Word,
+ pointer_id: Word,
object_id: Word,
... | diff --git /dev/null b/tests/in/access.param.ron
new file mode 100644
--- /dev/null
+++ b/tests/in/access.param.ron
@@ -0,0 +1,7 @@
+(
+ spv_version: (1, 1),
+ spv_capabilities: [ Shader, Image1D, Sampled1D ],
+ spv_debug: true,
+ spv_adjust_coordinate_space: false,
+ msl_custom: false,
+)
diff --git /dev/null b/tests/... | Indexing constant arrays in SPIR-V
```rust
struct VertexOutput {
[[builtin(position)]] position: vec4<f32>;
[[location(0)]] tex_coords: vec2<f32>;
};
[[stage(vertex)]]
fn vs_main([[builtin(vertex_index)]] index: u32) -> VertexOutput {
const triangle = array<vec2<f32>, 3u>(
vec2<f32>(-1.0, ... | 2021-04-16T11:12:42Z | 0.3 | 2021-04-16T21:11:22Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_wgsl"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::test_logical_layout_in_words",
"back::spv::writer:... | [] | [] | |
gfx-rs/naga | 714 | gfx-rs__naga-714 | [
"713"
] | 9cd2b04c04c9211488dbd7850ceb394c40599c3c | diff --git a/src/back/msl/mod.rs b/src/back/msl/mod.rs
--- a/src/back/msl/mod.rs
+++ b/src/back/msl/mod.rs
@@ -36,10 +36,12 @@ mod writer;
pub use writer::Writer;
+pub type Slot = u8;
+
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
pub enum BindSamplerTarget... | diff --git a/tests/in/boids.param.ron b/tests/in/boids.param.ron
--- a/tests/in/boids.param.ron
+++ b/tests/in/boids.param.ron
@@ -12,6 +12,8 @@
(stage: Compute, group: 0, binding: 1): (buffer: Some(1), mutable: true),
(stage: Compute, group: 0, binding: 2): (buffer: Some(2), mutable: true),
},
+ push_const... | Support the Vulkan Memory Model
Naga doesn't currently support compiling or validating shaders that require the `VulkanMemoryModel` capability. To replace spirv-cross, this is necessary. I believe the `VariablePointer` capability isn't actually necessary and has been removed from upstream rust-gpu.
I've attached the... | Filed https://github.com/EmbarkStudios/rust-gpu/issues/593 to rust-gpu, continuing with a modified shader that doesn't require at least the "VariablePointers" stuff. | 2021-04-13T13:24:16Z | 0.3 | 2021-04-13T05:32:02Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_wgsl_texture_array"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"arena::tests::fetch_or_append_unique",
"back::spv::writer::test_write_physical_layout",
"front::glsl::constan... | [] | [] |
gfx-rs/naga | 647 | gfx-rs__naga-647 | [
"642"
] | af4d989f556fc810afcf4af1dfd5080ddcb3dbb5 | diff --git a/src/back/msl/writer.rs b/src/back/msl/writer.rs
--- a/src/back/msl/writer.rs
+++ b/src/back/msl/writer.rs
@@ -212,6 +212,23 @@ impl<W: Write> Writer<W> {
Ok(())
}
+ fn put_storage_image_coordinate(
+ &mut self,
+ expr: Handle<crate::Expression>,
+ context: &Expressio... | diff --git /dev/null b/tests/in/image-copy.param.ron
new file mode 100644
--- /dev/null
+++ b/tests/in/image-copy.param.ron
@@ -0,0 +1,8 @@
+(
+ spv_version: (1, 1),
+ spv_capabilities: [ Shader, Image1D, Sampled1D ],
+ mtl_bindings: {
+ (stage: Compute, group: 0, binding: 1): (texture: Some(0), mutable: false),
+ (s... | MSL storage reads need to have unsigned coordiantes
```
program_source:218:38: error: no matching member function for call to 'read'
metal::float4 _expr274 = global3.read(metal::int2(_expr269.x, _expr269.y), _expr269.z);
~~~~~~~~^~~~
/System/Library/PrivateFrameworks... | 2021-04-01T22:36:34Z | 0.3 | 2021-04-01T14:47:32Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_wgsl_image_copy"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::fetch_or_append_unique",
"back::msl::test_error_size",
"front::glsl::constants::tests::access",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::test_logi... | [] | [] | |
gfx-rs/naga | 619 | gfx-rs__naga-619 | [
"614"
] | e47ff2dc26a049bc2830f468f0acf6d0214ff8a2 | diff --git a/src/back/msl/writer.rs b/src/back/msl/writer.rs
--- a/src/back/msl/writer.rs
+++ b/src/back/msl/writer.rs
@@ -205,6 +205,39 @@ impl<W: Write> Writer<W> {
Ok(())
}
+ fn put_initialization_component(
+ &mut self,
+ component: Handle<crate::Expression>,
+ context: &Expr... | diff --git a/src/back/msl/writer.rs b/src/back/msl/writer.rs
--- a/src/back/msl/writer.rs
+++ b/src/back/msl/writer.rs
@@ -1558,8 +1611,8 @@ fn test_stack_size() {
}
let stack_size = max_addr - min_addr;
// check the size (in debug only)
- // last observed macOS value: 21920
- if stack_size > 22000... | MSL struct initialization fails on array types
> program_source:1114:90: error: cannot initialize an array element of type 'type1' (aka 'float') with an lvalue of type 'type29' (aka 'type1 [1]')
Code:
```rust
typedef type1 type29[const_1u1];
typedef thread type29 *type30;
typedef thread type1 *ty... | 2021-03-27T11:55:36Z | 0.3 | 2021-03-27T14:58:04Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_spv_quad_vert"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::msl::test_error_size",
"arena::tests::fetch_or_append_unique",
"back::spv::writer::test_write_physical_layout",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::t... | [] | [] | |
gfx-rs/naga | 581 | gfx-rs__naga-581 | [
"567"
] | 889e487b629bc6499999f8d6485af9020b16f0e4 | diff --git a/src/back/spv/writer.rs b/src/back/spv/writer.rs
--- a/src/back/spv/writer.rs
+++ b/src/back/spv/writer.rs
@@ -858,18 +858,14 @@ impl Writer {
let mut current_offset = 0;
let mut member_ids = Vec::with_capacity(members.len());
for (index, member) in members... | diff --git a/src/front/wgsl/tests.rs b/src/front/wgsl/tests.rs
--- a/src/front/wgsl/tests.rs
+++ b/src/front/wgsl/tests.rs
@@ -70,7 +70,11 @@ fn parse_struct() {
parse_str(
"
[[block]] struct Foo { x: i32; };
- struct Bar { [[span(16)]] x: vec2<i32>; };
+ struct Bar {
+ [... | Support fixed-size arrays in uniform structures
See [shader](https://pastebin.com/vwzvAvwB) from https://github.com/gfx-rs/wgpu-rs/issues/788:
> Caused by:
In Device::create_shader_module
note: label = `Default Vertex Shader`
Global variable Handle(7) 'fragment_directional_lights_color' is invalid: In... | 2021-03-16T10:10:12Z | 0.3 | 2021-03-16T02:27:39Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"front::wgsl::tests::parse_struct",
"convert_wgsl_collatz",
"convert_spv_shadow"
] | [
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::writer::test_writer_generate_id",
"back::spv::writer::test_write_physical_layout",
"fron... | [] | [] | |
gfx-rs/naga | 561 | gfx-rs__naga-561 | [
"560"
] | f5ee79191223e4ebe323a728f4de40830b8d10f6 | diff --git a/src/back/glsl/mod.rs b/src/back/glsl/mod.rs
--- a/src/back/glsl/mod.rs
+++ b/src/back/glsl/mod.rs
@@ -416,7 +416,16 @@ impl<'a, W: Write> Writer<'a, W> {
ref members,
} = ty.inner
{
- self.write_struct(handle, members)?
+ // No needed... | diff --git /dev/null b/tests/out/shadow-Fragment.glsl.snap
new file mode 100644
--- /dev/null
+++ b/tests/out/shadow-Fragment.glsl.snap
@@ -0,0 +1,53 @@
+---
+source: tests/snapshots.rs
+expression: string
+---
+#version 310 es
+
+precision highp float;
+
+struct Light {
+ mat4x4 proj;
+ vec4 pos;
+ vec4 color... | [glsl-out] Properly write array type
Current implementation caused validation error with `glslangValidator`.
```glsl
readonly buffer Lights_block_1 {
Light[] data;
} _group_0_binding_1;
```
Should be: `Light data[];`
| 2021-03-10T20:58:12Z | 0.3 | 2021-03-10T20:41:19Z | 77a64da189e6ed2c4631ca03cb01b8d8124c4dad | [
"convert_wgsl_skybox",
"convert_wgsl_shadow"
] | [
"arena::tests::fetch_or_append_unique",
"arena::tests::fetch_or_append_non_unique",
"arena::tests::append_non_unique",
"arena::tests::append_unique",
"back::spv::layout::test_physical_layout_in_words",
"back::spv::layout::test_logical_layout_in_words",
"front::glsl::constants::tests::access",
"back::s... | [] | [] | |
dtolnay/anyhow | 34 | dtolnay__anyhow-34 | [
"32"
] | 5e04e776efae33b311a850a0b6bae3104b90e1d4 | diff --git a/src/error.rs b/src/error.rs
--- a/src/error.rs
+++ b/src/error.rs
@@ -5,7 +5,7 @@ use std::error::Error as StdError;
use std::fmt::{self, Debug, Display};
use std::mem::{self, ManuallyDrop};
use std::ops::{Deref, DerefMut};
-use std::ptr;
+use std::ptr::{self, NonNull};
impl Error {
/// Create a... | diff --git a/tests/test_context.rs b/tests/test_context.rs
--- a/tests/test_context.rs
+++ b/tests/test_context.rs
@@ -1,4 +1,9 @@
-use anyhow::{Context, Result};
+mod drop;
+
+use crate::drop::{DetectDrop, Flag};
+use anyhow::{Context, Error, Result};
+use std::fmt::{self, Display};
+use thiserror::Error;
// https:... | Figure out how context should interact with downcasting
For example if we have:
```rust
let e = fs::read("/...").context(ReadFailed).unwrap_err();
match e.downcast_ref::<ReadFailed>() {
```
should this downcast succeed or fail?
| For that matter, should `e.downcast_ref::<io::Error>()` succeed? | 2019-10-28T12:27:06Z | 1.0 | 2019-10-28T04:41:06Z | 2737bbeb59f50651ff54ca3d879a3f5d659a98ab | [
"test_downcast_high",
"test_downcast_low",
"test_downcast_mid"
] | [
"test_downcast_ref",
"test_inference",
"test_unsuccessful_downcast",
"test_convert",
"test_question_mark",
"test_downcast_mut",
"test_drop",
"test_downcast",
"test_large_alignment",
"test_display",
"test_ensure",
"test_messages",
"test_error_size",
"test_null_pointer_optimization",
"test... | [] | [] |
dtolnay/anyhow | 47 | dtolnay__anyhow-47 | [
"46"
] | 6088b60791fc063f35183df8a4706a8723a8568a | diff --git a/src/kind.rs b/src/kind.rs
--- a/src/kind.rs
+++ b/src/kind.rs
@@ -45,7 +45,6 @@
// (&error).anyhow_kind().new(error)
use crate::Error;
-use std::error::Error as StdError;
use std::fmt::{Debug, Display};
#[cfg(backtrace)]
diff --git a/src/kind.rs b/src/kind.rs
--- a/src/kind.rs
+++ b/src/kind.rs... | diff --git a/tests/test_source.rs b/tests/test_source.rs
--- a/tests/test_source.rs
+++ b/tests/test_source.rs
@@ -53,3 +53,10 @@ fn test_io_source() {
let error = anyhow!(TestError::Io(io));
assert_eq!("oh no!", error.source().unwrap().to_string());
}
+
+#[test]
+fn test_anyhow_from_anyhow() {
+ let erro... | Usage of `bail!(error)` loses the context of `error`
I was in a situation recently where I was doing:
```rust
match some_result {
Ok(()) => {}
Err(e) => {
if !err_is_ok(e) {
bail!(e);
}
}
}
```
in this case `e` was actually of type `anyhow::Error` so a `return Err(... | 2019-11-19T03:43:20Z | 1.0 | 2019-11-18T19:46:40Z | 2737bbeb59f50651ff54ca3d879a3f5d659a98ab | [
"test_anyhow_from_anyhow"
] | [
"test_sync",
"test_send",
"test_iter",
"test_rev",
"test_len",
"test_downcast_low",
"test_downcast_high",
"test_downcast_mid",
"test_downcast_ref",
"test_inference",
"test_unsuccessful_downcast",
"test_question_mark",
"test_convert",
"test_downcast",
"test_downcast_mut",
"test_drop",
... | [] | [] | |
dimforge/nalgebra | 813 | dimforge__nalgebra-813 | [
"812"
] | 8bc277332625e6cf18fc17a4432000179ac7b5ae | diff --git a/src/base/array_storage.rs b/src/base/array_storage.rs
--- a/src/base/array_storage.rs
+++ b/src/base/array_storage.rs
@@ -377,7 +377,7 @@ where
where
V: SeqAccess<'a>,
{
- let mut out: Self::Value = unsafe { mem::uninitialized() };
+ let mut out: Self::Value = unsafe { mem:... | diff --git a/tests/core/serde.rs b/tests/core/serde.rs
--- a/tests/core/serde.rs
+++ b/tests/core/serde.rs
@@ -3,9 +3,10 @@
use na::{
DMatrix, Isometry2, Isometry3, IsometryMatrix2, IsometryMatrix3, Matrix3x4, Point2, Point3,
Quaternion, Rotation2, Rotation3, Similarity2, Similarity3, SimilarityMatrix2,
- ... | Deserialization in serde panics in rustc 1.48+ with some enum inner types
This error presents as: ```attempted to leave type `nalgebra::ArrayStorage<...>` uninitialized, which is invalid```
This line of code panics: https://github.com/dimforge/nalgebra/blob/c0f4ee6db96952ab42c3505d1647cfeda86616b1/src/base/array_st... | This minimal example triggers the failure:
`src/main.rs`
```
extern crate nalgebra;
extern crate serde;
extern crate serde_json;
use nalgebra::Vector2;
use serde_derive::{Serialize, Deserialize};
use serde_json::from_str;
#[derive(Serialize, Deserialize, Debug, PartialEq, Copy, Clone)]
#[serde(tag = "le... | 2020-12-18T18:56:35Z | 0.23 | 2020-12-18T11:06:44Z | 81d29040d7c894ab550d686ec6f52d1418e8c9df | [
"core::serde::deserialize_enum"
] | [
"base::indexing::dimrange_rangefrom_dimname",
"base::indexing::dimrange_range_usize",
"base::indexing::dimrange_rangefrom_usize",
"base::indexing::dimrange_rangefull",
"base::indexing::dimrange_usize",
"base::indexing::dimrange_rangeinclusive_usize",
"base::indexing::dimrange_rangeto_usize",
"base::in... | [
"src/geometry/isometry_interpolation.rs - geometry::isometry_interpolation::Isometry2<N>::lerp_slerp (line 149)",
"src/geometry/isometry_interpolation.rs - geometry::isometry_interpolation::IsometryMatrix2<N>::lerp_slerp (line 185)",
"src/geometry/rotation_interpolation.rs - geometry::rotation_interpolation::Ro... | [] |
dimforge/nalgebra | 404 | dimforge__nalgebra-404 | [
"401"
] | 962e89417ca2eab9254fa4fda5a27fc925cf0965 | diff --git a/src/base/matrix.rs b/src/base/matrix.rs
--- a/src/base/matrix.rs
+++ b/src/base/matrix.rs
@@ -909,7 +909,7 @@ where
}
}
- None
+ first_ord
}
#[inline]
| diff --git a/tests/core/matrix.rs b/tests/core/matrix.rs
--- a/tests/core/matrix.rs
+++ b/tests/core/matrix.rs
@@ -706,6 +706,16 @@ fn set_row_column() {
assert_eq!(expected2, computed);
}
+#[test]
+fn partial_clamp() {
+ // NOTE: from #401.
+ let n = Vector2::new(1.5, 0.0);
+ let min = Vector2::new(-7... | partial_clamp unintuitive/broken
This is using nalgebra version `0.16.3`.
The following code:
```rust
println!("acc: {:?}", acc);
println!("movement.vel: {:?}", movement.vel);
println!("&(movement.vel + acc): {:?}", &(movement.vel + acc));
println!("&movement.max_vel: {:?}", &movement.max_vel);
println!("&-m... | 2018-09-24T11:59:56Z | 0.16 | 2018-09-24T18:58:13Z | d702bf0382896ac571190bcfc6e7ae13c657809b | [
"core::matrix::partial_clamp"
] | [
"linalg::symmetric_eigen::test::wilkinson_shift_zero",
"geometry::transform::tests::checks_homogeneous_invariants_of_square_identity_matrix",
"linalg::symmetric_eigen::test::wilkinson_shift_zero_diagonal",
"linalg::symmetric_eigen::test::wilkinson_shift_zero_det",
"linalg::symmetric_eigen::test::wilkinson_s... | [
"core::mint::mint_matrix_conversion_2_3",
"core::mint::mint_matrix_conversion_3_4"
] | [] | |
dimforge/nalgebra | 645 | dimforge__nalgebra-645 | [
"644"
] | d9a9c606029af0ad808c8e5385779a167d554114 | diff --git a/src/base/blas.rs b/src/base/blas.rs
--- a/src/base/blas.rs
+++ b/src/base/blas.rs
@@ -565,6 +565,7 @@ where
);
if ncols2 == 0 {
+ self.fill(N::zero());
return;
}
diff --git a/src/base/blas.rs b/src/base/blas.rs
--- a/src/base/blas.rs
+++ b/src/base/bla... | diff --git /dev/null b/tests/core/empty.rs
new file mode 100644
--- /dev/null
+++ b/tests/core/empty.rs
@@ -0,0 +1,30 @@
+use na::{DMatrix, DVector};
+
+#[test]
+fn empty_matrix_mul_vector() {
+ // Issue #644
+ let m = DMatrix::<f32>::zeros(8, 0);
+ let v = DVector::<f32>::zeros(0);
+ assert_eq!(m * v, DVec... | Multiplication of matrices with zero elements causes UB
The following test fails randomly:
```rust
#[test]
fn zero_mul() {
let m = DMatrix::<f32>::zeros(8, 0);
let v = DVector::<f32>::zeros(0);
assert_eq!(m * v, DVector::zeros(8));
}
```
This is because nalgebra does not properly handle the cas... | 2019-09-02T00:34:57Z | 0.18 | 2019-09-01T18:38:05Z | f71d0c5b8cb087d5e9c629c93ce2aeec0620b5fe | [
"core::empty::empty_matrix_mul_matrix",
"core::empty::empty_matrix_mul_vector"
] | [
"base::indexing::dimrange_range_usize",
"base::indexing::dimrange_rangefrom_dimname",
"base::indexing::dimrange_rangefull",
"base::indexing::dimrange_rangeinclusive_usize",
"base::indexing::dimrange_rangefrom_usize",
"base::indexing::dimrange_rangeto_usize",
"base::indexing::dimrange_usize",
"base::in... | [] | [] | |
dimforge/nalgebra | 641 | dimforge__nalgebra-641 | [
"640"
] | a74702bb5af6d5fad292b06540bb66908f0708f1 | diff --git a/src/base/cg.rs b/src/base/cg.rs
--- a/src/base/cg.rs
+++ b/src/base/cg.rs
@@ -358,10 +358,10 @@ where DefaultAllocator: Allocator<N, D, D>
+ unsafe { *self.get_unchecked((D::dim() - 1, D::dim() - 1)) };
if !n.is_zero() {
- return transform * (pt / n) + translation;
+ ... | diff --git a/tests/geometry/projection.rs b/tests/geometry/projection.rs
--- a/tests/geometry/projection.rs
+++ b/tests/geometry/projection.rs
@@ -1,4 +1,4 @@
-use na::{Orthographic3, Perspective3};
+use na::{Orthographic3, Perspective3, Point3};
#[test]
fn perspective_inverse() {
diff --git a/tests/geometry/projec... | SquareMatrix::transform_point is wrong
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=17498e4b5eca2e898e4a4684247fc0cd
The `transform_point` method yields a wrong z value.
| 2019-08-27T20:30:49Z | 0.18 | 2019-08-27T13:15:33Z | f71d0c5b8cb087d5e9c629c93ce2aeec0620b5fe | [
"geometry::projection::perspective_matrix_point_transformation"
] | [
"base::indexing::dimrange_rangefrom_dimname",
"base::indexing::dimrange_range_usize",
"base::indexing::dimrange_rangefrom_usize",
"base::indexing::dimrange_rangefull",
"base::indexing::dimrange_rangeto_usize",
"base::indexing::dimrange_rangetoinclusive_usize",
"base::indexing::dimrange_rangeinclusive_us... | [] | [] | |
dimforge/nalgebra | 1,384 | dimforge__nalgebra-1384 | [
"1380"
] | a803815bd1d22a052690cfde3ff7fae26cd91152 | diff --git a/src/linalg/inverse.rs b/src/linalg/inverse.rs
--- a/src/linalg/inverse.rs
+++ b/src/linalg/inverse.rs
@@ -145,13 +145,44 @@ where
{
let m = m.as_slice();
- out[(0, 0)] = m[5].clone() * m[10].clone() * m[15].clone()
+ let cofactor00 = m[5].clone() * m[10].clone() * m[15].clone()
- m[5... | diff --git a/tests/core/matrix.rs b/tests/core/matrix.rs
--- a/tests/core/matrix.rs
+++ b/tests/core/matrix.rs
@@ -1263,6 +1263,16 @@ fn column_iterator_double_ended_mut() {
assert_eq!(col_iter_mut.next(), None);
}
+#[test]
+fn test_inversion_failure_leaves_matrix4_unchanged() {
+ let mut mat = na::Matrix4::... | Inverting a 4x4 matrix with `try_inverse_mut` doesn't leave `self` unchanged if the inversion fails.
Calling `try_inverse_mut` on a 4x4 matrix uses [`do_inverse4`](https://github.com/dimforge/nalgebra/blob/a803815bd1d22a052690cfde3ff7fae26cd91152/src/linalg/inverse.rs#L139) which modifies `out` before checking the dete... | 2024-04-19T23:01:31Z | 0.32 | 2024-05-05T10:05:36Z | a803815bd1d22a052690cfde3ff7fae26cd91152 | [
"core::matrix::test_inversion_failure_leaves_matrix4_unchanged"
] | [
"base::indexing::dimrange_range_usize",
"base::indexing::dimrange_rangefrom_dimname",
"base::indexing::dimrange_rangefrom_usize",
"base::indexing::dimrange_rangefull",
"base::indexing::dimrange_rangeinclusive_usize",
"base::indexing::dimrange_rangeto_usize",
"base::indexing::dimrange_usize",
"base::in... | [
"src/geometry/rotation_specialization.rs - geometry::rotation_specialization::Rotation3<T>::from_axis_angle (line 366)",
"src/geometry/unit_complex.rs - geometry::unit_complex::UnitComplex<T>::cos_angle (line 110)",
"src/geometry/unit_complex_construction.rs - geometry::unit_complex_construction::UnitComplex<T>... | [
"linalg::svd::proptest_tests::f64::svd_solve"
] | |
dimforge/nalgebra | 1,369 | dimforge__nalgebra-1369 | [
"1368"
] | 749a9fee17028291fd47b8ea3c8d3baab53229a4 | diff --git a/src/linalg/householder.rs b/src/linalg/householder.rs
--- a/src/linalg/householder.rs
+++ b/src/linalg/householder.rs
@@ -34,6 +34,17 @@ pub fn reflection_axis_mut<T: ComplexField, D: Dim, S: StorageMut<T, D>>(
if !factor.is_zero() {
column.unscale_mut(factor.sqrt());
+
+ // Normaliz... | diff --git a/tests/linalg/eigen.rs b/tests/linalg/eigen.rs
--- a/tests/linalg/eigen.rs
+++ b/tests/linalg/eigen.rs
@@ -1,4 +1,4 @@
-use na::DMatrix;
+use na::{DMatrix, Matrix3};
#[cfg(feature = "proptest-support")]
mod proptest_tests {
diff --git a/tests/linalg/eigen.rs b/tests/linalg/eigen.rs
--- a/tests/linalg/ei... | SVD Computes Wrong Singular Values for Very Small-Valued Matrices
This should be reproducible with `nalgebra = { version = "0.32.4", features = ["rand"] }`
```
use nalgebra::Matrix3;
fn main() {
let id = Matrix3::<f32>::identity();
loop {
let r = Matrix3::<f32>::new_random();
let m = ... | There was a similar issue in https://github.com/dimforge/nalgebra/pull/1314, but I think the fix for that was included in 0.32.4. Maybe an interesting reference all the same. | 2024-03-09T00:51:58Z | 0.32 | 2024-03-28T14:26:12Z | a803815bd1d22a052690cfde3ff7fae26cd91152 | [
"linalg::eigen::very_small_deviation_from_identity_issue_1368"
] | [
"base::indexing::dimrange_range_usize",
"base::indexing::dimrange_rangefrom_dimname",
"base::indexing::dimrange_rangefrom_usize",
"base::indexing::dimrange_rangefull",
"base::indexing::dimrange_rangeto_usize",
"base::indexing::dimrange_rangeinclusive_usize",
"base::indexing::dimrange_rangetoinclusive_us... | [
"src/geometry/rotation_specialization.rs - geometry::rotation_specialization::Rotation3<T>::from_axis_angle (line 366)",
"src/geometry/unit_complex.rs - geometry::unit_complex::UnitComplex<T>::cos_angle (line 110)",
"src/geometry/unit_complex_construction.rs - geometry::unit_complex_construction::UnitComplex<T>... | [] |
clockworklabs/SpacetimeDB | 313 | clockworklabs__SpacetimeDB-313 | [
"308"
] | cf2584fe8065a705d85222fffd8761e33d690f2a | diff --git a/crates/core/src/sql/compiler.rs b/crates/core/src/sql/compiler.rs
--- a/crates/core/src/sql/compiler.rs
+++ b/crates/core/src/sql/compiler.rs
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use crate::db::datastore::locking_tx_datastore::MutTxId;
-use crate::db::datastore::traits::{IndexSchema, TableSch... | diff --git a/crates/core/src/sql/compiler.rs b/crates/core/src/sql/compiler.rs
--- a/crates/core/src/sql/compiler.rs
+++ b/crates/core/src/sql/compiler.rs
@@ -386,8 +398,8 @@ mod tests {
auth::{StAccess, StTableType},
error::ResultTest,
};
- use spacetimedb_sats::AlgebraicType;
- use spacet... | Push index scans below joins
| 2023-09-21T09:16:00Z | 1.0 | 2023-09-22T16:14:38Z | e395e4ee30c7b4f142bf927d1151662ecedc763b | [
"sql::compiler::tests::compile_join_lhs_push_down",
"sql::compiler::tests::compile_join_lhs_and_rhs_push_down"
] | [
"client::message_handlers::tests::parse_one_off_query",
"db::datastore::locking_tx_datastore::tests::test_bootstrapping_sets_up_tables",
"db::datastore::locking_tx_datastore::tests::test_create_table_pre_commit",
"db::datastore::locking_tx_datastore::tests::test_create_table_post_commit",
"db::datastore::lo... | [] | [] | |
clockworklabs/SpacetimeDB | 1,894 | clockworklabs__SpacetimeDB-1894 | [
"1818"
] | 9c64d1fbd17e99bbb8db1479492d88ba7578acc9 | diff --git a/crates/bindings-macro/src/lib.rs b/crates/bindings-macro/src/lib.rs
--- a/crates/bindings-macro/src/lib.rs
+++ b/crates/bindings-macro/src/lib.rs
@@ -45,6 +45,7 @@ mod sym {
symbol!(public);
symbol!(sats);
symbol!(scheduled);
+ symbol!(scheduled_at);
symbol!(unique);
symbol!(upd... | diff --git a/crates/bindings/tests/ui/reducers.rs b/crates/bindings/tests/ui/reducers.rs
--- a/crates/bindings/tests/ui/reducers.rs
+++ b/crates/bindings/tests/ui/reducers.rs
@@ -25,8 +25,22 @@ fn missing_ctx(_a: u8) {}
#[spacetimedb::reducer]
fn ctx_by_val(_ctx: ReducerContext, _a: u8) {}
+#[spacetimedb::table(nam... | `#[spacetimedb::table(scheduled())]` should probably not autogen the scheduled_id/at fields for you - should just require they already be present
UX story:
> Someone new comes to the codebase and wants to insert a row into the table. the compiler complains "missing fields scheduled_id and schedule_at" and so they go t... | 2024-10-24T02:23:38Z | 1.78 | 2025-02-11T02:53:30Z | 8075567da42408ecf53146fb3f72832e41d8a956 | [
"ui"
] | [
"deptree_snapshot",
"tests/ui/tables.rs",
"crates/bindings/src/rng.rs - rng::ReducerContext::rng (line 30)"
] | [] | [] | |
clockworklabs/SpacetimeDB | 336 | clockworklabs__SpacetimeDB-336 | [
"332"
] | c71d24c1f9356fea95c9641ff521fda048a141f0 | diff --git a/crates/core/src/vm.rs b/crates/core/src/vm.rs
--- a/crates/core/src/vm.rs
+++ b/crates/core/src/vm.rs
@@ -46,16 +46,20 @@ pub fn build_query<'a>(
let iter = result.select(move |row| cmp.compare(row, &header));
Box::new(iter)
}
- Query::IndexJoin(joi... | diff --git a/crates/core/src/subscription/query.rs b/crates/core/src/subscription/query.rs
--- a/crates/core/src/subscription/query.rs
+++ b/crates/core/src/subscription/query.rs
@@ -448,6 +448,88 @@ mod tests {
Ok(())
}
+ #[test]
+ fn test_eval_incr_for_index_join() -> ResultTest<()> {
+ l... | Support incremental evaluation of index joins
| 2023-09-28T04:03:56Z | 1.0 | 2023-09-28T16:47:40Z | e395e4ee30c7b4f142bf927d1151662ecedc763b | [
"subscription::query::tests::test_eval_incr_for_index_join"
] | [
"client::message_handlers::tests::parse_one_off_query",
"db::datastore::locking_tx_datastore::tests::test_insert_post_commit",
"db::datastore::locking_tx_datastore::tests::test_create_table_post_rollback",
"db::datastore::locking_tx_datastore::tests::test_create_table_pre_commit",
"db::datastore::locking_tx... | [] | [] | |
clockworklabs/SpacetimeDB | 321 | clockworklabs__SpacetimeDB-321 | [
"320"
] | 9aecc256de48dd210f6be201f6688c1fba5e0b62 | diff --git a/crates/core/src/vm.rs b/crates/core/src/vm.rs
--- a/crates/core/src/vm.rs
+++ b/crates/core/src/vm.rs
@@ -29,36 +29,22 @@ pub fn build_query<'a>(
tx: &'a MutTxId,
query: QueryCode,
) -> Result<Box<IterRows<'a>>, ErrorVm> {
- let q = match &query.table {
- Table::MemTable(x) => SourceEx... | diff --git a/crates/core/src/subscription/query.rs b/crates/core/src/subscription/query.rs
--- a/crates/core/src/subscription/query.rs
+++ b/crates/core/src/subscription/query.rs
@@ -146,13 +146,14 @@ pub fn compile_read_only_query(
#[cfg(test)]
mod tests {
use super::*;
- use crate::db::datastore::traits::Ta... | Fix incremental evaluation of queries that use indexes
`eval_incr` panics for index scan plans with the following error
```
failed to locate `__op_type`
```
| 2023-09-26T16:30:34Z | 1.0 | 2023-09-26T17:19:29Z | e395e4ee30c7b4f142bf927d1151662ecedc763b | [
"subscription::query::tests::test_eval_incr_for_index_scan"
] | [
"client::message_handlers::tests::parse_one_off_query",
"db::datastore::locking_tx_datastore::tests::test_bootstrapping_sets_up_tables",
"db::datastore::locking_tx_datastore::tests::test_create_table_post_commit",
"db::datastore::locking_tx_datastore::tests::test_create_table_post_rollback",
"db::datastore:... | [] | [] | |
clockworklabs/SpacetimeDB | 319 | clockworklabs__SpacetimeDB-319 | [
"318"
] | 8a80600c836736a9310cf3b235efd521e3b1d5e1 | diff --git a/crates/core/src/sql/ast.rs b/crates/core/src/sql/ast.rs
--- a/crates/core/src/sql/ast.rs
+++ b/crates/core/src/sql/ast.rs
@@ -106,7 +106,7 @@ pub struct Selection {
impl Selection {
pub fn with_cmp(op: OpQuery, lhs: ColumnOp, rhs: ColumnOp) -> Self {
- let cmp = ColumnOp::cmp(op, lhs, rhs);
... | diff --git a/crates/core/src/sql/compiler.rs b/crates/core/src/sql/compiler.rs
--- a/crates/core/src/sql/compiler.rs
+++ b/crates/core/src/sql/compiler.rs
@@ -808,6 +808,167 @@ mod tests {
Ok(())
}
+ #[test]
+ fn compile_join_lhs_push_down_no_index() -> ResultTest<()> {
+ let (db, _) = make... | Push selections below joins
Push selections below joins in general.
| 2023-09-26T08:29:57Z | 1.0 | 2023-09-26T19:01:30Z | e395e4ee30c7b4f142bf927d1151662ecedc763b | [
"sql::compiler::tests::compile_join_lhs_push_down_no_index",
"sql::compiler::tests::compile_join_rhs_push_down_no_index"
] | [
"client::message_handlers::tests::parse_one_off_query",
"db::datastore::locking_tx_datastore::tests::test_create_table_post_commit",
"db::datastore::locking_tx_datastore::tests::test_create_table_post_rollback",
"db::datastore::locking_tx_datastore::tests::test_insert_post_commit",
"db::datastore::locking_t... | [] | [] | |
RustPython/RustPython | 4,711 | RustPython__RustPython-4711 | [
"4588",
"4593",
"4588"
] | 38172469151f21bae1ec868c548f2ca537146dad | diff --git a/common/src/format.rs b/common/src/format.rs
--- a/common/src/format.rs
+++ b/common/src/format.rs
@@ -335,10 +335,11 @@ impl FormatSpec {
let offset = (disp_digit_cnt % (inter + 1) == 0) as i32;
let disp_digit_cnt = disp_digit_cnt + offset;
let pad_cnt = disp_digit_cnt - magnitud... | diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -403,7 +403,6 @@ def test_float__format__locale(self):
self.assertEqual(locale.format_string('%g', x, grouping=True), format(x, 'n'))
self.assertEqual(locale.format_string(... | Format panic in test_int__format__locale
## Issues
In `Lib/test/test_types.py``test_int__format__locale`, if you change from `format(x, 'n')` to `format(x, ',')` and run the test, RustPython will panic! It doesn't crash in CPython!
See #4593 for test case
broken test case of FormatSpec::format_int
test case of ... | not reproducible
not reproducible | 2023-03-18T12:44:26Z | 0.2 | 2023-03-23T07:38:32Z | 7e66db0d43b6fd93bc114773ac8e896b7eda62c9 | [
"format::tests::test_format_int_sep"
] | [
"cformat::tests::test_format_parse_key_fail",
"cformat::tests::test_fill_and_align",
"float_ops::test_maybe_remove_trailing_redundant_chars",
"float_ops::test_remove_trailing_zeros",
"cformat::tests::test_parse_and_format_number",
"cformat::tests::test_parse_and_format_string",
"cformat::tests::test_for... | [] | [] |
RustPython/RustPython | 4,582 | RustPython__RustPython-4582 | [
"4566"
] | e082d8cc75060ce44b609f7d8eb6455d732fe90e | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2933,9 +2933,11 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "unicode_names2"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "029df4cc82... | diff --git /dev/null b/compiler/parser/src/snapshots/rustpython_parser__string__tests__backspace_alias.snap
new file mode 100644
--- /dev/null
+++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__backspace_alias.snap
@@ -0,0 +1,40 @@
+---
+source: compiler/parser/src/string.rs
+expression: parse_ast
+-... | Some valid named unicode characters cause syntax errors
`"\N{BACKSPACE}another cool trick"` yields a syntax error in RustPython, but runs without error on CPython.
See: https://github.com/charliermarsh/ruff/issues/3207.
| For reference, Python does throw errors on obviously-invalid named unicode characters like `"\N{AAA} another cool trick"`.
Seems like this is coming from `unicode_names2`. `unicode_names2::character("BACKSPACE")` doesn't return a character.
Related question (out of curiosity): What does `unicode_names2::name('\x08')` r... | 2023-02-26T18:12:04Z | 0.2 | 2023-02-28T13:33:29Z | 7e66db0d43b6fd93bc114773ac8e896b7eda62c9 | [
"string::tests::test_bell_alias",
"string::tests::test_backspace_alias",
"string::tests::test_carriage_return_alias",
"string::tests::test_delete_alias",
"string::tests::test_character_tabulation_with_justification_alias",
"string::tests::test_escape_alias",
"string::tests::test_form_feed_alias",
"str... | [
"context::tests::test_ann_assign_name",
"context::tests::test_assign_named_expr",
"context::tests::test_assign_name",
"context::tests::test_assign_for",
"context::tests::test_assign_list",
"context::tests::test_assign_attribute",
"context::tests::test_assign_with",
"context::tests::test_assign_set_com... | [] | [] |
RustPython/RustPython | 4,306 | RustPython__RustPython-4306 | [
"4305"
] | 39bed0df510770a31345f83a381217fe434692f8 | diff --git a/compiler/parser/python.lalrpop b/compiler/parser/python.lalrpop
--- a/compiler/parser/python.lalrpop
+++ b/compiler/parser/python.lalrpop
@@ -756,7 +756,7 @@ LambdaDef: ast::Expr = {
}
OrTest: ast::Expr = {
- <e1:AndTest> <location:@L> <e2:("or" AndTest)*> <end_location:@R> => {
+ <location:@L> <... | diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -2100,8 +2100,6 @@ def test_binop(self):
self._check_content(s, binop.left, '1 * 2 + (3 )')
self._check_content(s, binop.left.right, '3')
- # TODO: RUSTPYTHON
- @unittest.expectedF... | Is the start location of `ExprKind::BoolOp` correct?
In https://github.com/charliermarsh/ruff/pull/1009, I found the start location of `ExprKind::BoolOp` points to `or` or `and`.
Example:
```python
foo or bar
^
foo and bar
^
# ^ represents the start location of this BoolOp expression
```
Is t... | Not sure if this works, but can we move `<location:@L>` before `<e1:AndTest>`?
https://github.com/RustPython/RustPython/blob/18af44b7c7410c3448df1f3b080bd358e586d265/compiler/parser/python.lalrpop#L758-L766
Thank for you reporting. That seems going to be working.
@youknowone Thanks for the comment. I'll file a PR. | 2022-12-04T04:46:03Z | 0.1 | 2022-12-05T00:49:37Z | 3a5716da2ac26ebebe40a1de2b9bfd63b0508519 | [
"parser::tests::test_parse_boolop_or",
"parser::tests::test_parse_boolop_and"
] | [
"context::tests::test_assign_attribute",
"context::tests::test_assign_named_expr",
"context::tests::test_ann_assign_name",
"context::tests::test_assign_for",
"context::tests::test_assign_name",
"context::tests::test_assign_list",
"context::tests::test_assign_with",
"context::tests::test_assign_starred... | [] | [] |
RustPython/RustPython | 4,220 | RustPython__RustPython-4220 | [
"4219"
] | 1cb7f4dcf8a6670064d2f86e2a5055f8a77d89f3 | diff --git a/compiler/parser/src/lexer.rs b/compiler/parser/src/lexer.rs
--- a/compiler/parser/src/lexer.rs
+++ b/compiler/parser/src/lexer.rs
@@ -205,7 +205,9 @@ where
// Check if we have a string:
if self.chr0 == Some('"') || self.chr0 == Some('\'') {
- return self.lex_strin... | diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_f_string.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_f_string.snap
--- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_f_string.snap
+++ b/compiler/parser/src/snapshots/rustpython_... | Parsed string start location differs from CPython's AST parser
If you parse `x = u"""abc"""`, RustPython reports that the `Constant` starts at one-indexed column 7 (just after the first `"`):
```
[
Located {
location: Location {
row: 1,
column: 1,
},
end_loc... | 2022-10-15T23:04:08Z | 0.1 | 2022-10-15T15:51:20Z | 3a5716da2ac26ebebe40a1de2b9bfd63b0508519 | [
"parser::tests::test_parse_f_string",
"string::tests::test_parse_string_triple_quotes_with_kind",
"string::tests::test_parse_u_f_string_concat_1",
"string::tests::test_parse_u_string_concat_2",
"string::tests::test_parse_u_f_string_concat_2",
"string::tests::test_parse_f_string_concat_3"
] | [
"fstring::tests::test_parse_empty_fstring",
"fstring::tests::test_fstring_parse_selfdocumenting_base",
"fstring::tests::test_parse_fstring",
"fstring::tests::test_fstring_parse_selfdocumenting_base_more",
"fstring::tests::test_fstring_parse_selfdocumenting_format",
"fstring::tests::test_parse_fstring_not_... | [] | [] | |
RustScan/RustScan | 246 | RustScan__RustScan-246 | [
"239"
] | 739e9716fc22e62b53c0ed5a5998bd743152978f | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,5 +1,20 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+[[package]]
+name = "addr2line"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b6a2d3... | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -207,6 +247,12 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
+[[package]]
+name = "bytes"
+version = "0.5.6"
+source = "regi... | Use DNS instead of socket connection
Currently RustScan connects to port 80 to resolve the host using sockets, DNS would be much nicer to use.
| Issue-Label Bot is automatically applying the label `feature_request` to this issue, with a confidence of 0.95. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: [app homepage](https://github.com/marketplace/issue-label-bot), [dashboard](https://mlbot.net/data/RustScan/RustSca... | 2020-09-28T04:49:20Z | 1.9 | 2020-09-29T10:49:25Z | 739e9716fc22e62b53c0ed5a5998bd743152978f | [
"tests::parse_hosts_file_and_incorrect_hosts"
] | [
"input::tests::opts_merge_optional_arguments",
"input::tests::opts_merge_required_arguments",
"input::tests::opts_no_merge_when_config_is_ignored",
"port_strategy::tests::serial_strategy_with_ports",
"scanner::socket_iterator::tests::goes_through_every_ip_port_combination",
"port_strategy::tests::random_s... | [] | [] |
RustScan/RustScan | 660 | RustScan__RustScan-660 | [
"651"
] | c3d24feebef4c605535a6661ddfeaa18b9bde60c | diff --git a/src/address.rs b/src/address.rs
--- a/src/address.rs
+++ b/src/address.rs
@@ -1,4 +1,5 @@
//! Provides functions to parse input IP addresses, CIDRs or files.
+use std::collections::BTreeSet;
use std::fs::{self, File};
use std::io::{prelude::*, BufReader};
use std::net::{IpAddr, SocketAddr, ToSocketAddr... | diff --git a/src/address.rs b/src/address.rs
--- a/src/address.rs
+++ b/src/address.rs
@@ -256,6 +262,16 @@ mod tests {
assert_eq!(ips.len(), 0);
}
+ #[test]
+ fn parse_duplicate_cidrs() {
+ let mut opts = Opts::default();
+ opts.addresses = vec!["79.98.104.0/21".to_owned(), "79.98.1... | Dublication of ports in output
rustscan.exe -a tmp/asns_prefixes_specific.txt -p 80,443,8443,8080,8006 --scripts none
<img width="365" alt="Screenshot_2" src="https://github.com/user-attachments/assets/ef874b42-60b5-4260-bc67-dd7abe6dbfce">
tmp/asns_prefixes_specific.txt
`185.52.205.0/24
79.98.109.0/24
185.239.... | I suspect that when we got
79.98.104.0/21
79.98.104.0/24
dublication comes from this | 2024-09-19T00:46:28Z | 2.3 | 2024-09-21T18:08:33Z | c3d24feebef4c605535a6661ddfeaa18b9bde60c | [
"address::tests::parse_duplicate_cidrs"
] | [
"input::tests::opts_merge_optional_arguments",
"input::tests::opts_merge_required_arguments",
"input::tests::opts_no_merge_when_config_is_ignored",
"address::tests::parse_correct_addresses",
"address::tests::parse_naughty_host_file",
"address::tests::parse_empty_hosts_file",
"input::tests::parse_trailin... | [] | [] |
RustScan/RustScan | 518 | RustScan__RustScan-518 | [
"515"
] | 7dd9352baee3b467b4c55c95edf4de8494ca8a40 | diff --git a/src/port_strategy/mod.rs b/src/port_strategy/mod.rs
--- a/src/port_strategy/mod.rs
+++ b/src/port_strategy/mod.rs
@@ -67,7 +67,7 @@ pub struct SerialRange {
impl RangeOrder for SerialRange {
fn generate(&self) -> Vec<u16> {
- (self.start..self.end).collect()
+ (self.start..=self.end).... | diff --git a/src/port_strategy/mod.rs b/src/port_strategy/mod.rs
--- a/src/port_strategy/mod.rs
+++ b/src/port_strategy/mod.rs
@@ -104,7 +104,7 @@ mod tests {
let range = PortRange { start: 1, end: 100 };
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Serial);
let result = s... | --range <start-end>, only contain start, But not end port
In nmap run:**nmap 192.168.1.2 -p 1-65535** ,nmap scan port range is 1-65535.
But in RustScan run:**rustscan 192.168.1.2 --range 1-65535** (or directly execute **rustscan 192.168.1.2**) by wireshark verification, the scan range is 1-65534, does not contain 6553... | 2023-05-26T04:18:08Z | 2.1 | 2024-04-07T07:10:45Z | 2ab7191a659e4e431098d530b6376c753b8616dd | [
"port_strategy::tests::serial_strategy_with_range",
"port_strategy::tests::random_strategy_with_range",
"port_strategy::range_iterator::tests::range_iterator_iterates_through_the_entire_range"
] | [
"input::tests::opts_merge_optional_arguments",
"input::tests::opts_no_merge_when_config_is_ignored",
"input::tests::opts_merge_required_arguments",
"port_strategy::tests::serial_strategy_with_ports",
"port_strategy::tests::random_strategy_with_ports",
"scanner::socket_iterator::tests::goes_through_every_i... | [] | [] | |
sqlpage/SQLPage | 544 | sqlpage__SQLPage-544 | [
"529"
] | 471158f8722a01e7ee848d818e357f6b8ff00273 | diff --git /dev/null b/examples/handle-404/api/404.sql
new file mode 100644
--- /dev/null
+++ b/examples/handle-404/api/404.sql
@@ -0,0 +1,9 @@
+SELECT 'debug' AS component,
+ 'api/404.sql' AS serving_file,
+ sqlpage.path() AS request_path;
+
+SELECT 'button' AS component;
+SELECT
+ 'Back home' AS title,
+ ... | diff --git /dev/null b/tests/404.sql
new file mode 100644
--- /dev/null
+++ b/tests/404.sql
@@ -0,0 +1,3 @@
+SELECT 'alert' AS component,
+ 'We almost got an oopsie' AS title,
+ 'But the `404.sql` file saved the day!' AS description_md;
diff --git a/tests/index.rs b/tests/index.rs
--- a/tests/index.rs
+++ b/test... | allow catch all `.sql` files for custom routing
What are you building with SQLPage ?
I'd like to build a [pixiecore api](https://github.com/danderson/netboot/blob/main/pixiecore/README.api.md#api-specification) server based on SQL Page.
What is your problem ? A description of the problem, not the solution you are... | Hi !
That would indeed be a nice feature, and has been asked before (in various forms).
Until this is implemented, the best way to make this work is to [use a reverse proxy](https://sql.ophir.dev/your-first-sql-website/nginx.sql) like nginx:
```nginx
server {
listen 80;
server_name yourdomain.c... | 2024-08-19T06:28:51Z | 0.27 | 2024-08-22T19:30:48Z | 471158f8722a01e7ee848d818e357f6b8ff00273 | [
"test_404_fallback"
] | [
"app_config::test::test_encode_uri",
"app_config::test_normalize_site_prefix",
"app_config::test::test_normalize_site_prefix",
"app_config::test::test_default_site_prefix",
"dynamic_component::tests::test_dynamic_properties_to_vec",
"dynamic_component::tests::test_parse_dynamic_array_json_strings",
"dyn... | [] | [] |
sqlpage/SQLPage | 370 | sqlpage__SQLPage-370 | [
"333"
] | 8add49dc524d94c2c72571f7917bcc28a38671ef | diff --git a/examples/official-site/sqlpage/migrations/23_uploaded_file_functions.sql b/examples/official-site/sqlpage/migrations/23_uploaded_file_functions.sql
--- a/examples/official-site/sqlpage/migrations/23_uploaded_file_functions.sql
+++ b/examples/official-site/sqlpage/migrations/23_uploaded_file_functions.sql
@... | diff --git a/tests/index.rs b/tests/index.rs
--- a/tests/index.rs
+++ b/tests/index.rs
@@ -284,6 +284,28 @@ async fn test_upload_file_data_url() -> actix_web::Result<()> {
Ok(())
}
+#[actix_web::test]
+async fn test_uploaded_file_name() -> actix_web::Result<()> {
+ let req = get_request_to("/tests/uploaded_f... | Preserve file name on file upload
**_What are you building with SQLPage ?_**
I have a suite of apps I use to help me transfer data between devices.
* It's not for sharing secrets, it's for convenience only. Not recommended to paste and private info...
ie, I can paste something from the clip board on my PC to th... | Hi !
Indeed, I agree we should have an `uploaded_file_name` function. It shouldn't be hard to add in [`functions.rs`](https://github.com/lovasoa/SQLpage/blob/main/src/webserver/database/sqlpage_functions/functions.rs). Do you want to have a stab at implementing it, and opening a PR ?
The files are stored as [`Tem... | 2024-06-03T06:53:51Z | 0.22 | 2024-06-09T04:45:36Z | 8add49dc524d94c2c72571f7917bcc28a38671ef | [
"test_uploaded_file_name"
] | [
"app_config::test_normalize_site_prefix",
"dynamic_component::tests::test_dynamic_properties_to_vec",
"dynamic_component::tests::test_parse_dynamic_array_json_strings",
"dynamic_component::tests::test_dynamic_properties_to_result_vec",
"webserver::database::csv_import::test_make_statement",
"dynamic_compo... | [] | [] |
sqlpage/SQLPage | 253 | sqlpage__SQLPage-253 | [
"251"
] | 9abc9f8db00ee353c5c1310f31d56ba29c11ae4f | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,9 +2,15 @@
## 0.20.0 (unreleased)
+ - **file inclusion**. This is a long awaited feature that allows you to include the contents of one file in another. This is useful to factorize common parts of your website, such as the header,... | diff --git /dev/null b/src/dynamic_component.rs
new file mode 100644
--- /dev/null
+++ b/src/dynamic_component.rs
@@ -0,0 +1,166 @@
+use anyhow::{self, Context as _};
+use serde_json::Value as JsonValue;
+
+use crate::webserver::database::DbItem;
+
+pub fn parse_dynamic_rows(row: DbItem) -> impl Iterator<Item = DbItem>... | Probe component
A debug component that displays a value (constant, variable, parameter value, result of an SQL function, e.g.). Usefull to validate data flow or function behaviour. Each value (except NULL value) is surrounded by double quotes and followed by datatype (number, string, boolean, e.g.).
| Is there something that you don't like in the existing `debug` component?
Not really the same finality. The debug component is practical to display and control parameters passed to a component. The Probe component is more generic and her work is just to display a value with additional informations (name, datatype, str... | 2024-03-04T23:47:37Z | 0.20 | 2024-03-12T10:50:43Z | 651d96b6482a8cfad4b21e7a0a8a60aad7f1ba06 | [
"test_files"
] | [
"template_helpers::test_rfc2822_date",
"webserver::database::sql::test::is_own_placeholder",
"webserver::database::csv_import::test_make_statement",
"templates::test_split_template",
"webserver::database::sql::test::test_statement_rewrite_sqlite",
"webserver::database::sql::test::test_static_extract",
"... | [] | [] |
sqlpage/SQLPage | 139 | sqlpage__SQLPage-139 | [
"24"
] | ad0fc2c981e18686d6a7be10e5e5a1569ef55628 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,28 @@
# CHANGELOG.md
-## 0.16.1
+## unreleased
+
+### Uploads
+
+This release is all about a long awaited feature: file uploads.
+Your SQLPage website can now accept file uploads from users, store them either in a directory or ... | diff --git a/configuration.md b/configuration.md
--- a/configuration.md
+++ b/configuration.md
@@ -28,6 +29,9 @@ but in uppercase.
The environment variable name can optionally be prefixed with `SQLPAGE_`.
+Additionnally, when troubleshooting, you can set the [`RUST_LOG`](https://docs.rs/env_logger/latest/env_logge... | file uploads
Hello,
Is it possible to integrate a "files" or "uploads" component that would make it possible to upload a file via the form?
Each file could be stored in a "uploads" folder (by default) and metadata in a table named "uploads" (by default) with the following fields (e.g.) : id, uuid-name, date-created.... | Hi !
Yes, handling uploads is on the roadmap. But I'm not a huge fan of the `uploads` folder and the `uploads` table.
SQLPage is completely agnostic to your database or folder structure so far, and I'd like it to stay this way. You can use sqlpage with a read-only database, you can use it with a database on wh... | 2023-11-23T07:40:51Z | 0.16 | 2023-11-24T22:49:57Z | 42f20563b786b830af039e069094fbd3d08088ea | [
"test_file_upload",
"test_files"
] | [
"webserver::database::sql::test::is_own_placeholder",
"templates::test_split_template",
"webserver::database::sql::test::test_statement_rewrite_sqlite",
"webserver::database::sql::test::test_mssql_statement_rewrite",
"webserver::database::sql::test::test_set_variable",
"webserver::database::sql::test::tes... | [] | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.