From 117472ebefd0f4756c79b4e0a0a7162b9feba8a3 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 3 May 2025 20:08:19 -0400 Subject: [PATCH 1/7] v2: add xtask --- .cargo/config.toml | 9 + .vscode/settings.json | 12 +- crates/xtask/Cargo.toml | 19 ++ crates/xtask/README.md | 9 + crates/xtask/src/generate_keywords.rs | 314 ++++++++++++++++++++++++++ crates/xtask/src/main.rs | 44 ++++ crates/xtask/src/new_lint.rs | 201 +++++++++++++++++ crates/xtask/src/path_util.rs | 12 + crates/xtask/src/sync_kwlist.rs | 69 ++++++ 9 files changed, 682 insertions(+), 7 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 crates/xtask/Cargo.toml create mode 100644 crates/xtask/README.md create mode 100644 crates/xtask/src/generate_keywords.rs create mode 100644 crates/xtask/src/main.rs create mode 100644 crates/xtask/src/new_lint.rs create mode 100644 crates/xtask/src/path_util.rs create mode 100644 crates/xtask/src/sync_kwlist.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..08efeb01 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,9 @@ +[alias] +xtask = "run --package xtask --" + +# wasm won't compile with lld +[target.wasm32-unknown-unknown] +rustflags = ["-Clink-arg=--no-entry"] + +[build] +rustflags = ["-Clink-arg=-fuse-ld=lld"] diff --git a/.vscode/settings.json b/.vscode/settings.json index 32d17212..7fbf88e3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,14 +1,12 @@ { "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", - "rust-analyzer.checkOnSave.command": "clippy", - "rust-analyzer.checkOnSave.extraArgs": [ - "--all-features", - "--", - "-D", - "clippy::pedantic" - ], + "rust-analyzer.check.command": "build", + "rust-analyzer.showSyntaxTree": true, "[rust]": { "editor.defaultFormatter": "rust-lang.rust-analyzer" + }, + "[sql]": { + "editor.tabSize": 2 } } diff --git a/crates/xtask/Cargo.toml b/crates/xtask/Cargo.toml new file mode 100644 index 00000000..5db15358 --- /dev/null +++ b/crates/xtask/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "xtask" +version = "0.1.0" + +authors.workspace = true +edition.workspace = true +license.workspace = true +rust-version.workspace = true + +[dependencies] +anyhow.workspace = true +clap.workspace = true +enum-iterator.workspace = true +reqwest = { version = "0.12.9", features = ["blocking", "json"] } +serde.workspace = true +convert_case.workspace = true + +[lints] +workspace = true diff --git a/crates/xtask/README.md b/crates/xtask/README.md new file mode 100644 index 00000000..22a958a1 --- /dev/null +++ b/crates/xtask/README.md @@ -0,0 +1,9 @@ +# xtask + +> see + +Run via: + +```sh +cargo xtask --help +``` diff --git a/crates/xtask/src/generate_keywords.rs b/crates/xtask/src/generate_keywords.rs new file mode 100644 index 00000000..8c4c20b9 --- /dev/null +++ b/crates/xtask/src/generate_keywords.rs @@ -0,0 +1,314 @@ +use crate::path_util::cwd_to_workspace_root; +use anyhow::{Context, Ok, Result}; +use enum_iterator::{all, Sequence}; +use std::collections::{HashMap, HashSet}; + +struct KeywordMeta { + category: KeywordCategory, + label: KeywordLabel, +} + +enum KeywordLabel { + As, + Bare, +} + +/// related: +/// - [postgres/src/backend/utils/adt/misc.c](https://github.com/postgres/postgres/blob/08691ea958c2646b6aadefff878539eb0b860bb0/src/backend/utils/adt/misc.c#L452-L467/) +/// - [postgres docs: sql keywords appendix](https://www.postgresql.org/docs/17/sql-keywords-appendix.html) +/// +/// The header file isn't enough though because `json_scalar` can be a function +/// name, but `between` cannot be +/// +/// The Postgres parser special cases certain calls like `json_scalar`: +/// +/// +/// | Category | Column | Table | Function | Type | +/// |--------------|--------|-------|----------|------| +/// | Unreserved | Y | Y | Y | Y | +/// | Reserved | N | N | N | N | +/// | ColName | Y | Y | N | Y | +/// | TypeFuncName | N | N | Y | Y | +/// +#[derive(Clone, Copy)] +enum KeywordCategory { + Unreserved, + Reserved, + ColName, + TypeFuncName, +} + +#[derive(Sequence, PartialEq)] +enum KWType { + ColumnTable, + Type, +} + +impl std::fmt::Display for KWType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + KWType::ColumnTable => "COLUMN_OR_TABLE_KEYWORDS", + KWType::Type => "TYPE_KEYWORDS", + }) + } +} + +fn keyword_allowed(cat: KeywordCategory, kw_type: KWType) -> bool { + match cat { + KeywordCategory::Unreserved => match kw_type { + KWType::ColumnTable => true, + KWType::Type => true, + }, + KeywordCategory::Reserved => match kw_type { + KWType::ColumnTable => false, + KWType::Type => false, + }, + KeywordCategory::ColName => match kw_type { + KWType::ColumnTable => true, + KWType::Type => true, + }, + KeywordCategory::TypeFuncName => match kw_type { + KWType::ColumnTable => false, + KWType::Type => true, + }, + } +} + +pub(crate) fn generate_keywords() -> Result<()> { + let keywords = parse_header()?; + + update_syntax_kind(&keywords) +} + +fn update_syntax_kind(keywords: &HashMap) -> Result<()> { + let path = "crates/parser/src/syntax_kind.rs"; + + let data = std::fs::read_to_string(path)?; + + let mut keys: Vec<_> = keywords.keys().collect(); + keys.sort(); + + let keywords_start = "// keywords"; + let keywords_end = "// literals"; + let mut in_keywords = false; + + let from_kw_start = "pub(crate) fn from_keyword"; + let from_kw_end = "} else {"; + let mut in_from_keyword = false; + let mut is_first_from_keyword_case = true; + + let token_set_start = "// Generated TokenSet start"; + let token_set_end = "// Generated TokenSet end"; + let mut in_token_sets = false; + + let mut allowed_col_table_tokens = HashSet::new(); + let mut allowed_type_tokens = HashSet::new(); + let mut bare_label_keywords = keywords + .iter() + .filter(|(_key, value)| match value.label { + KeywordLabel::As => false, + KeywordLabel::Bare => true, + }) + .map(|(key, _value)| key) + .collect::>(); + bare_label_keywords.sort(); + + let mut unreserved_keywords = keywords + .iter() + .filter(|(_key, value)| matches!(value.category, KeywordCategory::Unreserved)) + .map(|(key, _value)| key) + .collect::>(); + unreserved_keywords.sort(); + + let mut reserved_keywords = keywords + .iter() + .filter(|(_key, value)| matches!(value.category, KeywordCategory::Reserved)) + .map(|(key, _value)| key) + .collect::>(); + reserved_keywords.sort(); + + let mut all_keywords = keywords.iter().map(|(key, _value)| key).collect::>(); + all_keywords.sort(); + + for (key, meta) in keywords { + for variant in all::() { + match variant { + KWType::ColumnTable => { + if keyword_allowed(meta.category, variant) { + allowed_col_table_tokens.insert(key); + } + } + KWType::Type => { + if keyword_allowed(meta.category, variant) { + allowed_type_tokens.insert(key); + } + } + } + } + } + + let mut out = vec![]; + + for line in data.lines() { + if line.contains(keywords_end) { + for kw in keys.iter() { + // /// `column` + // COLUMN_KW, + let comment = format!(" /// `{}`\n", kw); + let ident = format!(" {},", kw.to_uppercase() + "_KW"); + out.push(comment + &ident); + } + out.push("".to_string()); + + in_keywords = false; + } else if line.contains(from_kw_end) { + let mut keys: Vec<_> = keywords.keys().collect(); + keys.sort(); + for kw in keys { + // } else if ident.eq_ignore_ascii_case("when") { + // SyntaxKind::WHEN_KW + let cond_op = if is_first_from_keyword_case { + "let kw = if" + } else { + "} else if" + }; + + let cond = format!( + r#" {} ident.eq_ignore_ascii_case("{}") {{"#, + cond_op, kw + ) + "\n"; + let ident = format!(" SyntaxKind::{}", kw.to_uppercase() + "_KW"); + out.push(cond + &ident); + + is_first_from_keyword_case = false; + } + + in_from_keyword = false; + } else if line.contains(token_set_end) { + for variant in all::() { + out.push(format!( + "pub(crate) const {}: TokenSet = TokenSet::new(&[", + variant + )); + let mut tokens = match variant { + KWType::ColumnTable => &allowed_col_table_tokens, + KWType::Type => &allowed_type_tokens, + } + .iter() + .collect::>(); + + tokens.sort(); + + for tk in tokens { + out.push(format!(" SyntaxKind::{},", tk.to_uppercase() + "_KW")); + } + out.push("]);".to_string()); + out.push("".to_string()); + } + + // all keywords + { + out.push("pub(crate) const ALL_KEYWORDS: TokenSet = TokenSet::new(&[".to_string()); + let tokens = &all_keywords; + for tk in tokens { + out.push(format!(" SyntaxKind::{},", tk.to_uppercase() + "_KW")); + } + out.push("]);".to_string()); + out.push("".to_string()); + } + + { + out.push( + "pub(crate) const BARE_LABEL_KEYWORDS: TokenSet = TokenSet::new(&[".to_string(), + ); + for tk in &bare_label_keywords { + out.push(format!(" SyntaxKind::{},", tk.to_uppercase() + "_KW")); + } + out.push("]);".to_string()); + out.push("".to_string()); + } + + { + out.push( + "pub(crate) const UNRESERVED_KEYWORDS: TokenSet = TokenSet::new(&[".to_string(), + ); + let tokens = &unreserved_keywords; + for tk in tokens { + out.push(format!(" SyntaxKind::{},", tk.to_uppercase() + "_KW")); + } + out.push("]);".to_string()); + out.push("".to_string()); + } + + { + out.push( + "pub(crate) const RESERVED_KEYWORDS: TokenSet = TokenSet::new(&[".to_string(), + ); + let tokens = &reserved_keywords; + for tk in tokens { + out.push(format!(" SyntaxKind::{},", tk.to_uppercase() + "_KW")); + } + out.push("]);".to_string()); + out.push("".to_string()); + } + + out.push(line.to_string()); + } + if !in_keywords && !in_from_keyword && !in_token_sets { + out.push(line.to_string()); + } + if line.contains(keywords_start) { + in_keywords = true; + } else if line.contains(from_kw_start) { + in_from_keyword = true; + } else if line.contains(token_set_start) { + in_token_sets = true; + } + } + + std::fs::write(path, out.join("\n") + "\n").context("writing to syntax_kind.rs") +} + +fn parse_header() -> Result> { + cwd_to_workspace_root().context("Failed to cwd to root")?; + + let data = std::fs::read_to_string("postgres/kwlist.h").context("Failed to read kwlist.h")?; + + let mut keywords = HashMap::new(); + + for line in data.lines() { + if line.starts_with("PG_KEYWORD") { + let line = line + .split(&['(', ')']) + .nth(1) + .context("Invalid kwlist.h structure")?; + + let row_items: Vec<&str> = line.split(',').collect(); + + match row_items[..] { + [name, _value, category, is_bare_label] => { + let label = match is_bare_label.trim() { + "AS_LABEL" => KeywordLabel::As, + "BARE_LABEL" => KeywordLabel::Bare, + unexpected => anyhow::bail!("Unexpected label: {}", unexpected), + }; + + let category = match category.trim() { + "UNRESERVED_KEYWORD" => KeywordCategory::Unreserved, + "RESERVED_KEYWORD" => KeywordCategory::Reserved, + "COL_NAME_KEYWORD" => KeywordCategory::ColName, + "TYPE_FUNC_NAME_KEYWORD" => KeywordCategory::TypeFuncName, + unexpected => anyhow::bail!("Unexpected category: {}", unexpected), + }; + + let meta = KeywordMeta { category, label }; + let name = name.trim().replace('\"', ""); + keywords.insert(name, meta); + } + _ => anyhow::bail!("Problem reading kwlist.h row"), + } + } + } + + Ok(keywords) +} diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs new file mode 100644 index 00000000..7ecfdbc1 --- /dev/null +++ b/crates/xtask/src/main.rs @@ -0,0 +1,44 @@ +use anyhow::Result; +// see: https://github.com/matklad/cargo-xtask +use clap::{arg, Args, Parser, Subcommand}; +use generate_keywords::generate_keywords; +use new_lint::new_lint; +use sync_kwlist::sync_kwlist; + +mod generate_keywords; +mod new_lint; +mod path_util; +mod sync_kwlist; + +#[derive(Subcommand, Debug)] +enum TaskName { + #[command(long_about = "Generate code for keywords using the Postgres kwlist.h")] + GenerateKeywords, + #[command(long_about = "Fetch the latest version of kwlist.h from Postgres")] + SyncKwlist, + #[command(long_about = "Create a new linter rule")] + NewLint(NewLintArgs), +} + +#[derive(Args, Debug)] +struct NewLintArgs { + #[arg(required = true)] + name: String, +} + +#[derive(Parser, Debug)] +#[command(version, about)] +struct Arguments { + /// The task to perform + #[command(subcommand)] + task: TaskName, +} + +fn main() -> Result<()> { + let args = Arguments::parse(); + match args.task { + TaskName::GenerateKeywords => generate_keywords(), + TaskName::SyncKwlist => sync_kwlist(), + TaskName::NewLint(args) => new_lint(args), + } +} diff --git a/crates/xtask/src/new_lint.rs b/crates/xtask/src/new_lint.rs new file mode 100644 index 00000000..1774bba6 --- /dev/null +++ b/crates/xtask/src/new_lint.rs @@ -0,0 +1,201 @@ +use anyhow::{Context, Result}; +use convert_case::{Case, Casing}; + +use crate::NewLintArgs; +use std::{ + fs, + path::{Path, PathBuf}, +}; + +fn make_lint(name: &str) -> String { + format!( + r###" +use squawk_syntax::{{ + ast::{{self, AstNode, HasModuleItem}}, + Parse, SourceFile, +}}; + +use crate::{{Linter, Violation, ErrorCode}}; + +pub(crate) fn {rule_name}(ctx: &mut Linter, parse: &Parse) {{ + let file = parse.tree(); + for item in file.items() {{ + match item {{ + // TODO: + _ => (), + }} + }} +}} + +#[cfg(test)] +mod test {{ + use insta::assert_debug_snapshot; + + use crate::{{Linter, Rule, ErrorCode}}; + use squawk_syntax::SourceFile; + + #[test] + fn err() {{ + let sql = r#" + -- TODO: err sql + "#; + let file = SourceFile::parse(sql); + let mut linter = Linter::from([Rule::{rule_name_pascal}]); + let errors = linter.lint(file, sql); + assert_ne!(linter.errors.len(), 0); + assert_debug_snapshot!(linter.errors); + }} + + #[test] + fn ok() {{ + let sql = r#" + -- TODO: ok sql + "#; + let file = SourceFile::parse(sql); + let mut linter = Linter::from([Rule::{rule_name_pascal}]); + let errors = linter.lint(file, sql); + assert_eq!(linter.errors.len(), 0); + }} +}} +"###, + rule_name = name, + rule_name_pascal = name.to_case(Case::Pascal), + ) +} + +fn crates_path() -> Result { + let current_file = Path::new(file!()); + let path = current_file + .ancestors() + // crates/xtask/src/new_lint + // ^ from + // ^ to + .nth(3) + .context("couldn't get root of crate") + .unwrap(); + Ok(PathBuf::from(path)) +} + +fn create_rule_file(name: &str) -> Result<()> { + let crates = crates_path()?; + let lint_path = crates.join(format!("squawk_linter/src/rules/{}.rs", name)); + + if fs::exists(&lint_path)? { + println!("skipping file creation, it already exists"); + return Ok(()); + } + + let lint_data = make_lint(name); + fs::write(&lint_path, lint_data)?; + println!("created file"); + Ok(()) +} + +fn update_lib(name: &str) -> Result<()> { + let crates = crates_path()?; + let lib = crates.join("squawk_linter/src/lib.rs"); + let mut file_content = fs::read_to_string(&lib)?; + + let name_snake = name.to_case(Case::Snake); + let name_kebab = name.to_case(Case::Kebab); + let name_pascal = name.to_case(Case::Pascal); + + let replacements = [ + ( + "// xtask:new-lint:rule-import", + format!( + "use rules::{name_snake}; +", + name_snake = name_snake, + ), + ), + ( + "// xtask:new-lint:error-name", + format!( + r#"#[serde(rename = "{name_kebab}")] + {name_pascal}, + "#, + name_kebab = name_kebab, + name_pascal = name_pascal, + ), + ), + ( + "// xtask:new-lint:str-name", + format!( + r#""{name_kebab}" => Ok(ErrorCode::{name_pascal}), + "#, + name_kebab = name_kebab, + name_pascal = name_pascal, + ), + ), + ( + "// xtask:new-lint:name", + format!( + r#"{name_pascal}, + "#, + name_pascal = name_pascal, + ), + ), + ( + "// xtask:new-lint:rule-call", + format!( + r#"if self.rules.contains(&Rule::{name_pascal}) {{ + {name_snake}(self, &file); + }} + "#, + name_pascal = name_pascal, + name_snake = name_snake, + ), + ), + ]; + + for (marker, replacement) in replacements { + file_content = file_content.replace(marker, &(replacement + marker)) + } + + fs::write(&lib, file_content)?; + + Ok(()) +} + +fn update_rules_mod(name: &str) -> Result<()> { + let crates = crates_path()?; + let lib = crates.join("squawk_linter/src/rules/mod.rs"); + let mut file_content = fs::read_to_string(&lib)?; + + let name_snake = name.to_case(Case::Snake); + + let replacements = [ + ( + "// xtask:new-lint:mod-decl", + format!("pub(crate) mod {name_snake};\n", name_snake = name_snake), + ), + ( + "// xtask:new-lint:export", + format!( + "pub(crate) use {name_snake}::{name_snake};\n", + name_snake = name_snake + ), + ), + ]; + + for (marker, replacement) in replacements { + file_content = file_content.replace(marker, &(replacement + marker)) + } + + fs::write(&lib, file_content)?; + + Ok(()) +} + +pub(crate) fn new_lint(args: NewLintArgs) -> Result<()> { + let name = args.name; + + create_rule_file(&name)?; + + update_lib(&name)?; + + update_rules_mod(&name)?; + + Ok(()) +} diff --git a/crates/xtask/src/path_util.rs b/crates/xtask/src/path_util.rs new file mode 100644 index 00000000..e5e99d3b --- /dev/null +++ b/crates/xtask/src/path_util.rs @@ -0,0 +1,12 @@ +use std::io; + +// via: https://github.com/rust-lang/cargo/blob/3fe68eabf93cbf3772bbcad09a9206c783e2de3f/crates/xtask-build-man/src/main.rs#L80-L84 +/// +/// Change to workspace root. +/// +/// Assumed this xtask is located in `[WORKSPACE]/crates/xtask`. +pub(crate) fn cwd_to_workspace_root() -> io::Result<()> { + let pkg_root = std::env!("CARGO_MANIFEST_DIR"); + let ws_root = format!("{pkg_root}/../.."); + std::env::set_current_dir(ws_root) +} diff --git a/crates/xtask/src/sync_kwlist.rs b/crates/xtask/src/sync_kwlist.rs new file mode 100644 index 00000000..203e8ab3 --- /dev/null +++ b/crates/xtask/src/sync_kwlist.rs @@ -0,0 +1,69 @@ +use anyhow::{Context, Result}; +use reqwest::header::USER_AGENT; +use serde::Deserialize; + +pub(crate) fn sync_kwlist() -> Result<()> { + latest_pg_git_sha()?; + Ok(()) +} + +use std::fs; +use std::io::Write; + +use crate::path_util::cwd_to_workspace_root; + +#[derive(Deserialize, Debug)] +struct CommitResponse { + sha: String, + commit: Commit, +} + +#[derive(Deserialize, Debug)] +struct Commit { + committer: Commiter, +} + +#[derive(Deserialize, Debug)] +struct Commiter { + date: String, +} + +fn latest_pg_git_sha() -> Result<()> { + let client = reqwest::blocking::Client::new(); + let response = client + .get("https://api.github.com/repos/postgres/postgres/commits/master") + .header(USER_AGENT, "squawk xtask sync-kwlist") + .send()?; + + let res: CommitResponse = response.json()?; + + let file_response = client + .get(format!( + "https://raw.githubusercontent.com/postgres/postgres/{}/src/include/parser/kwlist.h", + res.sha + )) + .send()?; + + let file_content = file_response.text()?; + + cwd_to_workspace_root().context("Failed to cwd to root")?; + + let preamble = format!( + r"// synced from: +// commit: {} +// committed at: {} +// file: https://github.com/postgres/postgres/blob/{}/src/include/parser/kwlist.h +// +// update via: +// cargo xtask sync-kwlist + +", + res.sha, res.commit.committer.date, res.sha + ) + .to_owned(); + + let mut file = fs::File::create("postgres/kwlist.h")?; + file.write_all((preamble + &file_content).as_bytes())?; + + Ok(()) +} From 5572a4a065e2592ae4a55f47b7cdcae007726528 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 3 May 2025 20:24:42 -0400 Subject: [PATCH 2/7] fix ci --- .cargo/config.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index 08efeb01..4c352d8c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,5 +5,9 @@ xtask = "run --package xtask --" [target.wasm32-unknown-unknown] rustflags = ["-Clink-arg=--no-entry"] +# github actions won't compile with lld +[target.x86_64-unknown-linux-gnu] +rustflags = ["-Clink-arg=--no-entry"] + [build] rustflags = ["-Clink-arg=-fuse-ld=lld"] From 73734ee82da6816718b88d667842e79739fde7a8 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 3 May 2025 20:35:15 -0400 Subject: [PATCH 3/7] try something else to get ci working --- .cargo/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 4c352d8c..422a882d 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -7,7 +7,7 @@ rustflags = ["-Clink-arg=--no-entry"] # github actions won't compile with lld [target.x86_64-unknown-linux-gnu] -rustflags = ["-Clink-arg=--no-entry"] +rustflags = [] [build] rustflags = ["-Clink-arg=-fuse-ld=lld"] From 368d1909baba6d07682c1e8c5142f2bc3958d5ad Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 3 May 2025 20:36:46 -0400 Subject: [PATCH 4/7] maybe --- .cargo/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 422a882d..0a18805b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -7,7 +7,7 @@ rustflags = ["-Clink-arg=--no-entry"] # github actions won't compile with lld [target.x86_64-unknown-linux-gnu] -rustflags = [] +rustflags = [""] [build] rustflags = ["-Clink-arg=-fuse-ld=lld"] From c2c4c0d262792d7d744a32e426ba44a476b8f1b7 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 3 May 2025 20:41:25 -0400 Subject: [PATCH 5/7] fix? --- .cargo/config.toml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 0a18805b..f704e2c7 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,13 +1,6 @@ [alias] xtask = "run --package xtask --" -# wasm won't compile with lld -[target.wasm32-unknown-unknown] -rustflags = ["-Clink-arg=--no-entry"] - -# github actions won't compile with lld -[target.x86_64-unknown-linux-gnu] -rustflags = [""] - -[build] +# only set it up for local because wasm and github actions don't like lld +[target.aarch64-apple-darwin] rustflags = ["-Clink-arg=-fuse-ld=lld"] From 303bd6f9ee7d89fc4cb01eb48d60ec14819363bb Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 3 May 2025 20:44:13 -0400 Subject: [PATCH 6/7] forget it --- .cargo/config.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index f704e2c7..35049cbc 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,6 +1,2 @@ [alias] xtask = "run --package xtask --" - -# only set it up for local because wasm and github actions don't like lld -[target.aarch64-apple-darwin] -rustflags = ["-Clink-arg=-fuse-ld=lld"] From e51d6817f56d17dd8324936d4e9913f370bc56af Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 3 May 2025 20:44:34 -0400 Subject: [PATCH 7/7] fix --- crates/xtask/src/generate_keywords.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/xtask/src/generate_keywords.rs b/crates/xtask/src/generate_keywords.rs index 8c4c20b9..964272ed 100644 --- a/crates/xtask/src/generate_keywords.rs +++ b/crates/xtask/src/generate_keywords.rs @@ -151,7 +151,7 @@ fn update_syntax_kind(keywords: &HashMap) -> Result<()> { for line in data.lines() { if line.contains(keywords_end) { - for kw in keys.iter() { + for kw in &keys { // /// `column` // COLUMN_KW, let comment = format!(" /// `{}`\n", kw);