summary refs log tree commit diff
diff options
context:
space:
mode:
authoroxalica <oxalicc@pm.me>2021-12-15 06:17:45 +0800
committeroxalica <oxalicc@pm.me>2021-12-15 06:17:45 +0800
commitdfc31f4c83966325a0e1c003de6ad0bee80e8cc5 (patch)
tree1cd09e7242456e11c22d8b55339c2a43bcdaad7b
parentd8c8e3f6d1df88d4b8c211d19e1ba4773085a7f7 (diff)
downloadnixpkgs-dfc31f4c83966325a0e1c003de6ad0bee80e8cc5.tar
nixpkgs-dfc31f4c83966325a0e1c003de6ad0bee80e8cc5.tar.gz
nixpkgs-dfc31f4c83966325a0e1c003de6ad0bee80e8cc5.tar.bz2
nixpkgs-dfc31f4c83966325a0e1c003de6ad0bee80e8cc5.tar.lz
nixpkgs-dfc31f4c83966325a0e1c003de6ad0bee80e8cc5.tar.xz
nixpkgs-dfc31f4c83966325a0e1c003de6ad0bee80e8cc5.tar.zst
nixpkgs-dfc31f4c83966325a0e1c003de6ad0bee80e8cc5.zip
rust-analyzer: 2021-11-29 -> 2021-12-13
-rw-r--r--pkgs/development/tools/rust/rust-analyzer/default.nix9
-rw-r--r--pkgs/development/tools/rust/rust-analyzer/no-1-57-map-while.patch20
2 files changed, 26 insertions, 3 deletions
diff --git a/pkgs/development/tools/rust/rust-analyzer/default.nix b/pkgs/development/tools/rust/rust-analyzer/default.nix
index fdc91503ff5..d08f2acb9de 100644
--- a/pkgs/development/tools/rust/rust-analyzer/default.nix
+++ b/pkgs/development/tools/rust/rust-analyzer/default.nix
@@ -11,20 +11,23 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "rust-analyzer-unwrapped";
-  version = "2021-11-29";
-  cargoSha256 = "sha256-UgYR0e3Pt3lcbkSDnizlwtwjnqTaqGlXRgR724U4rSU=";
+  version = "2021-12-13";
+  cargoSha256 = "sha256-VF4pwSl3Wei7KxyQFOPj7hVX/NG2zImRLv4iN+ijAs8=";
 
   src = fetchFromGitHub {
     owner = "rust-analyzer";
     repo = "rust-analyzer";
     rev = version;
-    sha256 = "sha256-vh7z8jupVxXPOko3sWUsOB7eji/7lKfwJ/CE3iw97Sw=";
+    sha256 = "sha256-xt7iDfIoaBhStgqsgttyOFF4NYPQ8jeVwDoYUwrvtrA=";
   };
 
   patches = [
     # Code format and git history check require more dependencies but don't really matter for packaging.
     # So just ignore them.
     ./ignore-git-and-rustfmt-tests.patch
+
+    # Remove when we have rustc >= 1.57.0.
+    ./no-1-57-map-while.patch
   ];
 
   buildAndTestSubdir = "crates/rust-analyzer";
diff --git a/pkgs/development/tools/rust/rust-analyzer/no-1-57-map-while.patch b/pkgs/development/tools/rust/rust-analyzer/no-1-57-map-while.patch
new file mode 100644
index 00000000000..6114f51831b
--- /dev/null
+++ b/pkgs/development/tools/rust/rust-analyzer/no-1-57-map-while.patch
@@ -0,0 +1,20 @@
+--- a/crates/ide_db/src/helpers.rs
++++ b/crates/ide_db/src/helpers.rs
+@@ -309,7 +309,7 @@ pub fn lint_eq_or_in_group(lint: &str, lint_is: &str) -> bool {
+ pub fn parse_tt_as_comma_sep_paths(input: ast::TokenTree) -> Option<Vec<ast::Path>> {
+     let r_paren = input.r_paren_token();
+     let tokens =
+-        input.syntax().children_with_tokens().skip(1).map_while(|it| match it.into_token() {
++        input.syntax().children_with_tokens().skip(1).map(|it| match it.into_token() {
+             // seeing a keyword means the attribute is unclosed so stop parsing here
+             Some(tok) if tok.kind().is_keyword() => None,
+             // don't include the right token tree parenthesis if it exists
+@@ -317,7 +317,7 @@ pub fn parse_tt_as_comma_sep_paths(input: ast::TokenTree) -> Option<Vec<ast::Pat
+             // only nodes that we can find are other TokenTrees, those are unexpected in this parse though
+             None => None,
+             Some(tok) => Some(tok),
+-        });
++        }).take_while(|tok| tok.is_some()).map(|tok| tok.unwrap());
+     let input_expressions = tokens.into_iter().group_by(|tok| tok.kind() == T![,]);
+     let paths = input_expressions
+         .into_iter()