Skip to content

Commit c755449

Browse files
committed
Revert "rustc: Change all non-keyword uses of "link""
This reverts commit 3b013cd.
1 parent 150acd2 commit c755449

File tree

19 files changed

+85
-88
lines changed

19 files changed

+85
-88
lines changed

src/libcore/dlist.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ priv impl<T> DList<T> {
141141
// Link two nodes together. If either of them are 'none', also sets
142142
// the head and/or tail pointers appropriately.
143143
#[inline(always)]
144-
fn link_nodes(+before: DListLink<T>, +after: DListLink<T>) {
144+
fn link(+before: DListLink<T>, +after: DListLink<T>) {
145145
match before {
146146
Some(neighbour) => neighbour.next = after,
147147
None => self.hd = after
@@ -155,35 +155,35 @@ priv impl<T> DList<T> {
155155
fn unlink(nobe: DListNode<T>) {
156156
self.assert_mine(nobe);
157157
assert self.size > 0;
158-
self.link_nodes(nobe.prev, nobe.next);
158+
self.link(nobe.prev, nobe.next);
159159
nobe.prev = None; // Release extraneous references.
160160
nobe.next = None;
161161
nobe.linked = false;
162162
self.size -= 1;
163163
}
164164
165165
fn add_head(+nobe: DListLink<T>) {
166-
self.link_nodes(nobe, self.hd); // Might set tail too.
166+
self.link(nobe, self.hd); // Might set tail too.
167167
self.hd = nobe;
168168
self.size += 1;
169169
}
170170
fn add_tail(+nobe: DListLink<T>) {
171-
self.link_nodes(self.tl, nobe); // Might set head too.
171+
self.link(self.tl, nobe); // Might set head too.
172172
self.tl = nobe;
173173
self.size += 1;
174174
}
175175
fn insert_left(nobe: DListLink<T>, neighbour: DListNode<T>) {
176176
self.assert_mine(neighbour);
177177
assert self.size > 0;
178-
self.link_nodes(neighbour.prev, nobe);
179-
self.link_nodes(nobe, Some(neighbour));
178+
self.link(neighbour.prev, nobe);
179+
self.link(nobe, Some(neighbour));
180180
self.size += 1;
181181
}
182182
fn insert_right(neighbour: DListNode<T>, nobe: DListLink<T>) {
183183
self.assert_mine(neighbour);
184184
assert self.size > 0;
185-
self.link_nodes(nobe, neighbour.next);
186-
self.link_nodes(Some(neighbour), nobe);
185+
self.link(nobe, neighbour.next);
186+
self.link(Some(neighbour), nobe);
187187
self.size += 1;
188188
}
189189
}
@@ -315,7 +315,7 @@ impl<T> DList<T> {
315315
fail ~"Cannot append a dlist to itself!"
316316
}
317317
if them.len() > 0 {
318-
self.link_nodes(self.tl, them.hd);
318+
self.link(self.tl, them.hd);
319319
self.tl = them.tl;
320320
self.size += them.size;
321321
them.size = 0;
@@ -332,7 +332,7 @@ impl<T> DList<T> {
332332
fail ~"Cannot prepend a dlist to itself!"
333333
}
334334
if them.len() > 0 {
335-
self.link_nodes(them.tl, self.hd);
335+
self.link(them.tl, self.hd);
336336
self.hd = them.hd;
337337
self.size += them.size;
338338
them.size = 0;
@@ -366,11 +366,11 @@ impl<T> DList<T> {
366366

367367
/// Iterate over nodes.
368368
pure fn each_node(f: fn(DListNode<T>) -> bool) {
369-
let mut link_node = self.peek_n();
370-
while link_node.is_some() {
371-
let nobe = link_node.get();
369+
let mut link = self.peek_n();
370+
while link.is_some() {
371+
let nobe = link.get();
372372
if !f(nobe) { break; }
373-
link_node = nobe.next_link();
373+
link = nobe.next_link();
374374
}
375375
}
376376

@@ -381,10 +381,10 @@ impl<T> DList<T> {
381381
}
382382
// iterate forwards
383383
let mut count = 0;
384-
let mut link_node = self.peek_n();
385-
let mut rabbit = link_node;
386-
while option::is_some(link_node) {
387-
let nobe = option::get(link_node);
384+
let mut link = self.peek_n();
385+
let mut rabbit = link;
386+
while option::is_some(link) {
387+
let nobe = option::get(link);
388388
assert nobe.linked;
389389
// check cycle
390390
if option::is_some(rabbit) { rabbit = option::get(rabbit).next; }
@@ -393,15 +393,15 @@ impl<T> DList<T> {
393393
assert !box::ptr_eq(*option::get(rabbit), *nobe);
394394
}
395395
// advance
396-
link_node = nobe.next_link();
396+
link = nobe.next_link();
397397
count += 1;
398398
}
399399
assert count == self.len();
400400
// iterate backwards - some of this is probably redundant.
401-
link_node = self.peek_tail_n();
402-
rabbit = link_node;
403-
while option::is_some(link_node) {
404-
let nobe = option::get(link_node);
401+
link = self.peek_tail_n();
402+
rabbit = link;
403+
while option::is_some(link) {
404+
let nobe = option::get(link);
405405
assert nobe.linked;
406406
// check cycle
407407
if option::is_some(rabbit) { rabbit = option::get(rabbit).prev; }
@@ -410,7 +410,7 @@ impl<T> DList<T> {
410410
assert !box::ptr_eq(*option::get(rabbit), *nobe);
411411
}
412412
// advance
413-
link_node = nobe.prev_link();
413+
link = nobe.prev_link();
414414
count -= 1;
415415
}
416416
assert count == 0;

src/libcore/iter-trait/dlist.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ type IMPL_T<A> = dlist::DList<A>;
99
* node is forbidden.
1010
*/
1111
pure fn EACH<A>(self: IMPL_T<A>, f: fn(A) -> bool) {
12-
let mut link_node = self.peek_n();
13-
while option::is_some(link_node) {
14-
let nobe = option::get(link_node);
12+
let mut link = self.peek_n();
13+
while option::is_some(link) {
14+
let nobe = option::get(link);
1515
assert nobe.linked;
1616
if !f(nobe.data) { break; }
1717
// 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) {
2525
|| box::ptr_eq(*self.tl.expect(~"tailless dlist?"), *nobe)))) {
2626
fail ~"Removing a dlist node during iteration is forbidden!"
2727
}
28-
link_node = nobe.next_link();
28+
link = nobe.next_link();
2929
}
3030
}
3131

src/libcore/libc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,7 @@ mod funcs {
10331033
fn getppid() -> pid_t;
10341034
fn getuid() -> uid_t;
10351035
fn isatty(fd: c_int) -> c_int;
1036-
#[link_name="link"]
1037-
fn lnk(src: *c_char, dst: *c_char) -> c_int;
1036+
fn link(src: *c_char, dst: *c_char) -> c_int;
10381037
fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
10391038
fn pathconf(path: *c_char, name: c_int) -> c_long;
10401039
fn pause() -> c_int;
File renamed without changes.

src/rustc/driver/driver.rs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use syntax::attr;
77
use middle::{trans, freevars, kind, ty, typeck, lint};
88
use syntax::print::{pp, pprust};
99
use util::ppaux;
10-
use back::linkage;
10+
use back::link;
1111
use result::{Ok, Err};
1212
use std::getopts;
1313
use io::WriterUtil;
@@ -258,20 +258,20 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
258258
exp_map, exp_map2, maps));
259259

260260
time(time_passes, ~"LLVM passes", ||
261-
linkage::write::run_passes(sess, llmod,
262-
&outputs.obj_filename));
261+
link::write::run_passes(sess, llmod,
262+
&outputs.obj_filename));
263263

264264
let stop_after_codegen =
265-
sess.opts.output_type != linkage::output_type_exe ||
266-
(sess.opts.static && sess.building_library) ||
265+
sess.opts.output_type != link::output_type_exe ||
266+
(sess.opts.static && sess.building_library) ||
267267
sess.opts.jit;
268268

269269
if stop_after_codegen { return {crate: crate, tcx: Some(ty_cx)}; }
270270

271271
time(time_passes, ~"linking", ||
272-
linkage::link_binary(sess,
273-
&outputs.obj_filename,
274-
&outputs.out_filename, link_meta));
272+
link::link_binary(sess,
273+
&outputs.obj_filename,
274+
&outputs.out_filename, link_meta));
275275

276276
return {crate: crate, tcx: Some(ty_cx)};
277277
}
@@ -492,19 +492,17 @@ fn build_session_options(binary: ~str,
492492
let jit = opt_present(matches, ~"jit");
493493
let output_type =
494494
if parse_only || no_trans {
495-
linkage::output_type_none
495+
link::output_type_none
496496
} else if opt_present(matches, ~"S") &&
497497
opt_present(matches, ~"emit-llvm") {
498-
linkage::output_type_llvm_assembly
498+
link::output_type_llvm_assembly
499499
} else if opt_present(matches, ~"S") {
500-
linkage::output_type_assembly
500+
link::output_type_assembly
501501
} else if opt_present(matches, ~"c") {
502-
linkage::output_type_object
502+
link::output_type_object
503503
} else if opt_present(matches, ~"emit-llvm") {
504-
linkage::output_type_bitcode
505-
} else {
506-
linkage::output_type_exe
507-
};
504+
link::output_type_bitcode
505+
} else { link::output_type_exe };
508506
let extra_debuginfo = opt_present(matches, ~"xg");
509507
let debuginfo = opt_present(matches, ~"g") || extra_debuginfo;
510508
let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
@@ -513,8 +511,7 @@ fn build_session_options(binary: ~str,
513511
let save_temps = getopts::opt_present(matches, ~"save-temps");
514512
match output_type {
515513
// unless we're emitting huamn-readable assembly, omit comments.
516-
linkage::output_type_llvm_assembly |
517-
linkage::output_type_assembly => (),
514+
link::output_type_llvm_assembly | link::output_type_assembly => (),
518515
_ => debugging_opts |= session::no_asm_comments
519516
}
520517
let opt_level = {
@@ -660,18 +657,18 @@ fn build_output_filenames(input: input,
660657
let out_path;
661658
let sopts = sess.opts;
662659
let stop_after_codegen =
663-
sopts.output_type != linkage::output_type_exe ||
660+
sopts.output_type != link::output_type_exe ||
664661
sopts.static && sess.building_library;
665662

666663

667664
let obj_suffix =
668665
match sopts.output_type {
669-
linkage::output_type_none => ~"none",
670-
linkage::output_type_bitcode => ~"bc",
671-
linkage::output_type_assembly => ~"s",
672-
linkage::output_type_llvm_assembly => ~"ll",
666+
link::output_type_none => ~"none",
667+
link::output_type_bitcode => ~"bc",
668+
link::output_type_assembly => ~"s",
669+
link::output_type_llvm_assembly => ~"ll",
673670
// Object and exe output both use the '.o' extension here
674-
linkage::output_type_object | linkage::output_type_exe => ~"o"
671+
link::output_type_object | link::output_type_exe => ~"o"
675672
};
676673

677674
match *ofile {

src/rustc/driver/session.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use syntax::ast::{int_ty, uint_ty, float_ty};
66
use syntax::parse::parse_sess;
77
use metadata::filesearch;
88
use back::target_strs;
9-
use back::linkage;
9+
use back::link;
1010
use middle::lint;
1111

1212

@@ -113,7 +113,7 @@ type options =
113113
lint_opts: ~[(lint::lint, lint::level)],
114114
save_temps: bool,
115115
jit: bool,
116-
output_type: back::linkage::output_type,
116+
output_type: back::link::output_type,
117117
addl_lib_search_paths: ~[Path],
118118
maybe_sysroot: Option<Path>,
119119
target_triple: ~str,
@@ -256,7 +256,7 @@ fn basic_options() -> @options {
256256
lint_opts: ~[],
257257
save_temps: false,
258258
jit: false,
259-
output_type: linkage::output_type_exe,
259+
output_type: link::output_type_exe,
260260
addl_lib_search_paths: ~[],
261261
maybe_sysroot: None,
262262
target_triple: driver::host_triple(),

src/rustc/middle/trans/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::map::{int_hash, str_hash};
2020
use driver::session;
2121
use session::session;
2222
use syntax::attr;
23-
use back::{linkage, abi, upcall};
23+
use back::{link, abi, upcall};
2424
use syntax::{ast, ast_util, codemap, ast_map};
2525
use ast_util::{local_def, path_to_ident};
2626
use syntax::visit;
@@ -32,7 +32,7 @@ use util::common::is_main_name;
3232
use lib::llvm::{llvm, mk_target_data, mk_type_names};
3333
use lib::llvm::{ModuleRef, ValueRef, TypeRef, BasicBlockRef};
3434
use lib::llvm::{True, False};
35-
use linkage::{mangle_internal_name_by_type_only,
35+
use link::{mangle_internal_name_by_type_only,
3636
mangle_internal_name_by_seq,
3737
mangle_internal_name_by_path,
3838
mangle_internal_name_by_path_and_seq,
@@ -2571,7 +2571,7 @@ fn trans_crate(sess: session::session,
25712571

25722572
let symbol_hasher = @hash::default_state();
25732573
let link_meta =
2574-
linkage::build_link_meta(sess, *crate, output, symbol_hasher);
2574+
link::build_link_meta(sess, *crate, output, symbol_hasher);
25752575
let reachable = reachable::find_reachable(crate.node.module, emap, tcx,
25762576
maps.method_map);
25772577

src/rustc/middle/trans/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use type_of::*;
1010
use back::abi;
1111
use syntax::codemap::span;
1212
use syntax::print::pprust::expr_to_str;
13-
use back::linkage::{
13+
use back::link::{
1414
mangle_internal_name_by_path,
1515
mangle_internal_name_by_path_and_seq};
1616
use util::ppaux::ty_to_str;

src/rustc/middle/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use syntax::{ast, ast_map};
1010
use driver::session;
1111
use session::session;
1212
use middle::ty;
13-
use back::{linkage, abi, upcall};
13+
use back::{link, abi, upcall};
1414
use syntax::codemap::span;
1515
use lib::llvm::{llvm, target_data, type_names, associate_type,
1616
name_has_type};

src/rustc/middle/trans/controlflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ fn trans_log(log_ex: @ast::expr,
165165
let global = if ccx.module_data.contains_key(modname) {
166166
ccx.module_data.get(modname)
167167
} else {
168-
let s = linkage::mangle_internal_name_by_path_and_seq(
168+
let s = link::mangle_internal_name_by_path_and_seq(
169169
ccx, modpath, ~"loglevel");
170170
let global = str::as_c_str(s, |buf| {
171171
llvm::LLVMAddGlobal(ccx.llmod, T_i32(), buf)

src/rustc/middle/trans/foreign.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use lib::llvm::{ llvm, TypeRef, ValueRef, Integer, Pointer, Float, Double,
1010
StructRetAttribute, ByValAttribute,
1111
SequentiallyConsistent, Acquire, Release, Xchg };
1212
use syntax::{ast, ast_util};
13-
use back::{linkage, abi};
13+
use back::{link, abi};
1414
use common::*;
1515
use build::*;
1616
use base::*;
@@ -1007,7 +1007,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
10071007
id: ast::node_id) -> ValueRef {
10081008
let _icx = ccx.insn_ctxt("foreign::foreign::build_rust_fn");
10091009
let t = ty::node_id_to_type(ccx.tcx, id);
1010-
let ps = linkage::mangle_internal_name_by_path(
1010+
let ps = link::mangle_internal_name_by_path(
10111011
ccx, vec::append_one(path, ast_map::path_name(
10121012
syntax::parse::token::special_idents::clownshoe_abi
10131013
)));
@@ -1046,7 +1046,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
10461046
// is wired directly into the return slot in the shim struct
10471047
}
10481048

1049-
let shim_name = linkage::mangle_internal_name_by_path(
1049+
let shim_name = link::mangle_internal_name_by_path(
10501050
ccx, vec::append_one(path, ast_map::path_name(
10511051
syntax::parse::token::special_idents::clownshoe_stack_shim
10521052
)));

src/rustc/middle/trans/meth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use syntax::{ast, ast_map};
88
use ast_map::{path, path_mod, path_name, node_id_to_str};
99
use syntax::ast_util::local_def;
1010
use metadata::csearch;
11-
use back::abi;
11+
use back::{link, abi};
1212
use lib::llvm::llvm;
1313
use lib::llvm::{ValueRef, TypeRef};
1414
use lib::llvm::llvm::LLVMGetParam;

src/rustc/middle/trans/monomorphize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use base::{trans_item, get_item_val, no_self, self_arg, trans_fn,
99
get_insn_ctxt};
1010
use syntax::parse::token::special_idents;
1111
use type_of::type_of_fn_from_ty;
12-
use back::linkage::mangle_exported_name;
12+
use back::link::mangle_exported_name;
1313
use middle::ty::{FnTyBase, FnMeta, FnSig};
1414

1515
fn monomorphic_fn(ccx: @crate_ctxt,

src/rustc/rustc.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ mod front {
121121
}
122122

123123
mod back {
124-
mod linkage;
124+
mod link;
125125
mod abi;
126126
mod upcall;
127127
mod x86;

0 commit comments

Comments
 (0)