Skip to content
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

Rust wants me to write pub pub #47565

Closed
jD91mZM2 opened this issue Jan 19, 2018 · 2 comments
Closed

Rust wants me to write pub pub #47565

jD91mZM2 opened this issue Jan 19, 2018 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug.

Comments

@jD91mZM2
Copy link
Contributor

Hi! Another fun error message for you:

warning: function is marked #[no_mangle], but not exported
  --> src/c_api.rs:63:1
   |
63 |   pub extern fn rot26_decrypt_any(input: *const c_char, amount: u32) -> *const c_char {
   |   ^
   |   |
   |  _help: try making it public: `pub `
   | |
64 | |     let input = match unsafe { CStr::from_ptr(input).to_str() } {
65 | |         Ok(input) => input,
66 | |         Err(_) => return ptr::null()
...  |
75 | |     ptr
76 | | }
   | |_^

(The problem is actually that the module is hidden. So I should use pub mod.)

@kennytm
Copy link
Member

kennytm commented Jan 19, 2018

Minimal reproduction:

#![crate_type="lib"]
mod private {
    #[no_mangle]
    pub fn public() {}
}

@kennytm kennytm added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. labels Jan 19, 2018
@petrochenkov
Copy link
Contributor

Fixed in #47479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants