Skip to content

Commit fd52224

Browse files
author
Jakub Wieczorek
committed
Remove dead code from librustc
1 parent 5bcc154 commit fd52224

File tree

18 files changed

+1
-544
lines changed

18 files changed

+1
-544
lines changed

src/librustc/back/link.rs

-7
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,6 @@ pub fn get_cc_prog(sess: &Session) -> String {
397397
}.to_string()
398398
}
399399

400-
pub fn get_ar_prog(sess: &Session) -> String {
401-
match sess.opts.cg.ar {
402-
Some(ref ar) => (*ar).clone(),
403-
None => "ar".to_string()
404-
}
405-
}
406-
407400
pub fn remove(sess: &Session, path: &Path) {
408401
match fs::unlink(path) {
409402
Ok(..) => {}

src/librustc/diagnostics.rs

-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ register_diagnostics!(
114114
E0102,
115115
E0103,
116116
E0104,
117-
E0105,
118117
E0106,
119118
E0107,
120119
E0108,
@@ -152,7 +151,6 @@ register_diagnostics!(
152151
E0144,
153152
E0145,
154153
E0146,
155-
E0147,
156154
E0148,
157155
E0151,
158156
E0152,

src/librustc/middle/astencode.rs

-73
Original file line numberDiff line numberDiff line change
@@ -662,30 +662,6 @@ impl tr for MethodOrigin {
662662
}
663663
}
664664

665-
// ______________________________________________________________________
666-
// Encoding and decoding vtable_res
667-
668-
pub fn encode_vtable_res(ecx: &e::EncodeContext,
669-
rbml_w: &mut Encoder,
670-
dr: &typeck::vtable_res) {
671-
// can't autogenerate this code because automatic code of
672-
// ty::t doesn't work, and there is no way (atm) to have
673-
// hand-written encoding routines combine with auto-generated
674-
// ones. perhaps we should fix this.
675-
encode_vec_per_param_space(
676-
rbml_w, dr,
677-
|rbml_w, param_tables| encode_vtable_param_res(ecx, rbml_w,
678-
param_tables))
679-
}
680-
681-
pub fn encode_vtable_param_res(ecx: &e::EncodeContext,
682-
rbml_w: &mut Encoder,
683-
param_tables: &typeck::vtable_param_res) {
684-
rbml_w.emit_from_vec(param_tables.as_slice(), |rbml_w, vtable_origin| {
685-
Ok(encode_vtable_origin(ecx, rbml_w, vtable_origin))
686-
}).unwrap()
687-
}
688-
689665
pub fn encode_unboxed_closure_kind(ebml_w: &mut Encoder,
690666
kind: ty::UnboxedClosureKind) {
691667
use serialize::Encoder;
@@ -714,55 +690,6 @@ pub fn encode_unboxed_closure_kind(ebml_w: &mut Encoder,
714690
}).unwrap()
715691
}
716692

717-
pub fn encode_vtable_origin(ecx: &e::EncodeContext,
718-
rbml_w: &mut Encoder,
719-
vtable_origin: &typeck::vtable_origin) {
720-
use serialize::Encoder;
721-
722-
rbml_w.emit_enum("vtable_origin", |rbml_w| {
723-
match *vtable_origin {
724-
typeck::vtable_static(def_id, ref substs, ref vtable_res) => {
725-
rbml_w.emit_enum_variant("vtable_static", 0u, 3u, |rbml_w| {
726-
rbml_w.emit_enum_variant_arg(0u, |rbml_w| {
727-
Ok(rbml_w.emit_def_id(def_id))
728-
});
729-
rbml_w.emit_enum_variant_arg(1u, |rbml_w| {
730-
Ok(rbml_w.emit_substs(ecx, substs))
731-
});
732-
rbml_w.emit_enum_variant_arg(2u, |rbml_w| {
733-
Ok(encode_vtable_res(ecx, rbml_w, vtable_res))
734-
})
735-
})
736-
}
737-
typeck::vtable_param(pn, bn) => {
738-
rbml_w.emit_enum_variant("vtable_param", 1u, 3u, |rbml_w| {
739-
rbml_w.emit_enum_variant_arg(0u, |rbml_w| {
740-
pn.encode(rbml_w)
741-
});
742-
rbml_w.emit_enum_variant_arg(1u, |rbml_w| {
743-
rbml_w.emit_uint(bn)
744-
})
745-
})
746-
}
747-
typeck::vtable_unboxed_closure(def_id) => {
748-
rbml_w.emit_enum_variant("vtable_unboxed_closure",
749-
2u,
750-
1u,
751-
|rbml_w| {
752-
rbml_w.emit_enum_variant_arg(0u, |rbml_w| {
753-
Ok(rbml_w.emit_def_id(def_id))
754-
})
755-
})
756-
}
757-
typeck::vtable_error => {
758-
rbml_w.emit_enum_variant("vtable_error", 3u, 3u, |_rbml_w| {
759-
Ok(())
760-
})
761-
}
762-
}
763-
}).unwrap()
764-
}
765-
766693
pub trait vtable_decoder_helpers {
767694
fn read_vec_per_param_space<T>(&mut self,
768695
f: |&mut Self| -> T)

src/librustc/middle/borrowck/mod.rs

-82
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use middle::cfg;
1616
use middle::dataflow::DataFlowContext;
1717
use middle::dataflow::BitwiseOperator;
1818
use middle::dataflow::DataFlowOperator;
19-
use middle::def;
2019
use middle::expr_use_visitor as euv;
2120
use middle::mem_categorization as mc;
2221
use middle::ty;
@@ -386,11 +385,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
386385
self.tcx.region_maps.is_subregion_of(r_sub, r_sup)
387386
}
388387

389-
pub fn is_subscope_of(&self, r_sub: ast::NodeId, r_sup: ast::NodeId)
390-
-> bool {
391-
self.tcx.region_maps.is_subscope_of(r_sub, r_sup)
392-
}
393-
394388
pub fn mc(&self) -> mc::MemCategorizationContext<'a, ty::ctxt<'tcx>> {
395389
mc::MemCategorizationContext::new(self.tcx)
396390
}
@@ -404,82 +398,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
404398
}
405399
}
406400

407-
pub fn cat_expr_unadjusted(&self, expr: &ast::Expr) -> mc::cmt {
408-
match self.mc().cat_expr_unadjusted(expr) {
409-
Ok(c) => c,
410-
Err(()) => {
411-
self.tcx.sess.span_bug(expr.span, "error in mem categorization");
412-
}
413-
}
414-
}
415-
416-
pub fn cat_expr_autoderefd(&self,
417-
expr: &ast::Expr,
418-
adj: &ty::AutoAdjustment)
419-
-> mc::cmt {
420-
let r = match *adj {
421-
ty::AdjustDerefRef(
422-
ty::AutoDerefRef {
423-
autoderefs: autoderefs, ..}) => {
424-
self.mc().cat_expr_autoderefd(expr, autoderefs)
425-
}
426-
ty::AdjustAddEnv(..) => {
427-
// no autoderefs
428-
self.mc().cat_expr_unadjusted(expr)
429-
}
430-
};
431-
432-
match r {
433-
Ok(c) => c,
434-
Err(()) => {
435-
self.tcx.sess.span_bug(expr.span,
436-
"error in mem categorization");
437-
}
438-
}
439-
}
440-
441-
pub fn cat_def(&self,
442-
id: ast::NodeId,
443-
span: Span,
444-
ty: ty::t,
445-
def: def::Def)
446-
-> mc::cmt {
447-
match self.mc().cat_def(id, span, ty, def) {
448-
Ok(c) => c,
449-
Err(()) => {
450-
self.tcx.sess.span_bug(span, "error in mem categorization");
451-
}
452-
}
453-
}
454-
455-
pub fn cat_captured_var(&self,
456-
closure_id: ast::NodeId,
457-
closure_span: Span,
458-
upvar_def: def::Def)
459-
-> mc::cmt {
460-
// Create the cmt for the variable being borrowed, from the
461-
// caller's perspective
462-
let var_id = upvar_def.def_id().node;
463-
let var_ty = ty::node_id_to_type(self.tcx, var_id);
464-
self.cat_def(closure_id, closure_span, var_ty, upvar_def)
465-
}
466-
467-
pub fn cat_discr(&self, cmt: mc::cmt, match_id: ast::NodeId) -> mc::cmt {
468-
Rc::new(mc::cmt_ {
469-
cat: mc::cat_discr(cmt.clone(), match_id),
470-
mutbl: cmt.mutbl.inherit(),
471-
..*cmt
472-
})
473-
}
474-
475-
pub fn cat_pattern(&self,
476-
cmt: mc::cmt,
477-
pat: &ast::Pat,
478-
op: |mc::cmt, &ast::Pat|) {
479-
let r = self.mc().cat_pattern(cmt, pat, |_,x,y| op(x,y));
480-
assert!(r.is_ok());
481-
}
482-
483401
pub fn report(&self, err: BckError) {
484402
self.span_err(
485403
err.span,

src/librustc/middle/borrowck/move_data.rs

-23
Original file line numberDiff line numberDiff line change
@@ -568,22 +568,6 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> {
568568
}
569569
}
570570

571-
pub fn each_path_moved_by(&self,
572-
id: ast::NodeId,
573-
f: |&Move, &LoanPath| -> bool)
574-
-> bool {
575-
/*!
576-
* Iterates through each path moved by `id`
577-
*/
578-
579-
self.dfcx_moves.each_gen_bit(id, |index| {
580-
let move = self.move_data.moves.borrow();
581-
let move = move.get(index);
582-
let moved_path = move.path;
583-
f(move, &*self.move_data.path_loan_path(moved_path))
584-
})
585-
}
586-
587571
pub fn kind_of_move_of_path(&self,
588572
id: ast::NodeId,
589573
loan_path: &Rc<LoanPath>)
@@ -665,13 +649,6 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> {
665649
})
666650
}
667651

668-
pub fn is_assignee(&self,
669-
id: ast::NodeId)
670-
-> bool {
671-
//! True if `id` is the id of the LHS of an assignment
672-
self.move_data.assignee_ids.borrow().iter().any(|x| x == &id)
673-
}
674-
675652
pub fn each_assignment_of(&self,
676653
id: ast::NodeId,
677654
loan_path: &Rc<LoanPath>,

src/librustc/middle/kind.rs

-11
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,6 @@ pub fn check_freevar_bounds(cx: &Context, fn_span: Span, sp: Span, ty: ty::t,
355355
});
356356
}
357357

358-
pub fn check_trait_cast_bounds(cx: &Context, sp: Span, ty: ty::t,
359-
bounds: ty::BuiltinBounds) {
360-
check_builtin_bounds(cx, ty, bounds, |missing| {
361-
span_err!(cx.tcx.sess, sp, E0147,
362-
"cannot pack type `{}`, which does not fulfill `{}`, as a trait bounded by {}",
363-
ty_to_string(cx.tcx, ty),
364-
missing.user_string(cx.tcx),
365-
bounds.user_string(cx.tcx));
366-
});
367-
}
368-
369358
fn check_copy(cx: &Context, ty: ty::t, sp: Span, reason: &str) {
370359
debug!("type_contents({})={}",
371360
ty_to_string(cx.tcx, ty),

src/librustc/middle/mem_categorization.rs

-4
Original file line numberDiff line numberDiff line change
@@ -735,10 +735,6 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
735735
})
736736
}
737737

