0

Using the latest Rust Analyzer, I have a workspace that contains more than 1 project, but it keeps printing errors as shown in the attached image. enter image description here

test1: Cargo.toml

[package]
name = "test1"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

web1 Cargo.toml

[package]
name = "main"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
actix-web = "4"

lanch.json in both :

{
    // The following are sample configurations for common case scenarios of debugging
    // Rust in Visual Studio Code
    //
    // For syntax, visit: https://go.microsoft.com/fwlink/?linkid=830387
    //
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch an application",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceRoot}/target/debug/${fileBasenameNoExtension}.exe",
            "args": [ "arg1", "arg2" ],
            "cwd": "${workspaceRoot}",
        },        
    ]
}
user63898
  • 29,839
  • 85
  • 272
  • 514

1 Answers1

1

You don't have a Cargo.toml for your parent directory (as a workspace). Create one and make web1 and test1 members of it. Or, better, if test1 contains tests for web1, make it integration tests instead.

Chayim Friedman
  • 47,971
  • 5
  • 48
  • 77