rust-cargo Questions

4

Solved

I'm writing a Cargo helper command that needs to know the default target triple used by Rust/Cargo (which I presume is the same as host's target triple). Ideally it should be a compile-time constan...
Sociable asked 24/2, 2018 at 21:3

2

Solved

I am trying to execute the below program. fn main() { let a: u8 = 0b00000001; let b: u8 = 0b10101010; let c: u8 = 0b00001111; let length = a.count_ones() + a.count_zeros(); for n in 0..length ...
Stubble asked 16/12, 2020 at 12:28

3

Solved

mod simulation; use simulation::factory::FactoryType; works fine in main.rs, but not in a doctest inside simulation/factory.rs: impl product_type::ProductType for FactoryType { /// Lorem Ipsum...
Transducer asked 9/9, 2015 at 7:23

3

Solved

I'm writing a Rust library and I want to provide examples in my documentation that compile as part of running cargo test do not run. Is this possible? I'm writing a database client library, a...
Giffard asked 6/9, 2015 at 23:42

31

Solved

I followed the readme instructions for building Parity from source and then executed: cargo build --release ~/.cargo/bin/cargo build --release as instructed, both of which returned the following m...
Weyermann asked 30/11, 2017 at 2:58

2

Solved

I read the Cargo manual about the patch option but it is still unclear to me. Is it possible to instruct Cargo: Get the code from this repository. Apply this patch file (my_cool_change.patch) to...
Tangerine asked 23/9, 2019 at 15:6

6

Solved

Is there a standard way to determine what features are available for a given crate? I'm trying to read Postgres timezones, and this says to use the crate postgres = "0.17.0-alpha.1" crate's with-t...
Fredericton asked 15/1, 2020 at 23:33

2

Solved

I would like to install Xargo v0.3.10 on my machine. The current version of Xargo is v0.3.11 and it is installed by the cargo install xargo command. How can I install an older version of Xargo?
Sarina asked 3/4, 2018 at 21:24

5

Solved

cargo run or cargo rebuild ignore any code changes. I have a program fn main() { println!("Hello, World!"); } Then I do cargo run and see: Compiling myproject v0.1.0 (/Volumes/.../myproject)...
Jalousie asked 18/7, 2019 at 4:57

2

Solved

I added a dependency to a rust project, then ran cargo run, this gave me this error: "Blocking waiting for file lock on package cache" I tried the solution I found online which was to del...
Haftarah asked 16/5, 2022 at 19:11

4

When I want to test C++ coverage, I can build my program with -fprofile-arcs -ftest-coverage, run all tests, and run gcov to get coverages. However, when it comes to Rust, I get totally lost. What ...
Inaugural asked 8/10, 2021 at 6:50

2

I use rust 1.34 and 1.35. Currently it links to GLIBC_2.18. How can I limit cargo build to link GLIBC up to version 2.14?
Madison asked 1/9, 2019 at 20:7

1

Is there a way to declare in the Cargo.toml that my project depend only on 3rd-party crates that guaranteed to be using Safe Rust transitively? I am new to Rust and Rust is new to me. I haven't had...
Threadbare asked 16/2, 2023 at 3:48

2

Solved

I've got the following rust project layout: project_name ├── crate_1 │ ├── src │ │ ... │ │ └── main.rs │ └── Cargo.toml ├── crate_2 │ ├── src │ │ ... │ │ └── lib.rs │ └── Cargo.toml ├── ...
Epizoic asked 13/3, 2022 at 20:3

1

While working on a Brainfuck interpreter in Rust, I noticed that cargo bench takes an incredibly long time to build a Criterion bench when the Benchmark contains a large type. As part of my Brainfu...
Rutherford asked 29/10, 2022 at 5:43

3

Solved

My Rust project no longer builds after some conflicts between my RLS plugin and terminal build. I searched around the web and found suggestion of removing my ~/.cargo/registry/index/*, but after th...
Calamanco asked 18/11, 2018 at 12:49

5

Solved

How can I make a program in Rust which can be executed from anywhere without using cargo run, by just clicking on the file? Is there any crate? I have written code for snake game and I want to run...
Protoactinium asked 31/3, 2020 at 6:16

4

I have rustup+rust+cargo installed using the official installation script. How do I enable shell completions, to be able to type cargo <TAB> in the terminal and see the possible commands such...
Hogwash asked 14/7, 2022 at 16:17

2

Solved

Part of my Cargo.toml for my crate: [features] wasm = ["ed25519-dalek/nightly", "rand/wasm-bindgen", "js-sys"] This works, when the crate is used in another project, and the "wasm" feature is ex...
Theurer asked 17/9, 2019 at 10:29

3

Solved

I want to use a local package which is located in my home directory. By default, Cargo searches for dependencies relative to Cargo.toml. If I know where my project is located relative to the home f...
Beghard asked 5/4, 2021 at 10:6

1

In C, I can output compiler optimization information using the following command: clang -O2 main.c -o main -fsave-optimization-record Does rust also have such options to output optimization inform...
Loaves asked 24/10, 2023 at 8:22

4

Solved

How can you have multiple nested workspace with Cargo? I have the following project structure: myworkspace ├── project_a │  └── Cargo.toml ├── project_b │  └── Cargo.toml │ └── project_b_dependen...
Refuge asked 16/4, 2018 at 4:58

1

I'm working on project using warp. Warp includes the bytes cargo as a dependency and I want to use the Bytes struct that gets passed into the callback. Here's an example: use warp::Filter; fn proc...
Gamosepalous asked 31/10, 2020 at 18:3

3

I am a bit confused by the existence of the three upper levels in the Rust module hierarchy and why they are all needed. If I understand it correctly: Crates are simple projects that contain mult...
Metallic asked 27/5, 2020 at 20:4

1

Solved

Following up on Q/A: How to run a specific unit test in Rust? When using the described solution cargo test path::to::some_test -- --exact in a project that mixes a library with binaries, how to sup...
Jadotville asked 12/10, 2023 at 20:33

© 2022 - 2025 — McMap. All rights reserved.