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

Unable to run any test in VSCode #18971

Open
clin1234 opened this issue Jan 18, 2025 · 3 comments
Open

Unable to run any test in VSCode #18971

clin1234 opened this issue Jan 18, 2025 · 3 comments
Labels
C-bug Category: bug

Comments

@clin1234
Copy link

rust-analyzer version: rust-analyzer version: 0.4.2270-standalone

rustc version: rustc 1.86.0-nightly (6067b3631 2025-01-17)

editor or extension: vscode extension 0.4.2270

relevant settings: set in settings.json:

{
    "terminal.integrated.env.linux": {
        "PATH": "/workspaces/pyo3/venv/bin:/home/codespace/.cargo/bin"
    },
    "debug.allowBreakpointsEverywhere": true,
    "rust-analyzer.server.extraEnv": {
        "CARGO": "/home/codespace/.cargo/bin/cargo",
        "RUSTC": "/home/codespace/.cargo/bin/rustc"
    },
    "rust-analyzer.cargo.extraEnv": {"PATH": "/home/codespace/.cargo/bin"}
}

repository link (if public, optional): clin1234/pyo3

code snippet to reproduce:

#[test]
#[cfg(not(Py_LIMITED_API))]
fn ascii_object_bitfield() {
    let ob_base: PyObject = unsafe { std::mem::zeroed() };

    let mut o = PyASCIIObject {
        ob_base,
        length: 0,
        #[cfg(not(PyPy))]
        hash: 0,
        state: 0u32,
        #[cfg(not(Py_3_12))]
        wstr: std::ptr::null_mut() as *mut wchar_t,
    };

    unsafe {
        assert_eq!(o.interned(), 0);
        assert_eq!(o.kind(), 0);
        assert_eq!(o.compact(), 0);
        assert_eq!(o.ascii(), 0);
        #[cfg(not(Py_3_12))]
        assert_eq!(o.ready(), 0);

        let interned_count = if cfg!(Py_3_12) { 2 } else { 4 };

        for i in 0..interned_count {
            o.set_interned(i);
            assert_eq!(o.interned(), i);
        }

        for i in 0..8 {
            o.set_kind(i);
            assert_eq!(o.kind(), i);
        }

        o.set_compact(1);
        assert_eq!(o.compact(), 1);

        o.set_ascii(1);
        assert_eq!(o.ascii(), 1);

        #[cfg(not(Py_3_12))]
        o.set_ready(1);
        #[cfg(not(Py_3_12))]
        assert_eq!(o.ready(), 1);
    }
}
@clin1234 clin1234 added the C-bug Category: bug label Jan 18, 2025
@ChayimFriedman2
Copy link
Contributor

What is the error? If there is no error, how does it look? Can you attach a screenshot?

@clin1234
Copy link
Author

The error is that cargo could not be found, even though I installed the toolchain at /home/codespace/.cargo/bin/ through rustup

@ChayimFriedman2
Copy link
Contributor

If you add "rust-analyzer.server.extraEnv": {"PATH": "/home/codespace/.cargo/bin"}, does it work?

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

No branches or pull requests

2 participants