rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.21k stars 1.6k forks source link

Rust-analyzer crash when load workspace, chinese character is not supported? #15208

Closed zRegle closed 1 year ago

zRegle commented 1 year ago

Cannot start rust-analyzer in VSCode. Here is the error message:

[ERROR rust_analyzer::main_loop] FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to load the project at /home/zregle/rust-learn/Cargo.toml: Failed to read Cargo metadata from Cargo.toml file /home/zregle/rust-learn/Cargo.toml, Some(Version { major: 1, minor: 70, patch: 0 }): Failed to run `cd "/home/zregle/rust-learn" && "cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/zregle/rust-learn/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"`: `cargo metadata` exited with an error: error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
  --- stdout
___
  lib___.rlib
  lib___.so
  lib___.so
  lib___.a
  lib___.so
  /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu
  off
  packed
  unpacked
  ___
  debug_assertions
  panic="unwind"
  proc_macro
  target_arch="x86_64"
  target_endian="little"
  target_env="gnu"
  target_family="unix"
  target_feature="fxsr"
  target_feature="sse"
  target_feature="sse2"
  target_has_atomic="16"
  target_has_atomic="32"
  target_has_atomic="64"
  target_has_atomic="8"
  target_has_atomic="ptr"
  target_os="linux"
  target_pointer_width="64"
  target_vendor="unknown"
  unix

  --- stderr
  error: unknown start of token: \u{3002}
   --> <anon>:1:30
    |
  1 | GNU Wget 1.14 在 linux-gnu 上编译。
    |                                  ^^
    |
  help: Unicode character '。' (Ideographic Full Stop) looks like '.' (Period), but it is not
    |
  1 | GNU Wget 1.14 在 linux-gnu 上编译.
    |                                  ~

It seems like didn't support Chinese character?

OS: Linux rust-analyzer-version: rust-analyzer version: 0.0.0 (45272efec 2023-07-03) rustc version: rustc 1.70.0 (90c541806 2023-05-31)

zRegle commented 1 year ago

Here is the wget info, shown in the error message.

$ wget -V
GNU Wget 1.14 在 linux-gnu 上编译。

+digest +https +ipv6 +iri +large-file +nls +ntlm +opie +ssl/openssl

Wgetrc:
    /etc/wgetrc (系统)
字符集: /usr/share/locale
编译: gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc"
    -DLOCALEDIR="/usr/share/locale" -I. -I../lib -I../lib -O2 -g -pipe
    -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
    --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
链接程序: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
    -fstack-protector-strong --param=ssp-buffer-size=4
    -grecord-gcc-switches -m64 -mtune=generic -lssl -lcrypto
    /usr/lib64/libssl.so /usr/lib64/libcrypto.so /usr/lib64/libz.so
    -ldl -lz -lz -lidn -luuid -lpcre ftp-opie.o openssl.o http-ntlm.o
    ../lib/libgnu.a

Copyright (C) 2011 Free Software Foundation, Inc.
授权 GPLv3+: GNU GPL 第三版或更高版本
<http://www.gnu.org/licenses/gpl.html>。
这是自由软件:您可以自由地更改并重新分发它。
在法律所允许的范围内,没有任何担保。

最初由 Hrvoje Nikšić <hniksic@xemacs.org> 编写。
请将错误报告或建议寄给 <bug-wget@gnu.org>。
lnicola commented 1 year ago

We have nothing to do with wget. Do rustc -V and cargo metadata work? Did you set any environment variables?

zRegle commented 1 year ago

We have nothing to do with wget. Do rustc -V and cargo metadata work? Did you set any environment variables?

Yes, all work fine. And I don't set any ENV as far as I know. Is there any clue to solve this problem? Thx

lnicola commented 1 year ago

Well, something is calling into wget, and we have no reason to. Does it also happen in a new project?

zRegle commented 1 year ago

Well, something is calling into wget, and we have no reason to. Does it also happen in a new project?

Yes, I switch to another workplace and the problem still exists.

poliorcetics commented 1 year ago

You're using VSCode, do you use any other extensions ?

If so, in a new project, could you try to deactive them all and reactivate them one-by-one (start with rust-analyzer, since it crashes) to see if it's another one doing something unexpected ?

My other idea is some upgrade mechanism using wget somewhere in the chain, though that seems stranger still

zRegle commented 1 year ago

I using fish-shell and I reintall it, then the problem is fixed