[wgsl] update reserved list to latest CR

This commit is contained in:
teoxoy authored and Teodor Tanasoaia committed 2026-01-28 12:00:35 +01:00
1 parent 17e3d2e2f2
commit c20919c5ee
4 files changed
+34 -83

No files matched your search

+10 -59
View File
@@ -7,60 +7,18 @@ Keywords for [WGSL][wgsl] (WebGPU Shading Language).
use crate::proc::KeywordSet;
use crate::racy_lock::RacyLock;
// https://gpuweb.github.io/gpuweb/wgsl/#keyword-summary
// last sync: https://github.com/gpuweb/gpuweb/blob/39f2321f547c8f0b7f473cf1d47fba30b1691303/wgsl/index.bs
// last sync: https://www.w3.org/TR/2025/CRD-WGSL-20250809/#keyword-summary
pub const RESERVED: &[&str] = &[
// Type-defining Keywords
"array",
"atomic",
"bool",
"f32",
"f16",
"i32",
"i64",
"mat2x2",
"mat2x3",
"mat2x4",
"mat3x2",
"mat3x3",
"mat3x4",
"mat4x2",
"mat4x3",
"mat4x4",
"ptr",
"sampler",
"sampler_comparison",
"texture_1d",
"texture_2d",
"texture_2d_array",
"texture_3d",
"texture_cube",
"texture_cube_array",
"texture_external",
"texture_multisampled_2d",
"texture_storage_1d",
"texture_storage_2d",
"texture_storage_2d_array",
"texture_storage_3d",
"texture_depth_2d",
"texture_depth_2d_array",
"texture_depth_cube",
"texture_depth_cube_array",
"texture_depth_multisampled_2d",
"u32",
"u64",
"vec2",
"vec3",
"vec4",
// Other Keywords
// Keywords
"alias",
"bitcast",
"break",
"case",
"const",
"const_assert",
"continue",
"continuing",
"default",
"diagnostic",
"discard",
"else",
"enable",
@@ -71,20 +29,14 @@ pub const RESERVED: &[&str] = &[
"let",
"loop",
"override",
"requires",
"return",
"static_assert",
"struct",
"switch",
"true",
"type",
"var",
"while",
// Reserved Words
"CompileShader",
"ComputeShader",
"DomainShader",
"GeometryShader",
"Hullshader",
// Reserved
"NULL",
"Self",
"abstract",
@@ -99,7 +51,6 @@ pub const RESERVED: &[&str] = &[
"auto",
"await",
"become",
"binding_array",
"cast",
"catch",
"class",
@@ -140,13 +91,11 @@ pub const RESERVED: &[&str] = &[
"get",
"goto",
"groupshared",
"handle",
"highp",
"impl",
"implements",
"import",
"inline",
"inout",
"instanceof",
"interface",
"layout",
@@ -167,6 +116,8 @@ pub const RESERVED: &[&str] = &[
"noexcept",
"noinline",
"nointerpolation",
"non_coherent",
"noncoherent",
"noperspective",
"null",
"nullptr",
@@ -190,13 +141,12 @@ pub const RESERVED: &[&str] = &[
"regardless",
"register",
"reinterpret_cast",
"requires",
"require",
"resource",
"restrict",
"self",
"set",
"shared",
"signed",
"sizeof",
"smooth",
"snorm",
@@ -213,6 +163,7 @@ pub const RESERVED: &[&str] = &[
"throw",
"trait",
"try",
"type",
"typedef",
"typeid",
"typename",
+20 -20
View File
@@ -736,13 +736,13 @@ fn reserved_keyword() {
// global var
check(
r#"
var bool: bool = true;
var case: bool = true;
"#,
r###"error: name `bool` is a reserved keyword
r###"error: name `case` is a reserved keyword
┌─ wgsl:2:17
│
2 │ var bool: bool = true;
│ ^^^^ definition of `bool`
2 │ var case: bool = true;
│ ^^^^ definition of `case`
"###,
);
@@ -768,14 +768,14 @@ fn reserved_keyword() {
check(
r#"
fn foo() {
let atomic: f32 = 1.0;
let enable: f32 = 1.0;
}
"#,
r###"error: name `atomic` is a reserved keyword
r###"error: name `enable` is a reserved keyword
┌─ wgsl:3:21
│
3 │ let atomic: f32 = 1.0;
│ ^^^^^^ definition of `atomic`
3 │ let enable: f32 = 1.0;
│ ^^^^^^ definition of `enable`
"###,
);
@@ -784,14 +784,14 @@ fn reserved_keyword() {
check(
r#"
fn foo() {
var sampler: f32 = 1.0;
var default: f32 = 1.0;
}
"#,
r###"error: name `sampler` is a reserved keyword
r###"error: name `default` is a reserved keyword
┌─ wgsl:3:21
│
3 │ var sampler: f32 = 1.0;
│ ^^^^^^^ definition of `sampler`
3 │ var default: f32 = 1.0;
│ ^^^^^^^ definition of `default`
"###,
);
@@ -813,13 +813,13 @@ fn reserved_keyword() {
// struct
check(
r#"
struct array {}
struct override {}
"#,
r###"error: name `array` is a reserved keyword
r###"error: name `override` is a reserved keyword
┌─ wgsl:2:20
│
2 │ struct array {}
│ ^^^^^ definition of `array`
2 │ struct override {}
│ ^^^^^^^^ definition of `override`
"###,
);
@@ -827,13 +827,13 @@ fn reserved_keyword() {
// struct member
check(
r#"
struct Foo { sampler: f32 }
struct Foo { switch: f32 }
"#,
r###"error: name `sampler` is a reserved keyword
r###"error: name `switch` is a reserved keyword
┌─ wgsl:2:26
│
2 │ struct Foo { sampler: f32 }
│ ^^^^^^^ definition of `sampler`
2 │ struct Foo { switch: f32 }
│ ^^^^^^ definition of `switch`
"###,
);
@@ -7,7 +7,7 @@ struct a_buf {
}
struct TestStruct {
array_: array<vec4<u32>, 2>,
array: array<vec4<u32>, 2>,
}
struct FragmentOutput {
@@ -402,7 +402,7 @@ fn indexConstantNonConstantIndex(i: i32) {
i_1 = i;
let _e2 = i_1;
let _e7 = local_5.array_[_e2];
let _e7 = local_5.array[_e2];
a_26 = _e7;
return;
}
@@ -1,7 +1,7 @@
const array_: array<f32, 2> = array<f32, 2>(1f, 2f);
const array: array<f32, 2> = array<f32, 2>(1f, 2f);
fn main_1() {
var local: array<f32, 2> = array_;
var local: array<f32, 2> = array;
return;
}