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

failed use statements? #5430

Closed
nickdesaulniers opened this issue Mar 19, 2013 · 1 comment
Closed

failed use statements? #5430

nickdesaulniers opened this issue Mar 19, 2013 · 1 comment

Comments

@nickdesaulniers
Copy link

Trying out some FFI

➜ rustc version.rs
versions.rs:7:29: 7:35 error: use of undeclared type name `c_char`
versions.rs:7     fn version_string () -> *c_char;
                                           ^~~~~~
versions.rs:8:39: 8:45 error: use of undeclared type name `c_uint`
versions.rs:8     fn version_interface_current () -> c_uint;
                                                     ^~~~~~
versions.rs:9:40: 9:46 error: use of undeclared type name `c_uint`
versions.rs:9     fn version_interface_revision () -> c_uint;
                                                      ^~~~~~
versions.rs:10:35: 10:41 error: use of undeclared type name `c_uint`
versions.rs:10     fn version_interface_age () -> c_uint;
                                                  ^~~~~~
error: aborting due to 4 previous errors
➜  re2  cat versions.rs
use core::libc::{c_char, c_uint};

mod re2 {
  #[link_name = "cre2"]
  #[link_args = "-lcre2"]
  extern {
    fn version_string () -> *c_char;
    fn version_interface_current () -> c_uint;
    fn version_interface_revision () -> c_uint;
    fn version_interface_age () -> c_uint;
  }
}

fn version_interface_age () -> c_uint {
  unsafe {
    re2::version_interface_age()
  }
}

fn main () {
  io::println(fmt!("%?", version_interface_age));
}
@nickdesaulniers
Copy link
Author

nvm!

oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
…flip1995

Disallow bit-shifting in integer_arithmetic

Make the `integer_arithmetic` lint detect all the operations that are defined as being capable of overflow in the [Rust Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow), by also linting for bit-shifting operations (`<<`, `>>`).

changelog: Disallow bit-shifting in `integer_arithmetic`
oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#5226 (Add lint for explicit deref and deref_mut method calls)
 - rust-lang#5248 (Add lint on large non scalar const)
 - rust-lang#5430 (Disallow bit-shifting in integer_arithmetic)
 - rust-lang#5466 (large_enum_variant: Report sizes of variants)
 - rust-lang#5468 (Zero single char names)

Failed merges:

r? @ghost

changelog: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant