aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-12 14:11:42 +0000
committerGitHub <[email protected]>2021-03-12 14:11:42 +0000
commit393e2356594560dec84e73471f26a366a6fc91dd (patch)
treefc22518e7df4fdb1d8c17a391932de3fa3eebc41
parentc0e9530fd095317563532c20f13959619515c9b2 (diff)
parentebf4448f78abaff3c666b61c3bb8a849db5c9b7f (diff)
Merge #7980
7980: Fix remaining references to `cargo xtask codegen` r=matklad a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
-rw-r--r--crates/parser/src/grammar.rs2
-rw-r--r--docs/dev/architecture.md6
-rw-r--r--docs/user/manual.adoc2
-rw-r--r--xtask/src/codegen.rs2
-rw-r--r--xtask/src/main.rs2
5 files changed, 7 insertions, 7 deletions
diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs
index 6159d064c..6c0e22722 100644
--- a/crates/parser/src/grammar.rs
+++ b/crates/parser/src/grammar.rs
@@ -18,7 +18,7 @@
18//! // fn foo() {} 18//! // fn foo() {}
19//! ``` 19//! ```
20//! 20//!
21//! After adding a new inline-test, run `cargo xtask codegen` to 21//! After adding a new inline-test, run `cargo test -p xtask` to
22//! extract it as a standalone text-fixture into 22//! extract it as a standalone text-fixture into
23//! `crates/syntax/test_data/parser/`, and run `cargo test` once to 23//! `crates/syntax/test_data/parser/`, and run `cargo test` once to
24//! create the "gold" value. 24//! create the "gold" value.
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index e2237ca95..fb991133a 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -97,13 +97,13 @@ See [RFC](https://github.com/rust-lang/rfcs/pull/2256) and [./syntax.md](./synta
97 97
98- [rowan](https://github.com/rust-analyzer/rowan) library is used for constructing syntax trees. 98- [rowan](https://github.com/rust-analyzer/rowan) library is used for constructing syntax trees.
99- `ast` provides a type safe API on top of the raw `rowan` tree. 99- `ast` provides a type safe API on top of the raw `rowan` tree.
100- `ungrammar` description of the grammar, which is used to generate `syntax_kinds` and `ast` modules, using `cargo xtask codegen` command. 100- `ungrammar` description of the grammar, which is used to generate `syntax_kinds` and `ast` modules, using `cargo test -p xtask` command.
101 101
102Tests for ra_syntax are mostly data-driven. 102Tests for ra_syntax are mostly data-driven.
103`test_data/parser` contains subdirectories with a bunch of `.rs` (test vectors) and `.txt` files with corresponding syntax trees. 103`test_data/parser` contains subdirectories with a bunch of `.rs` (test vectors) and `.txt` files with corresponding syntax trees.
104During testing, we check `.rs` against `.txt`. 104During testing, we check `.rs` against `.txt`.
105If the `.txt` file is missing, it is created (this is how you update tests). 105If the `.txt` file is missing, it is created (this is how you update tests).
106Additionally, running `cargo xtask codegen` will walk the grammar module and collect all `// test test_name` comments into files inside `test_data/parser/inline` directory. 106Additionally, running the xtask test suite with `cargo test -p xtask` will walk the grammar module and collect all `// test test_name` comments into files inside `test_data/parser/inline` directory.
107 107
108To update test data, run with `UPDATE_EXPECT` variable: 108To update test data, run with `UPDATE_EXPECT` variable:
109 109
@@ -111,7 +111,7 @@ To update test data, run with `UPDATE_EXPECT` variable:
111env UPDATE_EXPECT=1 cargo qt 111env UPDATE_EXPECT=1 cargo qt
112``` 112```
113 113
114After adding a new inline test you need to run `cargo xtest codegen` and also update the test data as described above. 114After adding a new inline test you need to run `cargo test -p xtask` and also update the test data as described above.
115 115
116Note [`api_walkthrough`](https://github.com/rust-analyzer/rust-analyzer/blob/2fb6af89eb794f775de60b82afe56b6f986c2a40/crates/ra_syntax/src/lib.rs#L190-L348) 116Note [`api_walkthrough`](https://github.com/rust-analyzer/rust-analyzer/blob/2fb6af89eb794f775de60b82afe56b6f986c2a40/crates/ra_syntax/src/lib.rs#L190-L348)
117in particular: it shows off various methods of working with syntax tree. 117in particular: it shows off various methods of working with syntax tree.
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc
index 4f2217546..f4c37353c 100644
--- a/docs/user/manual.adoc
+++ b/docs/user/manual.adoc
@@ -19,7 +19,7 @@ The LSP allows various code editors, like VS Code, Emacs or Vim, to implement se
19To improve this document, send a pull request: + 19To improve this document, send a pull request: +
20https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/manual.adoc[https://github.com/rust-analyzer/.../manual.adoc] 20https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/manual.adoc[https://github.com/rust-analyzer/.../manual.adoc]
21 21
22The manual is written in https://asciidoc.org[AsciiDoc] and includes some extra files which are generated from the source code. Run `cargo test` and `cargo xtask codegen` to create these and then `asciidoctor manual.adoc` to create an HTML copy. 22The manual is written in https://asciidoc.org[AsciiDoc] and includes some extra files which are generated from the source code. Run `cargo test` and `cargo test -p xtask` to create these and then `asciidoctor manual.adoc` to create an HTML copy.
23 23
24==== 24====
25 25
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index 2cf3c6fdc..518e17e38 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -62,7 +62,7 @@ pub(crate) fn ensure_file_contents(file: &Path, contents: &str) -> Result<()> {
62 let _ = std::fs::create_dir_all(parent); 62 let _ = std::fs::create_dir_all(parent);
63 } 63 }
64 std::fs::write(file, contents).unwrap(); 64 std::fs::write(file, contents).unwrap();
65 anyhow::bail!("some file were not up to date") 65 anyhow::bail!("some file was not up to date and has been updated, simply re-run the tests")
66} 66}
67 67
68fn normalize_newlines(s: &str) -> String { 68fn normalize_newlines(s: &str) -> String {
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 35cc7c108..057cd57ae 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -1,7 +1,7 @@
1//! See https://github.com/matklad/cargo-xtask/. 1//! See https://github.com/matklad/cargo-xtask/.
2//! 2//!
3//! This binary defines various auxiliary build commands, which are not 3//! This binary defines various auxiliary build commands, which are not
4//! expressible with just `cargo`. Notably, it provides `cargo xtask codegen` 4//! expressible with just `cargo`. Notably, it provides tests via `cargo test -p xtask`
5//! for code generation and `cargo xtask install` for installation of 5//! for code generation and `cargo xtask install` for installation of
6//! rust-analyzer server and client. 6//! rust-analyzer server and client.
7//! 7//!