-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[Suggestion] E0432 - could it include suggestions to add "lib" in crate-type? #111243
Comments
Here are the commands cargo generates for a
There are two things going on:
Also, there is a bug in rustc: passing
I guess cargo's behavior could make sense if you were only building the library (e.g. to link into a C program), but I think cargo should not allow having any target in the package other than the library, since it knows just by @rust-lang/cargo could you transfer this to the cargo repository, please? I don't have permissions. |
ah, this is #67293. |
I'm not entirely clear exactly what this issue is asking for. @dannywillems, can you include the exact Perhaps you can also include what you were trying to accomplish? I don't know what exactly was meant by "use a binary in a library". If you mean access code from a binary in a library, that isn't how Cargo works. Intra-package dependencies go the other way, where binaries can only access code from a library. |
Oh, thanks! Sorry I missed that, that's exactly what I need. So I'm not sure there is a lot cargo can do in this case. It doesn't know anything about the code, or whether or not you intend to access a library from the binary. |
Hi,
I am learning Rust and started a playbook.
I encountered the error E0432 while trying to use a binary in a library I have just created.
I spent a bit of time to understand it was because of a missing "lib" in crate-type. I thought it was automatically added as it was in the
lib
section.Could suggestions be added to error messages?
The text was updated successfully, but these errors were encountered: