-
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
pub const items have no linker symbol #21856
Comments
I'm not sure what you mean by it not being exported. It might not be visible as a symbol (if you're linking with some C code or something), but you can certainly reference that item from another Rust crate. |
Sorry for not being clear. That's exactly what I meant, the symbol is not visible in the resulting object. This is pretty confusing (I've been doing a lot of C(++) <-> Rust lately and I'm trying to make the compiler warn people about all the things that have tripped me up) |
I think the right option is to expand the lint. The whole difference between |
Sounds totally reasonable. I'll expand the lint. |
Ah, I see now. I didn't know there was a lint for |
This renames the PrivateNoMangleFns lint to allow both to happen in a single pass, since they do roughly the same work. Closes #21856 Open questions: [ ]: Do the tests actually pass (I'm running make check and running out the door now) [ ]: Is the name of this lint ok. it seems to mostly be fine with [convention](https://github.com/rust-lang/rfcs/blob/cc53afbe5dea41e1f7d1c3dce71e013abe025211/text/0344-conventions-galore.md#lints) [ ]: I'm not super thrilled about the warning text r? @kmcallister (Shamelessly nominating because you were looking at my other ticket)
…lister This renames the PrivateNoMangleFns lint to allow both to happen in a single pass, since they do roughly the same work. Closes rust-lang#21856 Open questions: [ ]: Do the tests actually pass (I'm running make check and running out the door now) [ ]: Is the name of this lint ok. it seems to mostly be fine with [convention](https://github.com/rust-lang/rfcs/blob/cc53afbe5dea41e1f7d1c3dce71e013abe025211/text/0344-conventions-galore.md#lints) [ ]: I'm not super thrilled about the warning text r? @kmcallister (Shamelessly nominating because you were looking at my other ticket)
This renames the PrivateNoMangleFns lint to allow both to happen in a single pass, since they do roughly the same work. Closes rust-lang#21856 Open questions: [ ]: Do the tests actually pass (I'm running make check and running out the door now) [ ]: Is the name of this lint ok. it seems to mostly be fine with [convention](https://github.com/rust-lang/rfcs/blob/cc53afbe5dea41e1f7d1c3dce71e013abe025211/text/0344-conventions-galore.md#lints) [ ]: I'm not super thrilled about the warning text r? @kmcallister (Shamelessly nominating because you were looking at my other ticket)
Will not actually be exported in the resulting object. There are two obvious fixes, the first being to expand on my pub-not-exported lint to warn you that this will not work, the second being to fix the compiler to export the symbol with the appropriate value (Without altering the existing inlining behaviour, although it may give a more reasonable option for cases like trying to take the address of a
const
item).Happy to work on either, although I would need a mentor for the second part.
The text was updated successfully, but these errors were encountered: