1 // Test what happens we save incremental compilation state that makes
2 // use of foreign items. This used to ICE (#34991).
6 #![feature(rustc_private)]
10 use std::ffi::CString;
13 use libc::{c_char, c_long, c_longlong};
16 pub fn atol(x: *const c_char) -> c_long;
17 pub fn atoll(x: *const c_char) -> c_longlong;
21 fn atol(s: String) -> isize {
22 let c = CString::new(s).unwrap();
23 unsafe { mlibc::atol(c.as_ptr()) as isize }
26 fn atoll(s: String) -> i64 {
27 let c = CString::new(s).unwrap();
28 unsafe { mlibc::atoll(c.as_ptr()) as i64 }
32 assert_eq!(atol("1024".to_string()) * 10, atol("10240".to_string()));
33 assert_eq!((atoll("11111111111111111".to_string()) * 10),
34 atoll("111111111111111110".to_string()));