-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
"Unused" "private" methods are stripped, then linking fails while looking for them #23686
Comments
This looks the same as #18082 (comment)
This RFC states: "Items that are explicitly declared as pub are always public". Per the RFC, the Not sure what the behavior should be in this case:
|
This code is valid, and it's a compiler bug that the link error is coming up. As @japaric noted, the The link error is covered by #16734, so I'm going to close in favor of that. Thanks for the report though! |
This helped me a lot, I thought I was going nuts there for a while. :) |
Sorry for the scare quotes in the title, it's just that the definitions of "unused" and "private" are a bit fuzzy with this example.
Reproduction
Create a new Cargo project with these two files. It's important that the files be in different crates:
src/lib.rs
src/main.rs
When compiling, we get this error:
It looks like the method
value
is considered unused, and so it is stripped from the final crate. That's fine, except that in another crate we expect to be able to link against that method, and fail nastily when it's not there!Meta
Originally from Stack Overflow
The text was updated successfully, but these errors were encountered: