Skip to content

De-mode libsyntax/librustc #5965

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 6 commits 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
4 changes: 0 additions & 4 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ pub mod streamp {

#[allow(non_camel_case_types)]
pub mod server {
priv use core::kinds::Owned;

#[allow(non_camel_case_types)]
pub type Open<T> = ::core::pipes::RecvPacket<super::Open<T>>;
}
Expand Down Expand Up @@ -388,8 +386,6 @@ pub mod oneshot {

#[allow(non_camel_case_types)]
pub mod server {
priv use core::kinds::Owned;

#[allow(non_camel_case_types)]
pub type Oneshot<T> =
::core::pipes::RecvPacketBuffered<super::Oneshot<T>,
Expand Down
22 changes: 10 additions & 12 deletions src/libcore/rt/sched/local_sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,16 @@ pub fn borrow(f: &fn(&mut Scheduler)) {
/// Because this leaves the Scheduler in thread-local storage it is possible
/// For the Scheduler pointer to be aliased
pub unsafe fn unsafe_borrow() -> &mut Scheduler {
unsafe {
let key = tls_key();
let mut void_sched: *mut c_void = tls::get(key);
assert!(void_sched.is_not_null());
{
let void_sched_ptr = &mut void_sched;
let sched: &mut ~Scheduler = {
transmute::<&mut *mut c_void, &mut ~Scheduler>(void_sched_ptr)
};
let sched: &mut Scheduler = &mut **sched;
return sched;
}
let key = tls_key();
let mut void_sched: *mut c_void = tls::get(key);
assert!(void_sched.is_not_null());
{
let void_sched_ptr = &mut void_sched;
let sched: &mut ~Scheduler = {
transmute::<&mut *mut c_void, &mut ~Scheduler>(void_sched_ptr)
};
let sched: &mut Scheduler = &mut **sched;
return sched;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/rt/uv/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ fn connect_read() {
vec_to_uv_buf(vec::from_elem(size, 0))
};
do stream_watcher.read_start(alloc)
|stream_watcher, nread, buf, status| {
|stream_watcher, _nread, buf, status| {

let buf = vec_from_uv_buf(buf);
rtdebug!("read cb!");
Expand Down
4 changes: 1 addition & 3 deletions src/libcore/stackwalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ fn test_simple_deep() {
if i == 0 { return }

for walk_stack |_frame| {
unsafe {
breakpoint();
}
breakpoint();
}
run(i - 1);
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3346,15 +3346,15 @@ mod tests {
#[test]
fn test_shift_byte() {
let mut s = ~"ABC";
let b = unsafe { raw::shift_byte(&mut s) };
let b = raw::shift_byte(&mut s);
assert!((s == ~"BC"));
assert!((b == 65u8));
}

#[test]
fn test_pop_byte() {
let mut s = ~"ABC";
let b = unsafe { raw::pop_byte(&mut s) };
let b = raw::pop_byte(&mut s);
assert!((s == ~"AB"));
assert!((b == 67u8));
}
Expand Down
38 changes: 17 additions & 21 deletions src/libcore/task/local_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,32 +150,28 @@ fn test_tls_modify() {

#[test]
fn test_tls_crust_automorestack_memorial_bug() {
unsafe {
// This might result in a stack-canary clobber if the runtime fails to
// set sp_limit to 0 when calling the cleanup extern - it might
// automatically jump over to the rust stack, which causes next_c_sp
// to get recorded as something within a rust stack segment. Then a
// subsequent upcall (esp. for logging, think vsnprintf) would run on
// a stack smaller than 1 MB.
fn my_key(_x: @~str) { }
do task::spawn {
unsafe { local_data_set(my_key, @~"hax"); }
}
// This might result in a stack-canary clobber if the runtime fails to
// set sp_limit to 0 when calling the cleanup extern - it might
// automatically jump over to the rust stack, which causes next_c_sp
// to get recorded as something within a rust stack segment. Then a
// subsequent upcall (esp. for logging, think vsnprintf) would run on
// a stack smaller than 1 MB.
fn my_key(_x: @~str) { }
do task::spawn {
unsafe { local_data_set(my_key, @~"hax"); }
}
}

#[test]
fn test_tls_multiple_types() {
unsafe {
fn str_key(_x: @~str) { }
fn box_key(_x: @@()) { }
fn int_key(_x: @int) { }
do task::spawn {
unsafe {
local_data_set(str_key, @~"string data");
local_data_set(box_key, @@());
local_data_set(int_key, @42);
}
fn str_key(_x: @~str) { }
fn box_key(_x: @@()) { }
fn int_key(_x: @int) { }
do task::spawn {
unsafe {
local_data_set(str_key, @~"string data");
local_data_set(box_key, @@());
local_data_set(int_key, @42);
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/libfuzzer/fuzzer.rc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn stash_ty_if(c: @fn(@ast::Ty, test_mode)->bool,

pub struct StolenStuff {exprs: ~[ast::expr], tys: ~[ast::Ty]}

pub fn steal(crate: ast::crate, tm: test_mode) -> StolenStuff {
pub fn steal(crate: @ast::crate, tm: test_mode) -> StolenStuff {
let exprs = @mut ~[];
let tys = @mut ~[];
let v = visit::mk_simple_visitor(@visit::SimpleVisitor {
Expand Down Expand Up @@ -197,7 +197,7 @@ pub fn safe_to_replace_ty(t: &ast::ty_, _tm: test_mode) -> bool {
}

// Replace the |i|th expr (in fold order) of |crate| with |newexpr|.
pub fn replace_expr_in_crate(crate: ast::crate, i: uint,
pub fn replace_expr_in_crate(crate: @ast::crate, i: uint,
newexpr: ast::expr, tm: test_mode) ->
ast::crate {
let j: @mut uint = @mut 0u;
Expand All @@ -222,13 +222,13 @@ pub fn replace_expr_in_crate(crate: ast::crate, i: uint,
.. *fold::default_ast_fold()
};
let af = fold::make_fold(afp);
let crate2: @ast::crate = @af.fold_crate(&crate);
let crate2: @ast::crate = @af.fold_crate(crate);
*crate2
}


// Replace the |i|th ty (in fold order) of |crate| with |newty|.
pub fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::Ty,
pub fn replace_ty_in_crate(crate: @ast::crate, i: uint, newty: ast::Ty,
tm: test_mode) -> ast::crate {
let j: @mut uint = @mut 0u;
fn fold_ty_rep(j_: @mut uint,
Expand All @@ -248,7 +248,7 @@ pub fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::Ty,
.. *fold::default_ast_fold()
};
let af = fold::make_fold(afp);
let crate2: @ast::crate = @af.fold_crate(&crate);
let crate2: @ast::crate = @af.fold_crate(crate);
*crate2
}

Expand All @@ -261,7 +261,7 @@ pub fn as_str(f: @fn(+x: @io::Writer)) -> ~str {
io::with_str_writer(f)
}

pub fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
pub fn check_variants_of_ast(crate: @ast::crate, codemap: @codemap::CodeMap,
filename: &Path, cx: Context) {
let stolen = steal(crate, cx.mode);
let extra_exprs = do common_exprs().filtered |a| {
Expand All @@ -275,13 +275,13 @@ pub fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
}

pub fn check_variants_T<T: Copy>(
crate: ast::crate,
crate: @ast::crate,
codemap: @codemap::CodeMap,
filename: &Path,
thing_label: ~str,
things: ~[T],
stringifier: @fn(@T, @syntax::parse::token::ident_interner) -> ~str,
replacer: @fn(ast::crate, uint, T, test_mode) -> ast::crate,
replacer: @fn(@ast::crate, uint, T, test_mode) -> ast::crate,
cx: Context
) {
error!("%s contains %u %s objects", filename.to_str(),
Expand Down Expand Up @@ -323,7 +323,7 @@ pub fn check_variants_T<T: Copy>(
last_part(filename.to_str()),
thing_label, i, j);
let safe_to_run = !(content_is_dangerous_to_run(*str3)
|| has_raw_pointers(*crate2));
|| has_raw_pointers(crate2));
check_whole_compiler(*str3, &Path(file_label),
safe_to_run);
}
Expand Down Expand Up @@ -480,7 +480,7 @@ pub fn parse_and_print(code: @~str) -> ~str {
}
}

pub fn has_raw_pointers(c: ast::crate) -> bool {
pub fn has_raw_pointers(c: @ast::crate) -> bool {
let has_rp = @mut false;
fn visit_ty(flag: @mut bool, t: @ast::Ty) {
match t.node {
Expand Down Expand Up @@ -634,7 +634,7 @@ pub fn check_variants(files: &[Path], cx: Context) {
pprust::no_ann(),
false)))
});
check_variants_of_ast(*crate, sess.cm, file, cx);
check_variants_of_ast(crate, sess.cm, file, cx);
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub enum output_type {
output_type_exe,
}

pub fn llvm_err(sess: Session, +msg: ~str) -> ! {
pub fn llvm_err(sess: Session, msg: ~str) -> ! {
unsafe {
let cstr = llvm::LLVMRustGetLastError();
if cstr == ptr::null() {
Expand Down Expand Up @@ -153,7 +153,7 @@ pub mod jit {
code: entry,
env: ptr::null()
};
let func: &fn(++argv: ~[@~str]) = cast::transmute(closure);
let func: &fn(argv: ~[@~str]) = cast::transmute(closure);

func(~[sess.opts.binary]);
}
Expand Down Expand Up @@ -519,7 +519,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,

// This calculates CMH as defined above
fn crate_meta_extras_hash(symbol_hasher: &hash::State,
+cmh_items: ~[@ast::meta_item],
cmh_items: ~[@ast::meta_item],
dep_hashes: ~[~str]) -> @str {
fn len_and_str(s: &str) -> ~str {
fmt!("%u_%s", s.len(), s)
Expand Down Expand Up @@ -568,7 +568,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
name, default));
}

fn crate_meta_name(sess: Session, output: &Path, +opt_name: Option<@str>)
fn crate_meta_name(sess: Session, output: &Path, opt_name: Option<@str>)
-> @str {
return match opt_name {
Some(v) => v,
Expand Down Expand Up @@ -703,7 +703,7 @@ pub fn mangle(sess: Session, ss: path) -> ~str {
}

pub fn exported_name(sess: Session,
+path: path,
path: path,
hash: &str,
vers: &str) -> ~str {
return mangle(sess,
Expand All @@ -713,7 +713,7 @@ pub fn exported_name(sess: Session,
}

pub fn mangle_exported_name(ccx: @CrateContext,
+path: path,
path: path,
t: ty::t) -> ~str {
let hash = get_symbol_hash(ccx, t);
return exported_name(ccx.sess, path,
Expand All @@ -733,17 +733,17 @@ pub fn mangle_internal_name_by_type_only(ccx: @CrateContext,
}

pub fn mangle_internal_name_by_path_and_seq(ccx: @CrateContext,
+path: path,
+flav: ~str) -> ~str {
path: path,
flav: ~str) -> ~str {
return mangle(ccx.sess,
vec::append_one(path, path_name((ccx.names)(flav))));
}

pub fn mangle_internal_name_by_path(ccx: @CrateContext, +path: path) -> ~str {
pub fn mangle_internal_name_by_path(ccx: @CrateContext, path: path) -> ~str {
return mangle(ccx.sess, path);
}

pub fn mangle_internal_name_by_seq(ccx: @CrateContext, +flav: ~str) -> ~str {
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, flav: ~str) -> ~str {
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
}

Expand All @@ -768,7 +768,7 @@ pub fn link_binary(sess: Session,
out_filename: &Path,
lm: LinkMeta) {
// Converts a library file-stem into a cc -l argument
fn unlib(config: @session::config, +stem: ~str) -> ~str {
fn unlib(config: @session::config, stem: ~str) -> ~str {
if stem.starts_with("lib") &&
config.os != session::os_win32 {
stem.slice(3, stem.len()).to_owned()
Expand Down
Loading