Skip to content

Expand ctypes warnings to warn about *int/*uint #7734

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) {
_ => ()
}
}
ast::ty_ptr(ref mt) => { check_ty(cx, mt.ty) }
_ => ()
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/unstable/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ avoid hitting the mutex.
use cast::{transmute};
use clone::Clone;
use kinds::Send;
use libc::{c_void};
use libc::{c_void, intptr_t};
use option::{Option, Some, None};
use ops::Drop;
use unstable::sync::{Exclusive, exclusive};
Expand Down Expand Up @@ -228,7 +228,7 @@ fn key_ptr<T:Send>(key: GlobalDataKey<T>) -> uint {
}

extern {
fn rust_get_global_data_ptr() -> *mut int;
fn rust_get_global_data_ptr() -> *mut intptr_t;
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/rt/rust_builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ rust_register_exit_function(spawn_fn runner, fn_env_pair *f) {
task->kernel->register_exit_function(runner, f);
}

extern "C" void *
extern "C" intptr_t*
rust_get_global_data_ptr() {
rust_task *task = rust_get_current_task();
return &task->kernel->global_data;
Expand Down
2 changes: 1 addition & 1 deletion src/rt/rust_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class rust_kernel {

public:
struct rust_env *env;
uintptr_t global_data;
intptr_t global_data;

rust_kernel(rust_env *env);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:found rust type
#[deny(ctypes)];

mod libc {
#[nolink]
pub extern {
pub fn malloc(size: int) -> *u8;
}
use std::libc;

#[nolink]
extern {
pub fn bare_type1(size: int); //~ ERROR: found rust type
pub fn bare_type2(size: uint); //~ ERROR: found rust type
pub fn ptr_type1(size: *int); //~ ERROR: found rust type
pub fn ptr_type2(size: *uint); //~ ERROR: found rust type

pub fn good1(size: *libc::c_int);
pub fn good2(size: *libc::c_uint);
}

fn main() {
Expand Down
21 changes: 0 additions & 21 deletions src/test/compile-fail/warn-ctypes.rs

This file was deleted.