Skip to content

Commit e33676b

Browse files
committed
Migrate all users of opt_vec to owned_slice, delete opt_vec.
syntax::opt_vec is now entirely unused, and so can go.
1 parent 0384952 commit e33676b

35 files changed

+162
-340
lines changed

src/librustc/front/std_inject.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use syntax::codemap::DUMMY_SP;
1818
use syntax::codemap;
1919
use syntax::fold::Folder;
2020
use syntax::fold;
21-
use syntax::opt_vec;
21+
use syntax::owned_slice::OwnedSlice;
2222
use syntax::parse::token::InternedString;
2323
use syntax::parse::token;
2424
use syntax::util::small_vector::SmallVector;
@@ -164,12 +164,12 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
164164
ast::PathSegment {
165165
identifier: token::str_to_ident("std"),
166166
lifetimes: Vec::new(),
167-
types: opt_vec::Empty,
167+
types: OwnedSlice::empty(),
168168
},
169169
ast::PathSegment {
170170
identifier: token::str_to_ident("prelude"),
171171
lifetimes: Vec::new(),
172-
types: opt_vec::Empty,
172+
types: OwnedSlice::empty(),
173173
}),
174174
};
175175

src/librustc/front/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use syntax::ext::base::ExtCtxt;
3131
use syntax::ext::expand::ExpansionConfig;
3232
use syntax::fold::Folder;
3333
use syntax::fold;
34-
use syntax::opt_vec;
34+
use syntax::owned_slice::OwnedSlice;
3535
use syntax::parse::token::InternedString;
3636
use syntax::parse::token;
3737
use syntax::print::pprust;
@@ -377,7 +377,7 @@ fn path_node(ids: Vec<ast::Ident> ) -> ast::Path {
377377
segments: ids.move_iter().map(|identifier| ast::PathSegment {
378378
identifier: identifier,
379379
lifetimes: Vec::new(),
380-
types: opt_vec::Empty,
380+
types: OwnedSlice::empty(),
381381
}).collect()
382382
}
383383
}
@@ -389,7 +389,7 @@ fn path_node_global(ids: Vec<ast::Ident> ) -> ast::Path {
389389
segments: ids.move_iter().map(|identifier| ast::PathSegment {
390390
identifier: identifier,
391391
lifetimes: Vec::new(),
392-
types: opt_vec::Empty,
392+
types: OwnedSlice::empty(),
393393
}).collect()
394394
}
395395
}

src/librustc/metadata/tydecode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use syntax::abi::AbiSet;
2424
use syntax::abi;
2525
use syntax::ast;
2626
use syntax::ast::*;
27-
use syntax::opt_vec;
27+
use syntax::owned_slice::OwnedSlice;
2828
use syntax::parse::token;
2929

3030
// Compact string representation for ty::t values. API ty_str &
@@ -198,7 +198,7 @@ fn parse_region_substs(st: &mut PState, conv: conv_did) -> ty::RegionSubsts {
198198
regions.push(r);
199199
}
200200
assert_eq!(next(st), '.');
201-
ty::NonerasedRegions(opt_vec::from(regions))
201+
ty::NonerasedRegions(OwnedSlice::from_vec(regions))
202202
}
203203
_ => fail!("parse_bound_region: bad input")
204204
}

src/librustc/middle/kind.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use util::ppaux::UserString;
1919
use syntax::ast::*;
2020
use syntax::attr;
2121
use syntax::codemap::Span;
22-
use syntax::opt_vec;
22+
use syntax::owned_slice::OwnedSlice;
2323
use syntax::print::pprust::expr_to_str;
2424
use syntax::{visit,ast_util};
2525
use syntax::visit::Visitor;
@@ -92,7 +92,7 @@ fn check_struct_safe_for_destructor(cx: &mut Context,
9292
let struct_tpt = ty::lookup_item_type(cx.tcx, struct_did);
9393
if !struct_tpt.generics.has_type_params() {
9494
let struct_ty = ty::mk_struct(cx.tcx, struct_did, ty::substs {
95-
regions: ty::NonerasedRegions(opt_vec::Empty),
95+
regions: ty::NonerasedRegions(OwnedSlice::empty()),
9696
self_ty: None,
9797
tps: Vec::new()
9898
});

src/librustc/middle/privacy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use syntax::ast_util::{is_local, def_id_of_def, local_def};
2828
use syntax::attr;
2929
use syntax::codemap::Span;
3030
use syntax::parse::token;
31-
use syntax::opt_vec;
31+
use syntax::owned_slice::OwnedSlice;
3232
use syntax::visit;
3333
use syntax::visit::Visitor;
3434

@@ -842,7 +842,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
842842
let seg = ast::PathSegment {
843843
identifier: pid.node.name,
844844
lifetimes: Vec::new(),
845-
types: opt_vec::Empty,
845+
types: OwnedSlice::empty(),
846846
};
847847
let segs = vec!(seg);
848848
let path = ast::Path {

src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use syntax::parse::token::special_idents;
2727
use syntax::parse::token;
2828
use syntax::print::pprust::path_to_str;
2929
use syntax::codemap::{Span, DUMMY_SP, Pos};
30-
use syntax::opt_vec::OptVec;
30+
use syntax::owned_slice::OwnedSlice;
3131
use syntax::visit;
3232
use syntax::visit::Visitor;
3333

@@ -3969,7 +3969,7 @@ impl<'a> Resolver<'a> {
39693969
}
39703970

39713971
fn resolve_type_parameters(&mut self,
3972-
type_parameters: &OptVec<TyParam>) {
3972+
type_parameters: &OwnedSlice<TyParam>) {
39733973
for type_parameter in type_parameters.iter() {
39743974
for bound in type_parameter.bounds.iter() {
39753975
self.resolve_type_parameter_bound(type_parameter.id, bound);

src/librustc/middle/resolve_lifetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use driver::session::Session;
2121
use util::nodemap::NodeMap;
2222
use syntax::ast;
2323
use syntax::codemap::Span;
24-
use syntax::opt_vec::OptVec;
24+
use syntax::owned_slice::OwnedSlice;
2525
use syntax::parse::token::special_idents;
2626
use syntax::parse::token;
2727
use syntax::print::pprust::{lifetime_to_str};
@@ -412,7 +412,7 @@ pub fn early_bound_lifetimes<'a>(generics: &'a ast::Generics) -> Vec<ast::Lifeti
412412
.collect()
413413
}
414414

415-
pub fn free_lifetimes(ty_params: &OptVec<ast::TyParam>) -> Vec<ast::Name> {
415+
pub fn free_lifetimes(ty_params: &OwnedSlice<ast::TyParam>) -> Vec<ast::Name> {
416416
/*!
417417
* Gathers up and returns the names of any lifetimes that appear
418418
* free in `ty_params`. Of course, right now, all lifetimes appear

src/librustc/middle/subst.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use util::ppaux::Repr;
1717

1818
use std::rc::Rc;
1919
use syntax::codemap::Span;
20-
use syntax::opt_vec::OptVec;
20+
use syntax::owned_slice::OwnedSlice;
2121

2222
///////////////////////////////////////////////////////////////////////////
2323
// Public trait `Subst`
@@ -145,10 +145,10 @@ impl<T:Subst> Subst for Rc<T> {
145145
}
146146
}
147147

148-
impl<T:Subst> Subst for OptVec<T> {
148+
impl<T:Subst> Subst for OwnedSlice<T> {
149149
fn subst_spanned(&self, tcx: &ty::ctxt,
150150
substs: &ty::substs,
151-
span: Option<Span>) -> OptVec<T> {
151+
span: Option<Span>) -> OwnedSlice<T> {
152152
self.map(|t| t.subst_spanned(tcx, substs, span))
153153
}
154154
}

src/librustc/middle/trans/debuginfo.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ use std::ptr;
150150
use std::sync::atomics;
151151
use std::slice;
152152
use syntax::codemap::{Span, Pos};
153-
use syntax::{abi, ast, codemap, ast_util, ast_map, opt_vec};
153+
use syntax::{abi, ast, codemap, ast_util, ast_map};
154+
use syntax::owned_slice::OwnedSlice;
154155
use syntax::parse::token;
155156
use syntax::parse::token::special_idents;
156157

@@ -539,7 +540,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
539540
return FunctionWithoutDebugInfo;
540541
}
541542

542-
let empty_generics = ast::Generics { lifetimes: Vec::new(), ty_params: opt_vec::Empty };
543+
let empty_generics = ast::Generics { lifetimes: Vec::new(), ty_params: OwnedSlice::empty() };
543544

544545
let fnitem = cx.tcx.map.get(fn_ast_id);
545546

src/librustc/middle/trans/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use util::ppaux::Repr;
2020
use middle::trans::type_::Type;
2121

2222
use syntax::ast;
23-
use syntax::opt_vec;
23+
use syntax::owned_slice::OwnedSlice;
2424

2525
pub fn arg_is_indirect(ccx: &CrateContext, arg_ty: ty::t) -> bool {
2626
!type_is_immediate(ccx, arg_ty)
@@ -324,7 +324,7 @@ pub fn llvm_type_name(cx: &CrateContext,
324324
an_enum => { "enum" }
325325
};
326326
let tstr = ppaux::parameterized(cx.tcx(), ty::item_path_str(cx.tcx(), did),
327-
&ty::NonerasedRegions(opt_vec::Empty),
327+
&ty::NonerasedRegions(OwnedSlice::empty()),
328328
tps, did, false);
329329
if did.krate == 0 {
330330
format!("{}.{}", name, tstr)

0 commit comments

Comments
 (0)