Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes every time in a specific project (VSCode) #5125

Closed
Dzejkop opened this issue Jun 29, 2020 · 12 comments · Fixed by #5152
Closed

Crashes every time in a specific project (VSCode) #5125

Dzejkop opened this issue Jun 29, 2020 · 12 comments · Fixed by #5152

Comments

@Dzejkop
Copy link

Dzejkop commented Jun 29, 2020

Every single time rust-analyzer starts for this project it displays the notification

The Rust Analyzer Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

and in the logs there appear a bunch of entries like this one:

thread 'main' panicked at 'expected absolute path, got ', crates/paths/src/lib.rs:63:36
stack backtrace:
   0: <unknown>
   1: core::fmt::write
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: std::panicking::begin_panic_fmt
   8: <unknown>
   9: paths::AbsPathBuf::assert
  10: ra_project_model::cargo_workspace::CargoWorkspace::from_cargo_metadata
  11: ra_project_model::ProjectWorkspace::load
  12: <unknown>
  13: <unknown>
  14: rust_analyzer::main_loop::main_loop
  15: <unknown>
  16: <unknown>
  17: std::rt::lang_start_internal
  18: <unknown>
  19: __libc_start_main
  20: <unknown>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 4:56:35 PM] Connection to server got closed. Server will not be restarted.

Funny enough thisonly seems to affect one specific project.

@lnicola
Copy link
Member

lnicola commented Jun 29, 2020

Do you have any path dependencies in Cargo.toml?

@Dzejkop
Copy link
Author

Dzejkop commented Jun 29, 2020

Yes

@lnicola
Copy link
Member

lnicola commented Jun 29, 2020

Crashes around https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_project_model/src/cargo_workspace.rs#L248 with the assertion that the workspace has an absolute path.

@matklad
Copy link
Member

matklad commented Jun 29, 2020

Would be useful to get output of cargo metadata command

@Dzejkop
Copy link
Author

Dzejkop commented Jun 30, 2020

I can't really give you the cargo metadata there's some work related stuff there 😦

Any specific entries I could provide?

@lnicola
Copy link
Member

lnicola commented Jun 30, 2020

workspace_root would be interesting. It's at the end.

@Dzejkop
Copy link
Author

Dzejkop commented Jun 30, 2020

    "target_directory": "/home/user_name/Projects/abcd3/abcd3/target",
    "version": 1,
    "workspace_root": "/home/user_name/Projects/abcd3/abcd3"
}

@matklad
Copy link
Member

matklad commented Jun 30, 2020

Hm, not sure what’s going on here.... Do you have out_dir or proc macro support enabled in the settings?

@Dzejkop
Copy link
Author

Dzejkop commented Jun 30, 2020

Ok, I fiddled with user settings I had this entry for some reason

"rust-analyzer.cargo.loadOutDirsFromCheck": true,

after removing, everything works fine

@matklad
Copy link
Member

matklad commented Jun 30, 2020

@Dzejkop could you run cargo check --message-format=json and check the value of out_dir from "build script executed" messages? It seems like there might be some bug in cargo?

@matklad
Copy link
Member

matklad commented Jun 30, 2020

Ah, I guess, you might be using rust older than 1.41,and that causes cargo metadata to use default path here.

bors bot added a commit that referenced this issue Jun 30, 2020
5152: Don't crash on empty out_dirs with older cargos r=matklad a=matklad

closes #5125



bors r+
🤖

Co-authored-by: Aleksey Kladov <[email protected]>
@bors bors bot closed this as completed in cec9240 Jun 30, 2020
@bors bors bot closed this as completed in #5152 Jun 30, 2020
@Dzejkop
Copy link
Author

Dzejkop commented Jul 1, 2020

Yup, I'm using Rust 1.40, thanks for looking into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants