Skip to content

Commit 727fb63

Browse files
committed
Don't use deprecated name OwnedSlice
1 parent 8042fdd commit 727fb63

File tree

22 files changed

+93
-113
lines changed

22 files changed

+93
-113
lines changed

src/librustc/middle/infer/error_reporting.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ use std::cell::{Cell, RefCell};
9090
use std::char::from_u32;
9191
use std::fmt;
9292
use syntax::ast;
93-
use syntax::owned_slice::OwnedSlice;
9493
use syntax::codemap::{self, Pos, Span};
9594
use syntax::parse::token;
9695
use syntax::ptr::P;
@@ -1153,10 +1152,10 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
11531152
}
11541153

11551154
fn rebuild_ty_params(&self,
1156-
ty_params: OwnedSlice<hir::TyParam>,
1155+
ty_params: hir::Vec<hir::TyParam>,
11571156
lifetime: hir::Lifetime,
11581157
region_names: &HashSet<ast::Name>)
1159-
-> OwnedSlice<hir::TyParam> {
1158+
-> hir::Vec<hir::TyParam> {
11601159
ty_params.move_map(|ty_param| {
11611160
let bounds = self.rebuild_ty_param_bounds(ty_param.bounds,
11621161
lifetime,
@@ -1172,10 +1171,10 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
11721171
}
11731172

11741173
fn rebuild_ty_param_bounds(&self,
1175-
ty_param_bounds: OwnedSlice<hir::TyParamBound>,
1174+
ty_param_bounds: hir::TyParamBounds,
11761175
lifetime: hir::Lifetime,
11771176
region_names: &HashSet<ast::Name>)
1178-
-> OwnedSlice<hir::TyParamBound> {
1177+
-> hir::TyParamBounds {
11791178
ty_param_bounds.move_map(|tpb| {
11801179
match tpb {
11811180
hir::RegionTyParamBound(lt) => {
@@ -1248,7 +1247,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
12481247
add: &Vec<hir::Lifetime>,
12491248
keep: &HashSet<ast::Name>,
12501249
remove: &HashSet<ast::Name>,
1251-
ty_params: OwnedSlice<hir::TyParam>,
1250+
ty_params: hir::Vec<hir::TyParam>,
12521251
where_clause: hir::WhereClause)
12531252
-> hir::Generics {
12541253
let mut lifetimes = Vec::new();

src/librustc/middle/ty/structural_impls.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use middle::ty::fold::{TypeFoldable, TypeFolder};
1616

1717
use std::rc::Rc;
1818
use syntax::abi;
19-
use syntax::owned_slice::OwnedSlice;
19+
use syntax::ptr::P;
2020

2121
use rustc_front::hir;
2222

@@ -555,8 +555,8 @@ impl<'tcx, T:TypeFoldable<'tcx>> TypeFoldable<'tcx> for ty::Binder<T> {
555555
}
556556
}
557557

558-
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for OwnedSlice<T> {
559-
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> OwnedSlice<T> {
558+
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for P<[T]> {
559+
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> P<[T]> {
560560
self.iter().map(|t| t.fold_with(folder)).collect()
561561
}
562562
}

src/librustc_front/fold.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use syntax::ast::{MetaWord, MetaList, MetaNameValue};
1717
use syntax::attr::ThinAttributesExt;
1818
use hir;
1919
use syntax::codemap::{respan, Span, Spanned};
20-
use syntax::owned_slice::OwnedSlice;
2120
use syntax::ptr::P;
2221
use syntax::parse::token;
2322
use syntax::util::MoveMap;
@@ -211,7 +210,7 @@ pub trait Folder : Sized {
211210
noop_fold_ty_param(tp, self)
212211
}
213212

214-
fn fold_ty_params(&mut self, tps: OwnedSlice<TyParam>) -> OwnedSlice<TyParam> {
213+
fn fold_ty_params(&mut self, tps: Vec<TyParam>) -> Vec<TyParam> {
215214
noop_fold_ty_params(tps, self)
216215
}
217216

@@ -220,12 +219,12 @@ pub trait Folder : Sized {
220219
}
221220

222221
fn fold_opt_bounds(&mut self,
223-
b: Option<OwnedSlice<TyParamBound>>)
224-
-> Option<OwnedSlice<TyParamBound>> {
222+
b: Option<TyParamBounds>)
223+
-> Option<TyParamBounds> {
225224
noop_fold_opt_bounds(b, self)
226225
}
227226

228-
fn fold_bounds(&mut self, b: OwnedSlice<TyParamBound>) -> OwnedSlice<TyParamBound> {
227+
fn fold_bounds(&mut self, b: TyParamBounds) -> TyParamBounds {
229228
noop_fold_bounds(b, self)
230229
}
231230

@@ -576,9 +575,9 @@ pub fn noop_fold_ty_param<T: Folder>(tp: TyParam, fld: &mut T) -> TyParam {
576575
}
577576
}
578577

579-
pub fn noop_fold_ty_params<T: Folder>(tps: OwnedSlice<TyParam>,
578+
pub fn noop_fold_ty_params<T: Folder>(tps: Vec<TyParam>,
580579
fld: &mut T)
581-
-> OwnedSlice<TyParam> {
580+
-> Vec<TyParam> {
582581
tps.move_map(|tp| fld.fold_ty_param(tp))
583582
}
584583

@@ -726,9 +725,9 @@ pub fn noop_fold_mt<T: Folder>(MutTy { ty, mutbl }: MutTy, folder: &mut T) -> Mu
726725
}
727726
}
728727

729-
pub fn noop_fold_opt_bounds<T: Folder>(b: Option<OwnedSlice<TyParamBound>>,
728+
pub fn noop_fold_opt_bounds<T: Folder>(b: Option<TyParamBounds>,
730729
folder: &mut T)
731-
-> Option<OwnedSlice<TyParamBound>> {
730+
-> Option<TyParamBounds> {
732731
b.map(|bounds| folder.fold_bounds(bounds))
733732
}
734733

src/librustc_front/hir.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use syntax::abi::Abi;
4242
use syntax::ast::{Name, Ident, NodeId, DUMMY_NODE_ID, TokenTree, AsmDialect};
4343
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, MetaItem};
4444
use syntax::attr::ThinAttributes;
45-
use syntax::owned_slice::OwnedSlice;
4645
use syntax::parse::token::InternedString;
4746
use syntax::ptr::P;
4847

@@ -52,7 +51,7 @@ use util;
5251
use std::fmt;
5352
use serialize::{Encodable, Encoder, Decoder};
5453

55-
pub type Vec<T> = OwnedSlice<T>;
54+
pub type Vec<T> = P<[T]>;
5655

5756
macro_rules! hir_vec {
5857
($elem:expr; $n:expr) => (
@@ -139,8 +138,8 @@ impl PathParameters {
139138
pub fn none() -> PathParameters {
140139
AngleBracketedParameters(AngleBracketedParameterData {
141140
lifetimes: Vec::new(),
142-
types: OwnedSlice::new(),
143-
bindings: OwnedSlice::new(),
141+
types: Vec::new(),
142+
bindings: Vec::new(),
144143
})
145144
}
146145

@@ -213,10 +212,10 @@ pub struct AngleBracketedParameterData {
213212
/// The lifetime parameters for this path segment.
214213
pub lifetimes: Vec<Lifetime>,
215214
/// The type parameters for this path segment, if present.
216-
pub types: OwnedSlice<P<Ty>>,
215+
pub types: Vec<P<Ty>>,
217216
/// Bindings (equality constraints) on associated types, if present.
218217
/// E.g., `Foo<A=Bar>`.
219-
pub bindings: OwnedSlice<TypeBinding>,
218+
pub bindings: Vec<TypeBinding>,
220219
}
221220

222221
impl AngleBracketedParameterData {
@@ -256,7 +255,7 @@ pub enum TraitBoundModifier {
256255
Maybe,
257256
}
258257

259-
pub type TyParamBounds = OwnedSlice<TyParamBound>;
258+
pub type TyParamBounds = Vec<TyParamBound>;
260259

261260
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
262261
pub struct TyParam {
@@ -272,7 +271,7 @@ pub struct TyParam {
272271
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
273272
pub struct Generics {
274273
pub lifetimes: Vec<LifetimeDef>,
275-
pub ty_params: OwnedSlice<TyParam>,
274+
pub ty_params: Vec<TyParam>,
276275
pub where_clause: WhereClause,
277276
}
278277

@@ -315,7 +314,7 @@ pub struct WhereBoundPredicate {
315314
/// The type being bounded
316315
pub bounded_ty: P<Ty>,
317316
/// Trait and lifetime bounds (`Clone+Send+'static`)
318-
pub bounds: OwnedSlice<TyParamBound>,
317+
pub bounds: TyParamBounds,
319318
}
320319

321320
/// A lifetime predicate, e.g. `'a: 'b+'c`

src/librustc_front/lowering.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ use syntax::ast::*;
6969
use syntax::attr::{ThinAttributes, ThinAttributesExt};
7070
use syntax::ptr::P;
7171
use syntax::codemap::{respan, Spanned, Span};
72-
use syntax::owned_slice::OwnedSlice;
7372
use syntax::parse::token::{self, str_to_ident};
7473
use syntax::std_inject;
7574
use syntax::visit::{self, Visitor};
@@ -414,8 +413,8 @@ pub fn lower_ty_param(lctx: &LoweringContext, tp: &TyParam) -> hir::TyParam {
414413
}
415414

416415
pub fn lower_ty_params(lctx: &LoweringContext,
417-
tps: &OwnedSlice<TyParam>)
418-
-> OwnedSlice<hir::TyParam> {
416+
tps: &[TyParam])
417+
-> hir::Vec<hir::TyParam> {
419418
tps.iter().map(|tp| lower_ty_param(lctx, tp)).collect()
420419
}
421420

@@ -567,8 +566,8 @@ pub fn lower_mt(lctx: &LoweringContext, mt: &MutTy) -> hir::MutTy {
567566
}
568567

569568
pub fn lower_opt_bounds(lctx: &LoweringContext,
570-
b: &Option<OwnedSlice<TyParamBound>>)
571-
-> Option<OwnedSlice<hir::TyParamBound>> {
569+
b: &Option<TyParamBounds>)
570+
-> Option<hir::TyParamBounds> {
572571
b.as_ref().map(|ref bounds| lower_bounds(lctx, bounds))
573572
}
574573

src/librustc_front/print/pprust.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub use self::AnnNode::*;
1212

1313
use syntax::abi;
1414
use syntax::ast;
15-
use syntax::owned_slice::OwnedSlice;
1615
use syntax::codemap::{self, CodeMap, BytePos, Spanned};
1716
use syntax::diagnostic;
1817
use syntax::parse::token::{self, BinOpToken};
@@ -519,7 +518,7 @@ impl<'a> State<'a> {
519518
hir::TyBareFn(ref f) => {
520519
let generics = hir::Generics {
521520
lifetimes: f.lifetimes.clone(),
522-
ty_params: OwnedSlice::new(),
521+
ty_params: hir::Vec::new(),
523522
where_clause: hir::WhereClause {
524523
id: ast::DUMMY_NODE_ID,
525524
predicates: hir::Vec::new(),
@@ -2258,7 +2257,7 @@ impl<'a> State<'a> {
22582257
}
22592258
let generics = hir::Generics {
22602259
lifetimes: hir::Vec::new(),
2261-
ty_params: OwnedSlice::new(),
2260+
ty_params: hir::Vec::new(),
22622261
where_clause: hir::WhereClause {
22632262
id: ast::DUMMY_NODE_ID,
22642263
predicates: hir::Vec::new(),

src/librustc_front/util.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use syntax::ast_util;
1515
use syntax::ast::{Ident, Name, NodeId, DUMMY_NODE_ID};
1616
use syntax::codemap::Span;
1717
use syntax::ptr::P;
18-
use syntax::owned_slice::OwnedSlice;
1918

2019
pub fn walk_pat<F>(pat: &Pat, mut it: F) -> bool
2120
where F: FnMut(&Pat) -> bool
@@ -336,7 +335,7 @@ pub fn is_path(e: P<Expr>) -> bool {
336335
pub fn empty_generics() -> Generics {
337336
Generics {
338337
lifetimes: Vec::new(),
339-
ty_params: OwnedSlice::new(),
338+
ty_params: Vec::new(),
340339
where_clause: WhereClause {
341340
id: DUMMY_NODE_ID,
342341
predicates: Vec::new(),
@@ -354,8 +353,8 @@ pub fn ident_to_path(s: Span, ident: Ident) -> Path {
354353
identifier: ident,
355354
parameters: hir::AngleBracketedParameters(hir::AngleBracketedParameterData {
356355
lifetimes: Vec::new(),
357-
types: OwnedSlice::new(),
358-
bindings: OwnedSlice::new(),
356+
types: Vec::new(),
357+
bindings: Vec::new(),
359358
}),
360359
}],
361360
}

src/librustc_mir/hair/cx/to_ref.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use hair::*;
1212

1313
use rustc_front::hir;
14-
use syntax::owned_slice::OwnedSlice;
1514
use syntax::ptr::P;
1615

1716
pub trait ToRef {
@@ -63,8 +62,7 @@ impl<'a,'tcx:'a,T,U> ToRef for &'tcx Vec<T>
6362
}
6463
}
6564

66-
67-
impl<'a,'tcx:'a,T,U> ToRef for &'tcx OwnedSlice<T>
65+
impl<'a,'tcx:'a,T,U> ToRef for &'tcx P<[T]>
6866
where &'tcx T: ToRef<Output=U>
6967
{
7068
type Output = Vec<U>;

src/librustc_trans/save/dump_csv.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use std::path::Path;
4242
use syntax::ast::{self, NodeId};
4343
use syntax::codemap::*;
4444
use syntax::parse::token::{self, keywords};
45-
use syntax::owned_slice::OwnedSlice;
4645
use syntax::visit::{self, Visitor};
4746
use syntax::print::pprust::{path_to_string, ty_to_string};
4847
use syntax::ptr::P;
@@ -573,7 +572,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
573572
fn process_trait(&mut self,
574573
item: &ast::Item,
575574
generics: &ast::Generics,
576-
trait_refs: &OwnedSlice<ast::TyParamBound>,
575+
trait_refs: &ast::TyParamBounds,
577576
methods: &[P<ast::TraitItem>]) {
578577
let qualname = format!("::{}", self.tcx.map.path_to_string(item.id));
579578
let val = self.span.snippet(item.span);

src/librustc_typeck/check/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ use syntax::ast;
119119
use syntax::attr;
120120
use syntax::attr::AttrMetaMethods;
121121
use syntax::codemap::{self, Span, Spanned};
122-
use syntax::owned_slice::OwnedSlice;
123122
use syntax::parse::token::{self, InternedString};
124123
use syntax::ptr::P;
125124
use syntax::util::lev_distance::lev_distance;
@@ -4904,7 +4903,7 @@ pub fn may_break(cx: &ty::ctxt, id: ast::NodeId, b: &hir::Block) -> bool {
49044903
}
49054904

49064905
pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
4907-
tps: &OwnedSlice<hir::TyParam>,
4906+
tps: &[hir::TyParam],
49084907
ty: Ty<'tcx>) {
49094908
debug!("check_bounds_are_used(n_tps={}, ty={:?})",
49104909
tps.len(), ty);

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<T, U> Clean<U> for ty::Binder<T> where T: Clean<U> {
108108
}
109109
}
110110

111-
impl<T: Clean<U>, U> Clean<Vec<U>> for syntax::owned_slice::OwnedSlice<T> {
111+
impl<T: Clean<U>, U> Clean<Vec<U>> for P<[T]> {
112112
fn clean(&self, cx: &DocContext) -> Vec<U> {
113113
self.iter().map(|x| x.clean(cx)).collect()
114114
}

src/libsyntax/ast.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ use abi::Abi;
5151
use ast_util;
5252
use ext::base;
5353
use ext::tt::macro_parser;
54-
use owned_slice::OwnedSlice;
5554
use parse::token::{InternedString, str_to_ident};
5655
use parse::token;
5756
use parse::lexer;
@@ -262,8 +261,8 @@ impl PathParameters {
262261
pub fn none() -> PathParameters {
263262
AngleBracketedParameters(AngleBracketedParameterData {
264263
lifetimes: Vec::new(),
265-
types: OwnedSlice::new(),
266-
bindings: OwnedSlice::new(),
264+
types: P::new(),
265+
bindings: P::new(),
267266
})
268267
}
269268

@@ -335,10 +334,10 @@ pub struct AngleBracketedParameterData {
335334
/// The lifetime parameters for this path segment.
336335
pub lifetimes: Vec<Lifetime>,
337336
/// The type parameters for this path segment, if present.
338-
pub types: OwnedSlice<P<Ty>>,
337+
pub types: P<[P<Ty>]>,
339338
/// Bindings (equality constraints) on associated types, if present.
340339
/// E.g., `Foo<A=Bar>`.
341-
pub bindings: OwnedSlice<P<TypeBinding>>,
340+
pub bindings: P<[P<TypeBinding>]>,
342341
}
343342

344343
impl AngleBracketedParameterData {
@@ -395,7 +394,7 @@ pub enum TraitBoundModifier {
395394
Maybe,
396395
}
397396

398-
pub type TyParamBounds = OwnedSlice<TyParamBound>;
397+
pub type TyParamBounds = P<[TyParamBound]>;
399398

400399
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
401400
pub struct TyParam {
@@ -411,7 +410,7 @@ pub struct TyParam {
411410
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
412411
pub struct Generics {
413412
pub lifetimes: Vec<LifetimeDef>,
414-
pub ty_params: OwnedSlice<TyParam>,
413+
pub ty_params: P<[TyParam]>,
415414
pub where_clause: WhereClause,
416415
}
417416

@@ -454,7 +453,7 @@ pub struct WhereBoundPredicate {
454453
/// The type being bounded
455454
pub bounded_ty: P<Ty>,
456455
/// Trait and lifetime bounds (`Clone+Send+'static`)
457-
pub bounds: OwnedSlice<TyParamBound>,
456+
pub bounds: TyParamBounds,
458457
}
459458

460459
/// A lifetime predicate, e.g. `'a: 'b+'c`

0 commit comments

Comments
 (0)