Questions tagged [rust-cargo]

Cargo is the official package manager for the Rust programming language.

Cargo is the official package manager for the Rust programming language. Using a manifest, the programmer can provide metadata about a project, including dependencies, which Cargo can automatically download and compile before compiling the project itself.

You can find more information in the cargo book and browse the crates (Rust packages) in crates.io.

2044 questions
0
votes
1 answer

cargo build is stuck on last binary

When running cargo build --verbose or cargo run --verbose, it compiles all the dependencies on a specific Rust project but gets stuck on the last file. Output: Fresh unicode-ident v1.0.8 Fresh proc-macro2 v1.0.56 Fresh quote…
LonelyDoor
  • 28
  • 1
  • 6
0
votes
0 answers

Can I pass the -Z namespaced-features option to the cargo not through console in vscode?

I try to pass -Z namespaced-features option not through console in my vscode project. Does anyone know if is it possible to do? I'm using rust-analyser plugin with vscode. When I call Cargo: build it runs without this option and fails with message:…
0
votes
1 answer

Unresolved imports when I move a binary crate to src/bin

I have a Rust project with the following structure: . ├── Cargo.toml └── src ├── main.rs ├── generator.rs └── lib.rs With the following code in lib.rs and main.rs respectively: # lib.rs pub mod generator # main.rs use clap::{Parser,…
diviquery
  • 569
  • 5
  • 19
0
votes
0 answers

Linking user generate .so file in rust

I would like to use two user generated .so library file in my rust code. These files are named lib_dens-mods.so and lib_twobody.so. My build.rs is the following //build.rs use std::env; use std::process::Command; fn main() { Command::new("sh") …
Alex Long
  • 55
  • 4
0
votes
1 answer

Error while building rust with libp2p-0.53.1

I am trying to upgrade a project, that has vendored crates, from using libp2p 0.46 to 0.53.1 but I am getting an error when I try to build it. error[E0599]: no method named `as_pin_mut` found for struct `Pin<&mut either::Either>` in the…
0
votes
1 answer

How to use environment variables for debugging in rust?

I am creating a plugin for swc. It fails and I was told to add an environment variable for debugging. RUST_LOG=trace and SWC_DEBUG=1 Where should I put these variables? To what file? If I write them before "cargo test" - an error, an unrecognized…
Roman
  • 175
  • 2
  • 3
  • 15
0
votes
1 answer

piston-opengl_graphics: `can't find crate`

I am building a piston program, which I committed yesterday. When running it unchanged today ( cargo run / cargo check), these are my error messages from the piston-opengl_graphics crate: can't find crate for x for most of its dependancies; which…
CoDeus
  • 1
  • 3
0
votes
0 answers

Error: the current crate is indistinguishable from one of its dependencies

I'm attempting to build a crate within a docker container, which depends on the inline-python crate. The docker file looks like this: # syntax=docker/dockerfile:1 FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime ENV TZ=Europe/Berlin RUN ln -snf…
sak
  • 2,612
  • 24
  • 55
0
votes
0 answers

Configure rust dependencies in VS code

I am learning cargo (rust package manager). My code is working from console, but I can't apply dependency in VS code My actions 1 Create project cargo new hello_world 2 add rand library to the Cargo.toml [package] name = "hello_world" version =…
mascai
  • 1,373
  • 1
  • 9
  • 30
0
votes
1 answer

Is the local cargo registry portable?

As in I copy the /path/to/home/.cargo/registry directory (or the /path/to/home/.cargo/registry/src directory specifically), from my system and replace the one in a different system with this copy and the same set of crates are available now in that…
Keyboard Penman
  • 162
  • 1
  • 11
0
votes
1 answer

Is there a cargo command exclusively to download crates to the registry directory?

I know that when you add a crate to your Cargo.toml file and run cargo build, or when you vendor a crate to your local project folder, in both cases, the crate and it's dependency crates are first downloaded to the /path/to/home/.cargo/registry…
Keyboard Penman
  • 162
  • 1
  • 11
0
votes
1 answer

How to link to a specific section in Rust documentation

Suppose I place a header in the documentation for a Rust module, src/module_a/mod.rs: # Header Some text. I know how to link to this header from other parts of src/module_a/mod.rs using standard markdown syntax, and I know how to link to module_a…
GHPR
  • 45
  • 6
0
votes
0 answers

Cargo Crate depends on itself

I'm having an issue with a repository of mine where the list of dependents includes a reference to the original repository. The dependency list in the Cargo.toml file does not include a reference to itself, however I discovered that the generated…
Bdeering
  • 338
  • 3
  • 14
0
votes
2 answers

My Rust project is broken all of the sudden

So I made some changes to my code and tried to compile it on my work computer. I got the following errors relative to ntapi package: error[E0793]: reference to packed field is unaligned -->…
0
votes
1 answer

How do I truncate file paths within a binary's symbols?

When compiling a rust project via cargo, even in release mode, it generates a pdb file, and the full path (Including my username, which has my real name) can be found in it. Is there a way to truncate these file names, or even better, not use…
DeKrypt
  • 33
  • 4