738-
pub fn cat_deref_obj<N:ast_node>(&self, node: &N, base_cmt: cmt) -> cmt {
739-
self.cat_deref_common(node, base_cmt, 0, ty::mk_nil(), false)
740-
}
741-
742738
fn cat_deref<N:ast_node>(&self,
743739
node: &N,
744740
base_cmt: cmt,

src/librustc/middle/subst.rs

-52
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,6 @@ impl Substs {
195195
}
196196
}
197197

198-
pub fn with_method_from(self, substs: &Substs) -> Substs {
199-
self.with_method(Vec::from_slice(substs.types.get_slice(FnSpace)),
200-
Vec::from_slice(substs.regions().get_slice(FnSpace)))
201-
}
202-
203198
pub fn with_method(self,
204199
m_types: Vec<ty::t>,
205200
m_regions: Vec<ty::Region>)
@@ -292,15 +287,6 @@ impl<T:fmt::Show> fmt::Show for VecPerParamSpace<T> {
292287
}
293288
}
294289

295-
impl<T:Clone> VecPerParamSpace<T> {
296-
pub fn push_all(&mut self, space: ParamSpace, values: &[T]) {
297-
// FIXME (#15435): slow; O(n^2); could enhance vec to make it O(n).
298-
for t in values.iter() {
299-
self.push(space, t.clone());
300-
}
301-
}
302-
}
303-
304290
impl<T> VecPerParamSpace<T> {
305291
fn limits(&self, space: ParamSpace) -> (uint, uint) {
306292
match space {
@@ -348,14 +334,6 @@ impl<T> VecPerParamSpace<T> {
348334
}
349335
}
350336

351-
pub fn sort(t: Vec<T>, space: |&T| -> ParamSpace) -> VecPerParamSpace<T> {
352-
let mut result = VecPerParamSpace::empty();
353-
for t in t.into_iter() {
354-
result.push(space(&t), t);
355-
}
356-
result
357-
}
358-
359337
/// Appends `value` to the vector associated with `space`.
360338
///
361339
/// Unlike the `push` method in `Vec`, this should not be assumed
@@ -435,12 +413,6 @@ impl<T> VecPerParamSpace<T> {
435413
&self.get_slice(space)[index]
436414
}
437415

438-
pub fn get_mut<'a>(&'a mut self,
439-
space: ParamSpace,
440-
index: uint) -> &'a mut T {
441-
&mut self.get_mut_slice(space)[index]
442-
}
443-
444416
pub fn iter<'a>(&'a self) -> Items<'a,T> {
445417
self.content.iter()
446418
}
@@ -476,30 +448,6 @@ impl<T> VecPerParamSpace<T> {
476448
f.into_iter().map(|p| pred(p)).collect())
477449
}
478450

479-
pub fn map_rev<U>(&self, pred: |&T| -> U) -> VecPerParamSpace<U> {
480-
/*!
481-
* Executes the map but in reverse order. For hacky reasons, we rely
482-
* on this in table.
483-
*
484-
* FIXME(#5527) -- order of eval becomes irrelevant with newer
485-
* trait reform, which features an idempotent algorithm that
486-
* can be run to a fixed point
487-
*/
488-
489-
let mut fns: Vec<U> = self.get_slice(FnSpace).iter().rev().map(|p| pred(p)).collect();
490-
491-
// NB: Calling foo.rev().map().rev() causes the calls to map
492-
// to occur in the wrong order. This was somewhat surprising
493-
// to me, though it makes total sense.
494-
fns.reverse();
495-
496-
let mut selfs: Vec<U> = self.get_slice(SelfSpace).iter().rev().map(|p| pred(p)).collect();
497-
selfs.reverse();
498-
let mut tys: Vec<U> = self.get_slice(TypeSpace).iter().rev().map(|p| pred(p)).collect();
499-
tys.reverse();
500-
VecPerParamSpace::new(tys, selfs, fns)
501-
}
502-
503451
pub fn split(self) -> (Vec<T>, Vec<T>, Vec<T>) {
504452
// FIXME (#15418): this does two traversals when in principle
505453
// one would suffice. i.e. change to use `move_iter`.

0 commit comments

Comments
 (0)