diff options
Diffstat (limited to 'xtask')
-rw-r--r-- | xtask/Cargo.toml | 2 | ||||
-rw-r--r-- | xtask/src/ast_src.rs | 4 | ||||
-rw-r--r-- | xtask/src/codegen/gen_assists_docs.rs | 4 | ||||
-rw-r--r-- | xtask/src/main.rs | 12 | ||||
-rw-r--r-- | xtask/tests/tidy.rs | 38 |
5 files changed, 48 insertions, 12 deletions
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 7a2937f0e..4abc7b053 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml | |||
@@ -15,7 +15,7 @@ flate2 = "1.0" | |||
15 | pico-args = "0.3.1" | 15 | pico-args = "0.3.1" |
16 | proc-macro2 = "1.0.8" | 16 | proc-macro2 = "1.0.8" |
17 | quote = "1.0.2" | 17 | quote = "1.0.2" |
18 | ungrammar = "1.6" | 18 | ungrammar = "1.9" |
19 | walkdir = "2.3.1" | 19 | walkdir = "2.3.1" |
20 | write-json = "0.1.0" | 20 | write-json = "0.1.0" |
21 | xshell = "0.1" | 21 | xshell = "0.1" |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 2b8012bdd..0fd1d13e6 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -68,7 +68,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
68 | "as", "async", "await", "box", "break", "const", "continue", "crate", "dyn", "else", | 68 | "as", "async", "await", "box", "break", "const", "continue", "crate", "dyn", "else", |
69 | "enum", "extern", "false", "fn", "for", "if", "impl", "in", "let", "loop", "macro", | 69 | "enum", "extern", "false", "fn", "for", "if", "impl", "in", "let", "loop", "macro", |
70 | "match", "mod", "move", "mut", "pub", "ref", "return", "self", "static", "struct", "super", | 70 | "match", "mod", "move", "mut", "pub", "ref", "return", "self", "static", "struct", "super", |
71 | "trait", "true", "try", "type", "unsafe", "use", "where", "while", | 71 | "trait", "true", "try", "type", "unsafe", "use", "where", "while", "yield", |
72 | ], | 72 | ], |
73 | contextual_keywords: &["auto", "default", "existential", "union", "raw", "macro_rules"], | 73 | contextual_keywords: &["auto", "default", "existential", "union", "raw", "macro_rules"], |
74 | literals: &["INT_NUMBER", "FLOAT_NUMBER", "CHAR", "BYTE", "STRING", "BYTE_STRING"], | 74 | literals: &["INT_NUMBER", "FLOAT_NUMBER", "CHAR", "BYTE", "STRING", "BYTE_STRING"], |
@@ -104,6 +104,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
104 | "MACRO_DEF", | 104 | "MACRO_DEF", |
105 | "PAREN_TYPE", | 105 | "PAREN_TYPE", |
106 | "TUPLE_TYPE", | 106 | "TUPLE_TYPE", |
107 | "MACRO_TYPE", | ||
107 | "NEVER_TYPE", | 108 | "NEVER_TYPE", |
108 | "PATH_TYPE", | 109 | "PATH_TYPE", |
109 | "PTR_TYPE", | 110 | "PTR_TYPE", |
@@ -149,6 +150,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
149 | "LABEL", | 150 | "LABEL", |
150 | "BLOCK_EXPR", | 151 | "BLOCK_EXPR", |
151 | "RETURN_EXPR", | 152 | "RETURN_EXPR", |
153 | "YIELD_EXPR", | ||
152 | "MATCH_EXPR", | 154 | "MATCH_EXPR", |
153 | "MATCH_ARM_LIST", | 155 | "MATCH_ARM_LIST", |
154 | "MATCH_ARM", | 156 | "MATCH_ARM", |
diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs index be218dea1..6e18a50a6 100644 --- a/xtask/src/codegen/gen_assists_docs.rs +++ b/xtask/src/codegen/gen_assists_docs.rs | |||
@@ -86,8 +86,8 @@ impl Assist { | |||
86 | 86 | ||
87 | impl fmt::Display for Assist { | 87 | impl fmt::Display for Assist { |
88 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | 88 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
89 | let before = self.before.replace("<|>", "┃"); // Unicode pseudo-graphics bar | 89 | let before = self.before.replace("$0", "┃"); // Unicode pseudo-graphics bar |
90 | let after = self.after.replace("<|>", "┃"); | 90 | let after = self.after.replace("$0", "┃"); |
91 | writeln!( | 91 | writeln!( |
92 | f, | 92 | f, |
93 | "[discrete]\n=== `{}` | 93 | "[discrete]\n=== `{}` |
diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 3e07daae9..dec48629c 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs | |||
@@ -12,7 +12,7 @@ use std::env; | |||
12 | 12 | ||
13 | use codegen::CodegenCmd; | 13 | use codegen::CodegenCmd; |
14 | use pico_args::Arguments; | 14 | use pico_args::Arguments; |
15 | use xshell::pushd; | 15 | use xshell::{cmd, cp, pushd}; |
16 | use xtask::{ | 16 | use xtask::{ |
17 | codegen::{self, Mode}, | 17 | codegen::{self, Mode}, |
18 | dist::DistCmd, | 18 | dist::DistCmd, |
@@ -124,6 +124,13 @@ FLAGS: | |||
124 | args.finish()?; | 124 | args.finish()?; |
125 | MetricsCmd { dry_run }.run() | 125 | MetricsCmd { dry_run }.run() |
126 | } | 126 | } |
127 | "bb" => { | ||
128 | let suffix: String = args.free_from_str()?.unwrap(); | ||
129 | args.finish()?; | ||
130 | cmd!("cargo build --release").run()?; | ||
131 | cp("./target/release/rust-analyzer", format!("./target/rust-analyzer-{}", suffix))?; | ||
132 | Ok(()) | ||
133 | } | ||
127 | _ => { | 134 | _ => { |
128 | eprintln!( | 135 | eprintln!( |
129 | "\ | 136 | "\ |
@@ -141,7 +148,8 @@ SUBCOMMANDS: | |||
141 | install | 148 | install |
142 | lint | 149 | lint |
143 | dist | 150 | dist |
144 | promote" | 151 | promote |
152 | bb" | ||
145 | ); | 153 | ); |
146 | Ok(()) | 154 | Ok(()) |
147 | } | 155 | } |
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index 7e5b1f7b5..6abad189a 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs | |||
@@ -85,6 +85,7 @@ fn rust_files_are_tidy() { | |||
85 | for path in rust_files(&project_root().join("crates")) { | 85 | for path in rust_files(&project_root().join("crates")) { |
86 | let text = read_file(&path).unwrap(); | 86 | let text = read_file(&path).unwrap(); |
87 | check_todo(&path, &text); | 87 | check_todo(&path, &text); |
88 | check_dbg(&path, &text); | ||
88 | check_trailing_ws(&path, &text); | 89 | check_trailing_ws(&path, &text); |
89 | deny_clippy(&path, &text); | 90 | deny_clippy(&path, &text); |
90 | tidy_docs.visit(&path, &text); | 91 | tidy_docs.visit(&path, &text); |
@@ -94,10 +95,9 @@ fn rust_files_are_tidy() { | |||
94 | 95 | ||
95 | #[test] | 96 | #[test] |
96 | fn check_merge_commits() { | 97 | fn check_merge_commits() { |
97 | let stdout = | 98 | let stdout = cmd!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~19..") |
98 | dbg!(cmd!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~19..")) | 99 | .read() |
99 | .read() | 100 | .unwrap(); |
100 | .unwrap(); | ||
101 | if !stdout.is_empty() { | 101 | if !stdout.is_empty() { |
102 | panic!( | 102 | panic!( |
103 | " | 103 | " |
@@ -224,7 +224,7 @@ Zlib OR Apache-2.0 OR MIT | |||
224 | fn check_todo(path: &Path, text: &str) { | 224 | fn check_todo(path: &Path, text: &str) { |
225 | let need_todo = &[ | 225 | let need_todo = &[ |
226 | // This file itself obviously needs to use todo (<- like this!). | 226 | // This file itself obviously needs to use todo (<- like this!). |
227 | "tests/cli.rs", | 227 | "tests/tidy.rs", |
228 | // Some of our assists generate `todo!()`. | 228 | // Some of our assists generate `todo!()`. |
229 | "handlers/add_turbo_fish.rs", | 229 | "handlers/add_turbo_fish.rs", |
230 | "handlers/generate_function.rs", | 230 | "handlers/generate_function.rs", |
@@ -252,6 +252,32 @@ fn check_todo(path: &Path, text: &str) { | |||
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | fn check_dbg(path: &Path, text: &str) { | ||
256 | let need_dbg = &[ | ||
257 | // This file itself obviously needs to use dbg. | ||
258 | "tests/tidy.rs", | ||
259 | // Assists to remove `dbg!()` | ||
260 | "handlers/remove_dbg.rs", | ||
261 | // We have .dbg postfix | ||
262 | "completion/src/completions/postfix.rs", | ||
263 | // The documentation in string literals may contain anything for its own purposes | ||
264 | "completion/src/lib.rs", | ||
265 | "completion/src/generated_lint_completions.rs", | ||
266 | // test for doc test for remove_dbg | ||
267 | "src/tests/generated.rs", | ||
268 | ]; | ||
269 | if need_dbg.iter().any(|p| path.ends_with(p)) { | ||
270 | return; | ||
271 | } | ||
272 | if text.contains("dbg!") { | ||
273 | panic!( | ||
274 | "\ndbg! macros should not be committed to the master branch,\n\ | ||
275 | {}\n", | ||
276 | path.display(), | ||
277 | ) | ||
278 | } | ||
279 | } | ||
280 | |||
255 | fn check_trailing_ws(path: &Path, text: &str) { | 281 | fn check_trailing_ws(path: &Path, text: &str) { |
256 | if is_exclude_dir(path, &["test_data"]) { | 282 | if is_exclude_dir(path, &["test_data"]) { |
257 | return; | 283 | return; |
@@ -298,7 +324,7 @@ impl TidyDocs { | |||
298 | } | 324 | } |
299 | 325 | ||
300 | fn is_exclude_file(d: &Path) -> bool { | 326 | fn is_exclude_file(d: &Path) -> bool { |
301 | let file_names = ["tests.rs"]; | 327 | let file_names = ["tests.rs", "famous_defs_fixture.rs"]; |
302 | 328 | ||
303 | d.file_name() | 329 | d.file_name() |
304 | .unwrap_or_default() | 330 | .unwrap_or_default() |