1
Fork 0

Revert "rustc: Change all non-keyword uses of "link""

This reverts commit 3b013cd800.
This commit is contained in:
Patrick Walton 2012-09-18 11:46:39 -07:00
parent 150acd26b2
commit c755449fd6
19 changed files with 85 additions and 88 deletions

View file

@ -141,7 +141,7 @@ priv impl<T> DList<T> {
// Link two nodes together. If either of them are 'none', also sets
// the head and/or tail pointers appropriately.
#[inline(always)]
fn link_nodes(+before: DListLink<T>, +after: DListLink<T>) {
fn link(+before: DListLink<T>, +after: DListLink<T>) {
match before {
Some(neighbour) => neighbour.next = after,
None => self.hd = after
@ -155,7 +155,7 @@ priv impl<T> DList<T> {
fn unlink(nobe: DListNode<T>) {
self.assert_mine(nobe);
assert self.size > 0;
self.link_nodes(nobe.prev, nobe.next);
self.link(nobe.prev, nobe.next);
nobe.prev = None; // Release extraneous references.
nobe.next = None;
nobe.linked = false;
@ -163,27 +163,27 @@ priv impl<T> DList<T> {
}
fn add_head(+nobe: DListLink<T>) {
self.link_nodes(nobe, self.hd); // Might set tail too.
self.link(nobe, self.hd); // Might set tail too.
self.hd = nobe;
self.size += 1;
}
fn add_tail(+nobe: DListLink<T>) {
self.link_nodes(self.tl, nobe); // Might set head too.
self.link(self.tl, nobe); // Might set head too.
self.tl = nobe;
self.size += 1;
}
fn insert_left(nobe: DListLink<T>, neighbour: DListNode<T>) {
self.assert_mine(neighbour);
assert self.size > 0;
self.link_nodes(neighbour.prev, nobe);
self.link_nodes(nobe, Some(neighbour));
self.link(neighbour.prev, nobe);
self.link(nobe, Some(neighbour));
self.size += 1;
}
fn insert_right(neighbour: DListNode<T>, nobe: DListLink<T>) {
self.assert_mine(neighbour);
assert self.size > 0;
self.link_nodes(nobe, neighbour.next);
self.link_nodes(Some(neighbour), nobe);
self.link(nobe, neighbour.next);
self.link(Some(neighbour), nobe);
self.size += 1;
}
}
@ -315,7 +315,7 @@ impl<T> DList<T> {
fail ~"Cannot append a dlist to itself!"
}
if them.len() > 0 {
self.link_nodes(self.tl, them.hd);
self.link(self.tl, them.hd);
self.tl = them.tl;
self.size += them.size;
them.size = 0;
@ -332,7 +332,7 @@ impl<T> DList<T> {
fail ~"Cannot prepend a dlist to itself!"
}
if them.len() > 0 {
self.link_nodes(them.tl, self.hd);
self.link(them.tl, self.hd);
self.hd = them.hd;
self.size += them.size;
them.size = 0;
@ -366,11 +366,11 @@ impl<T> DList<T> {
/// Iterate over nodes.
pure fn each_node(f: fn(DListNode<T>) -> bool) {
let mut link_node = self.peek_n();
while link_node.is_some() {
let nobe = link_node.get();
let mut link = self.peek_n();
while link.is_some() {
let nobe = link.get();
if !f(nobe) { break; }
link_node = nobe.next_link();
link = nobe.next_link();
}
}
@ -381,10 +381,10 @@ impl<T> DList<T> {
}
// iterate forwards
let mut count = 0;
let mut link_node = self.peek_n();
let mut rabbit = link_node;
while option::is_some(link_node) {
let nobe = option::get(link_node);
let mut link = self.peek_n();
let mut rabbit = link;
while option::is_some(link) {
let nobe = option::get(link);
assert nobe.linked;
// check cycle
if option::is_some(rabbit) { rabbit = option::get(rabbit).next; }
@ -393,15 +393,15 @@ impl<T> DList<T> {
assert !box::ptr_eq(*option::get(rabbit), *nobe);
}
// advance
link_node = nobe.next_link();
link = nobe.next_link();
count += 1;
}
assert count == self.len();
// iterate backwards - some of this is probably redundant.
link_node = self.peek_tail_n();
rabbit = link_node;
while option::is_some(link_node) {
let nobe = option::get(link_node);
link = self.peek_tail_n();
rabbit = link;
while option::is_some(link) {
let nobe = option::get(link);
assert nobe.linked;
// check cycle
if option::is_some(rabbit) { rabbit = option::get(rabbit).prev; }
@ -410,7 +410,7 @@ impl<T> DList<T> {
assert !box::ptr_eq(*option::get(rabbit), *nobe);
}
// advance
link_node = nobe.prev_link();
link = nobe.prev_link();
count -= 1;
}
assert count == 0;

View file

@ -9,9 +9,9 @@ type IMPL_T<A> = dlist::DList<A>;
* node is forbidden.
*/
pure fn EACH<A>(self: IMPL_T<A>, f: fn(A) -> bool) {
let mut link_node = self.peek_n();
while option::is_some(link_node) {
let nobe = option::get(link_node);
let mut link = self.peek_n();
while option::is_some(link) {
let nobe = option::get(link);
assert nobe.linked;
if !f(nobe.data) { break; }
// Check (weakly) that the user didn't do a remove.
@ -25,7 +25,7 @@ pure fn EACH<A>(self: IMPL_T<A>, f: fn(A) -> bool) {
|| box::ptr_eq(*self.tl.expect(~"tailless dlist?"), *nobe)))) {
fail ~"Removing a dlist node during iteration is forbidden!"
}
link_node = nobe.next_link();
link = nobe.next_link();
}
}

View file

@ -1033,8 +1033,7 @@ mod funcs {
fn getppid() -> pid_t;
fn getuid() -> uid_t;
fn isatty(fd: c_int) -> c_int;
#[link_name="link"]
fn lnk(src: *c_char, dst: *c_char) -> c_int;
fn link(src: *c_char, dst: *c_char) -> c_int;
fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
fn pathconf(path: *c_char, name: c_int) -> c_long;
fn pause() -> c_int;

View file

@ -7,7 +7,7 @@ use syntax::attr;
use middle::{trans, freevars, kind, ty, typeck, lint};
use syntax::print::{pp, pprust};
use util::ppaux;
use back::linkage;
use back::link;
use result::{Ok, Err};
use std::getopts;
use io::WriterUtil;
@ -258,18 +258,18 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
exp_map, exp_map2, maps));
time(time_passes, ~"LLVM passes", ||
linkage::write::run_passes(sess, llmod,
link::write::run_passes(sess, llmod,
&outputs.obj_filename));
let stop_after_codegen =
sess.opts.output_type != linkage::output_type_exe ||
sess.opts.output_type != link::output_type_exe ||
(sess.opts.static && sess.building_library) ||
sess.opts.jit;
if stop_after_codegen { return {crate: crate, tcx: Some(ty_cx)}; }
time(time_passes, ~"linking", ||
linkage::link_binary(sess,
link::link_binary(sess,
&outputs.obj_filename,
&outputs.out_filename, link_meta));
@ -492,19 +492,17 @@ fn build_session_options(binary: ~str,
let jit = opt_present(matches, ~"jit");
let output_type =
if parse_only || no_trans {
linkage::output_type_none
link::output_type_none
} else if opt_present(matches, ~"S") &&
opt_present(matches, ~"emit-llvm") {
linkage::output_type_llvm_assembly
link::output_type_llvm_assembly
} else if opt_present(matches, ~"S") {
linkage::output_type_assembly
link::output_type_assembly
} else if opt_present(matches, ~"c") {
linkage::output_type_object
link::output_type_object
} else if opt_present(matches, ~"emit-llvm") {
linkage::output_type_bitcode
} else {
linkage::output_type_exe
};
link::output_type_bitcode
} else { link::output_type_exe };
let extra_debuginfo = opt_present(matches, ~"xg");
let debuginfo = opt_present(matches, ~"g") || extra_debuginfo;
let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
@ -513,8 +511,7 @@ fn build_session_options(binary: ~str,
let save_temps = getopts::opt_present(matches, ~"save-temps");
match output_type {
// unless we're emitting huamn-readable assembly, omit comments.
linkage::output_type_llvm_assembly |
linkage::output_type_assembly => (),
link::output_type_llvm_assembly | link::output_type_assembly => (),
_ => debugging_opts |= session::no_asm_comments
}
let opt_level = {
@ -660,18 +657,18 @@ fn build_output_filenames(input: input,
let out_path;
let sopts = sess.opts;
let stop_after_codegen =
sopts.output_type != linkage::output_type_exe ||
sopts.output_type != link::output_type_exe ||
sopts.static && sess.building_library;
let obj_suffix =
match sopts.output_type {
linkage::output_type_none => ~"none",
linkage::output_type_bitcode => ~"bc",
linkage::output_type_assembly => ~"s",
linkage::output_type_llvm_assembly => ~"ll",
link::output_type_none => ~"none",
link::output_type_bitcode => ~"bc",
link::output_type_assembly => ~"s",
link::output_type_llvm_assembly => ~"ll",
// Object and exe output both use the '.o' extension here
linkage::output_type_object | linkage::output_type_exe => ~"o"
link::output_type_object | link::output_type_exe => ~"o"
};
match *ofile {

View file

@ -6,7 +6,7 @@ use syntax::ast::{int_ty, uint_ty, float_ty};
use syntax::parse::parse_sess;
use metadata::filesearch;
use back::target_strs;
use back::linkage;
use back::link;
use middle::lint;
@ -113,7 +113,7 @@ type options =
lint_opts: ~[(lint::lint, lint::level)],
save_temps: bool,
jit: bool,
output_type: back::linkage::output_type,
output_type: back::link::output_type,
addl_lib_search_paths: ~[Path],
maybe_sysroot: Option<Path>,
target_triple: ~str,
@ -256,7 +256,7 @@ fn basic_options() -> @options {
lint_opts: ~[],
save_temps: false,
jit: false,
output_type: linkage::output_type_exe,
output_type: link::output_type_exe,
addl_lib_search_paths: ~[],
maybe_sysroot: None,
target_triple: driver::host_triple(),

View file

@ -20,7 +20,7 @@ use std::map::{int_hash, str_hash};
use driver::session;
use session::session;
use syntax::attr;
use back::{linkage, abi, upcall};
use back::{link, abi, upcall};
use syntax::{ast, ast_util, codemap, ast_map};
use ast_util::{local_def, path_to_ident};
use syntax::visit;
@ -32,7 +32,7 @@ use util::common::is_main_name;
use lib::llvm::{llvm, mk_target_data, mk_type_names};
use lib::llvm::{ModuleRef, ValueRef, TypeRef, BasicBlockRef};
use lib::llvm::{True, False};
use linkage::{mangle_internal_name_by_type_only,
use link::{mangle_internal_name_by_type_only,
mangle_internal_name_by_seq,
mangle_internal_name_by_path,
mangle_internal_name_by_path_and_seq,
@ -2571,7 +2571,7 @@ fn trans_crate(sess: session::session,
let symbol_hasher = @hash::default_state();
let link_meta =
linkage::build_link_meta(sess, *crate, output, symbol_hasher);
link::build_link_meta(sess, *crate, output, symbol_hasher);
let reachable = reachable::find_reachable(crate.node.module, emap, tcx,
maps.method_map);

View file

@ -10,7 +10,7 @@ use type_of::*;
use back::abi;
use syntax::codemap::span;
use syntax::print::pprust::expr_to_str;
use back::linkage::{
use back::link::{
mangle_internal_name_by_path,
mangle_internal_name_by_path_and_seq};
use util::ppaux::ty_to_str;

View file

@ -10,7 +10,7 @@ use syntax::{ast, ast_map};
use driver::session;
use session::session;
use middle::ty;
use back::{linkage, abi, upcall};
use back::{link, abi, upcall};
use syntax::codemap::span;
use lib::llvm::{llvm, target_data, type_names, associate_type,
name_has_type};

View file

@ -165,7 +165,7 @@ fn trans_log(log_ex: @ast::expr,
let global = if ccx.module_data.contains_key(modname) {
ccx.module_data.get(modname)
} else {
let s = linkage::mangle_internal_name_by_path_and_seq(
let s = link::mangle_internal_name_by_path_and_seq(
ccx, modpath, ~"loglevel");
let global = str::as_c_str(s, |buf| {
llvm::LLVMAddGlobal(ccx.llmod, T_i32(), buf)

View file

@ -10,7 +10,7 @@ use lib::llvm::{ llvm, TypeRef, ValueRef, Integer, Pointer, Float, Double,
StructRetAttribute, ByValAttribute,
SequentiallyConsistent, Acquire, Release, Xchg };
use syntax::{ast, ast_util};
use back::{linkage, abi};
use back::{link, abi};
use common::*;
use build::*;
use base::*;
@ -1007,7 +1007,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
id: ast::node_id) -> ValueRef {
let _icx = ccx.insn_ctxt("foreign::foreign::build_rust_fn");
let t = ty::node_id_to_type(ccx.tcx, id);
let ps = linkage::mangle_internal_name_by_path(
let ps = link::mangle_internal_name_by_path(
ccx, vec::append_one(path, ast_map::path_name(
syntax::parse::token::special_idents::clownshoe_abi
)));
@ -1046,7 +1046,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
// is wired directly into the return slot in the shim struct
}
let shim_name = linkage::mangle_internal_name_by_path(
let shim_name = link::mangle_internal_name_by_path(
ccx, vec::append_one(path, ast_map::path_name(
syntax::parse::token::special_idents::clownshoe_stack_shim
)));

View file

@ -8,7 +8,7 @@ use syntax::{ast, ast_map};
use ast_map::{path, path_mod, path_name, node_id_to_str};
use syntax::ast_util::local_def;
use metadata::csearch;
use back::abi;
use back::{link, abi};
use lib::llvm::llvm;
use lib::llvm::{ValueRef, TypeRef};
use lib::llvm::llvm::LLVMGetParam;

View file

@ -9,7 +9,7 @@ use base::{trans_item, get_item_val, no_self, self_arg, trans_fn,
get_insn_ctxt};
use syntax::parse::token::special_idents;
use type_of::type_of_fn_from_ty;
use back::linkage::mangle_exported_name;
use back::link::mangle_exported_name;
use middle::ty::{FnTyBase, FnMeta, FnSig};
fn monomorphic_fn(ccx: @crate_ctxt,

View file

@ -121,7 +121,7 @@ mod front {
}
mod back {
mod linkage;
mod link;
mod abi;
mod upcall;
mod x86;

View file

@ -17,6 +17,7 @@ use syntax::diagnostic::handler;
use syntax::ast;
use syntax::codemap;
use syntax::ast_map;
use rustc::back::link;
use rustc::metadata::filesearch;
use rustc::front;

View file

@ -334,13 +334,13 @@ impl index : cmp::Eq {
* * kind - The type of thing being indexed, e.g. 'Module'
* * name - The name of the thing
* * brief - The brief description
* * lnk - A format-specific string representing the link target
* * link - A format-specific string representing the link target
*/
type index_entry = {
kind: ~str,
name: ~str,
brief: Option<~str>,
lnk: ~str
link: ~str
};
impl index_entry : cmp::Eq {
@ -348,7 +348,7 @@ impl index_entry : cmp::Eq {
self.kind == other.kind &&
self.name == other.name &&
self.brief == other.brief &&
self.lnk == other.lnk
self.link == other.link
}
pure fn ne(&&other: index_entry) -> bool { !self.eq(other) }
}

View file

@ -78,7 +78,7 @@ fn item_to_entry(
doc: doc::itemtag,
config: config::config
) -> doc::index_entry {
let lnk = match doc {
let link = match doc {
doc::modtag(_) | doc::nmodtag(_)
if config.output_style == config::doc_per_mod => {
markdown_writer::make_filename(config, doc::itempage(doc)).to_str()
@ -92,7 +92,7 @@ fn item_to_entry(
kind: markdown_pass::header_kind(doc),
name: markdown_pass::header_name(doc),
brief: doc.brief(),
lnk: lnk
link: link
}
}
@ -156,13 +156,13 @@ fn should_index_mod_contents() {
kind: ~"Module",
name: ~"a",
brief: None,
lnk: ~"#module-a"
link: ~"#module-a"
};
assert option::get(doc.cratemod().index).entries[1] == {
kind: ~"Function",
name: ~"b",
brief: None,
lnk: ~"#function-b"
link: ~"#function-b"
};
}
@ -176,13 +176,13 @@ fn should_index_mod_contents_multi_page() {
kind: ~"Module",
name: ~"a",
brief: None,
lnk: ~"a.html"
link: ~"a.html"
};
assert option::get(doc.cratemod().index).entries[1] == {
kind: ~"Function",
name: ~"b",
brief: None,
lnk: ~"#function-b"
link: ~"#function-b"
};
}
@ -196,7 +196,7 @@ fn should_index_foreign_mod_pages() {
kind: ~"Foreign module",
name: ~"a",
brief: None,
lnk: ~"a.html"
link: ~"a.html"
};
}
@ -220,7 +220,7 @@ fn should_index_foreign_mod_contents() {
kind: ~"Function",
name: ~"b",
brief: None,
lnk: ~"#function-b"
link: ~"#function-b"
};
}

View file

@ -398,7 +398,7 @@ fn write_index(ctxt: ctxt, index: doc::index) {
for index.entries.each |entry| {
let header = header_text_(entry.kind, entry.name);
let id = entry.lnk;
let id = entry.link;
if option::is_some(entry.brief) {
ctxt.w.write_line(fmt!("* [%s](%s) - %s",
header, id, option::get(entry.brief)));

View file

@ -2,14 +2,14 @@
// -*- rust -*-
extern mod std;
type Cell = {mut c: @List};
type cell = {mut c: @list};
enum List { Link(@Cell), Nil, }
enum list { link(@cell), nil, }
fn main() {
let first: @Cell = @{mut c: @Nil()};
let second: @Cell = @{mut c: @Link(first)};
first._0 = @Link(second);
let first: @cell = @{mut c: @nil()};
let second: @cell = @{mut c: @link(first)};
first._0 = @link(second);
sys.rustrt.gc();
let third: @Cell = @{mut c: @Nil()};
let third: @cell = @{mut c: @nil()};
}