Deprecate name OwnedSlice
and don't use it
This commit is contained in:
parent
09d4a436a7
commit
0d298f9904
@ -90,7 +90,6 @@ use std::cell::{Cell, RefCell};
|
||||
use std::char::from_u32;
|
||||
use std::fmt;
|
||||
use syntax::ast;
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::codemap::{self, Pos, Span};
|
||||
use syntax::parse::token;
|
||||
use syntax::ptr::P;
|
||||
@ -1154,10 +1153,10 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn rebuild_ty_params(&self,
|
||||
ty_params: OwnedSlice<hir::TyParam>,
|
||||
ty_params: P<[hir::TyParam]>,
|
||||
lifetime: hir::Lifetime,
|
||||
region_names: &HashSet<ast::Name>)
|
||||
-> OwnedSlice<hir::TyParam> {
|
||||
-> P<[hir::TyParam]> {
|
||||
ty_params.map(|ty_param| {
|
||||
let bounds = self.rebuild_ty_param_bounds(ty_param.bounds.clone(),
|
||||
lifetime,
|
||||
@ -1173,10 +1172,10 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn rebuild_ty_param_bounds(&self,
|
||||
ty_param_bounds: OwnedSlice<hir::TyParamBound>,
|
||||
ty_param_bounds: hir::TyParamBounds,
|
||||
lifetime: hir::Lifetime,
|
||||
region_names: &HashSet<ast::Name>)
|
||||
-> OwnedSlice<hir::TyParamBound> {
|
||||
-> hir::TyParamBounds {
|
||||
ty_param_bounds.map(|tpb| {
|
||||
match tpb {
|
||||
&hir::RegionTyParamBound(lt) => {
|
||||
@ -1249,7 +1248,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
|
||||
add: &Vec<hir::Lifetime>,
|
||||
keep: &HashSet<ast::Name>,
|
||||
remove: &HashSet<ast::Name>,
|
||||
ty_params: OwnedSlice<hir::TyParam>,
|
||||
ty_params: P<[hir::TyParam]>,
|
||||
where_clause: hir::WhereClause)
|
||||
-> hir::Generics {
|
||||
let mut lifetimes = Vec::new();
|
||||
|
@ -16,7 +16,7 @@ use middle::ty::fold::{TypeFoldable, TypeFolder};
|
||||
|
||||
use std::rc::Rc;
|
||||
use syntax::abi;
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::ptr::P;
|
||||
|
||||
use rustc_front::hir;
|
||||
|
||||
@ -555,8 +555,8 @@ impl<'tcx, T:TypeFoldable<'tcx>> TypeFoldable<'tcx> for ty::Binder<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for OwnedSlice<T> {
|
||||
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> OwnedSlice<T> {
|
||||
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for P<[T]> {
|
||||
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> P<[T]> {
|
||||
self.iter().map(|t| t.fold_with(folder)).collect()
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ use syntax::ast::{MetaWord, MetaList, MetaNameValue};
|
||||
use syntax::attr::ThinAttributesExt;
|
||||
use hir;
|
||||
use syntax::codemap::{respan, Span, Spanned};
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::ptr::P;
|
||||
use syntax::parse::token;
|
||||
use syntax::util::move_map::MoveMap;
|
||||
@ -211,7 +210,7 @@ pub trait Folder : Sized {
|
||||
noop_fold_ty_param(tp, self)
|
||||
}
|
||||
|
||||
fn fold_ty_params(&mut self, tps: OwnedSlice<TyParam>) -> OwnedSlice<TyParam> {
|
||||
fn fold_ty_params(&mut self, tps: P<[TyParam]>) -> P<[TyParam]> {
|
||||
noop_fold_ty_params(tps, self)
|
||||
}
|
||||
|
||||
@ -220,12 +219,12 @@ pub trait Folder : Sized {
|
||||
}
|
||||
|
||||
fn fold_opt_bounds(&mut self,
|
||||
b: Option<OwnedSlice<TyParamBound>>)
|
||||
-> Option<OwnedSlice<TyParamBound>> {
|
||||
b: Option<TyParamBounds>)
|
||||
-> Option<TyParamBounds> {
|
||||
noop_fold_opt_bounds(b, self)
|
||||
}
|
||||
|
||||
fn fold_bounds(&mut self, b: OwnedSlice<TyParamBound>) -> OwnedSlice<TyParamBound> {
|
||||
fn fold_bounds(&mut self, b: TyParamBounds) -> TyParamBounds {
|
||||
noop_fold_bounds(b, self)
|
||||
}
|
||||
|
||||
@ -576,9 +575,9 @@ pub fn noop_fold_ty_param<T: Folder>(tp: TyParam, fld: &mut T) -> TyParam {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn noop_fold_ty_params<T: Folder>(tps: OwnedSlice<TyParam>,
|
||||
pub fn noop_fold_ty_params<T: Folder>(tps: P<[TyParam]>,
|
||||
fld: &mut T)
|
||||
-> OwnedSlice<TyParam> {
|
||||
-> P<[TyParam]> {
|
||||
tps.move_map(|tp| fld.fold_ty_param(tp))
|
||||
}
|
||||
|
||||
@ -726,9 +725,9 @@ pub fn noop_fold_mt<T: Folder>(MutTy { ty, mutbl }: MutTy, folder: &mut T) -> Mu
|
||||
}
|
||||
}
|
||||
|
||||
pub fn noop_fold_opt_bounds<T: Folder>(b: Option<OwnedSlice<TyParamBound>>,
|
||||
pub fn noop_fold_opt_bounds<T: Folder>(b: Option<TyParamBounds>,
|
||||
folder: &mut T)
|
||||
-> Option<OwnedSlice<TyParamBound>> {
|
||||
-> Option<TyParamBounds> {
|
||||
b.map(|bounds| folder.fold_bounds(bounds))
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@ use syntax::abi::Abi;
|
||||
use syntax::ast::{Name, NodeId, DUMMY_NODE_ID, TokenTree, AsmDialect};
|
||||
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, CrateConfig};
|
||||
use syntax::attr::ThinAttributes;
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::parse::token::InternedString;
|
||||
use syntax::ptr::P;
|
||||
|
||||
@ -193,8 +192,8 @@ impl PathParameters {
|
||||
pub fn none() -> PathParameters {
|
||||
AngleBracketedParameters(AngleBracketedParameterData {
|
||||
lifetimes: Vec::new(),
|
||||
types: OwnedSlice::empty(),
|
||||
bindings: OwnedSlice::empty(),
|
||||
types: P::empty(),
|
||||
bindings: P::empty(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -267,10 +266,10 @@ pub struct AngleBracketedParameterData {
|
||||
/// The lifetime parameters for this path segment.
|
||||
pub lifetimes: Vec<Lifetime>,
|
||||
/// The type parameters for this path segment, if present.
|
||||
pub types: OwnedSlice<P<Ty>>,
|
||||
pub types: P<[P<Ty>]>,
|
||||
/// Bindings (equality constraints) on associated types, if present.
|
||||
/// E.g., `Foo<A=Bar>`.
|
||||
pub bindings: OwnedSlice<TypeBinding>,
|
||||
pub bindings: P<[TypeBinding]>,
|
||||
}
|
||||
|
||||
impl AngleBracketedParameterData {
|
||||
@ -310,7 +309,7 @@ pub enum TraitBoundModifier {
|
||||
Maybe,
|
||||
}
|
||||
|
||||
pub type TyParamBounds = OwnedSlice<TyParamBound>;
|
||||
pub type TyParamBounds = P<[TyParamBound]>;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
pub struct TyParam {
|
||||
@ -326,7 +325,7 @@ pub struct TyParam {
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
pub struct Generics {
|
||||
pub lifetimes: Vec<LifetimeDef>,
|
||||
pub ty_params: OwnedSlice<TyParam>,
|
||||
pub ty_params: P<[TyParam]>,
|
||||
pub where_clause: WhereClause,
|
||||
}
|
||||
|
||||
@ -369,7 +368,7 @@ pub struct WhereBoundPredicate {
|
||||
/// The type being bounded
|
||||
pub bounded_ty: P<Ty>,
|
||||
/// Trait and lifetime bounds (`Clone+Send+'static`)
|
||||
pub bounds: OwnedSlice<TyParamBound>,
|
||||
pub bounds: TyParamBounds,
|
||||
}
|
||||
|
||||
/// A lifetime predicate, e.g. `'a: 'b+'c`
|
||||
|
@ -70,7 +70,6 @@ use syntax::attr::{ThinAttributes, ThinAttributesExt};
|
||||
use syntax::ext::mtwt;
|
||||
use syntax::ptr::P;
|
||||
use syntax::codemap::{respan, Spanned, Span};
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::parse::token;
|
||||
use syntax::std_inject;
|
||||
use syntax::visit::{self, Visitor};
|
||||
@ -430,8 +429,8 @@ pub fn lower_ty_param(lctx: &LoweringContext, tp: &TyParam) -> hir::TyParam {
|
||||
}
|
||||
|
||||
pub fn lower_ty_params(lctx: &LoweringContext,
|
||||
tps: &OwnedSlice<TyParam>)
|
||||
-> OwnedSlice<hir::TyParam> {
|
||||
tps: &P<[TyParam]>)
|
||||
-> P<[hir::TyParam]> {
|
||||
tps.iter().map(|tp| lower_ty_param(lctx, tp)).collect()
|
||||
}
|
||||
|
||||
@ -583,8 +582,8 @@ pub fn lower_mt(lctx: &LoweringContext, mt: &MutTy) -> hir::MutTy {
|
||||
}
|
||||
|
||||
pub fn lower_opt_bounds(lctx: &LoweringContext,
|
||||
b: &Option<OwnedSlice<TyParamBound>>)
|
||||
-> Option<OwnedSlice<hir::TyParamBound>> {
|
||||
b: &Option<TyParamBounds>)
|
||||
-> Option<hir::TyParamBounds> {
|
||||
b.as_ref().map(|ref bounds| lower_bounds(lctx, bounds))
|
||||
}
|
||||
|
||||
@ -1795,8 +1794,8 @@ fn path_all(sp: Span,
|
||||
identifier: last_identifier,
|
||||
parameters: hir::AngleBracketedParameters(hir::AngleBracketedParameterData {
|
||||
lifetimes: lifetimes,
|
||||
types: OwnedSlice::from_vec(types),
|
||||
bindings: OwnedSlice::from_vec(bindings),
|
||||
types: P::from_vec(types),
|
||||
bindings: P::from_vec(bindings),
|
||||
}),
|
||||
});
|
||||
hir::Path {
|
||||
|
@ -12,7 +12,6 @@ pub use self::AnnNode::*;
|
||||
|
||||
use syntax::abi;
|
||||
use syntax::ast;
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::codemap::{self, CodeMap, BytePos, Spanned};
|
||||
use syntax::diagnostic;
|
||||
use syntax::parse::token::{self, BinOpToken};
|
||||
@ -519,7 +518,7 @@ impl<'a> State<'a> {
|
||||
hir::TyBareFn(ref f) => {
|
||||
let generics = hir::Generics {
|
||||
lifetimes: f.lifetimes.clone(),
|
||||
ty_params: OwnedSlice::empty(),
|
||||
ty_params: P::empty(),
|
||||
where_clause: hir::WhereClause {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
predicates: Vec::new(),
|
||||
@ -2258,7 +2257,7 @@ impl<'a> State<'a> {
|
||||
}
|
||||
let generics = hir::Generics {
|
||||
lifetimes: Vec::new(),
|
||||
ty_params: OwnedSlice::empty(),
|
||||
ty_params: P::empty(),
|
||||
where_clause: hir::WhereClause {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
predicates: Vec::new(),
|
||||
|
@ -15,7 +15,6 @@ use syntax::ast_util;
|
||||
use syntax::ast::{Name, NodeId, DUMMY_NODE_ID};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::ptr::P;
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
|
||||
pub fn walk_pat<F>(pat: &Pat, mut it: F) -> bool
|
||||
where F: FnMut(&Pat) -> bool
|
||||
@ -336,7 +335,7 @@ pub fn is_path(e: P<Expr>) -> bool {
|
||||
pub fn empty_generics() -> Generics {
|
||||
Generics {
|
||||
lifetimes: Vec::new(),
|
||||
ty_params: OwnedSlice::empty(),
|
||||
ty_params: P::empty(),
|
||||
where_clause: WhereClause {
|
||||
id: DUMMY_NODE_ID,
|
||||
predicates: Vec::new(),
|
||||
@ -354,8 +353,8 @@ pub fn ident_to_path(s: Span, ident: Ident) -> Path {
|
||||
identifier: ident,
|
||||
parameters: hir::AngleBracketedParameters(hir::AngleBracketedParameterData {
|
||||
lifetimes: Vec::new(),
|
||||
types: OwnedSlice::empty(),
|
||||
bindings: OwnedSlice::empty(),
|
||||
types: P::empty(),
|
||||
bindings: P::empty(),
|
||||
}),
|
||||
}),
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ use std::fs::File;
|
||||
use syntax::ast::{self, NodeId};
|
||||
use syntax::codemap::*;
|
||||
use syntax::parse::token::{self, keywords};
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::visit::{self, Visitor};
|
||||
use syntax::print::pprust::{path_to_string, ty_to_string};
|
||||
use syntax::ptr::P;
|
||||
@ -572,7 +571,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
|
||||
fn process_trait(&mut self,
|
||||
item: &ast::Item,
|
||||
generics: &ast::Generics,
|
||||
trait_refs: &OwnedSlice<ast::TyParamBound>,
|
||||
trait_refs: &ast::TyParamBounds,
|
||||
methods: &[P<ast::TraitItem>]) {
|
||||
let qualname = format!("::{}", self.tcx.map.path_to_string(item.id));
|
||||
let val = self.span.snippet(item.span);
|
||||
|
@ -119,7 +119,6 @@ use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
use syntax::codemap::{self, Span, Spanned};
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::parse::token::{self, InternedString};
|
||||
use syntax::ptr::P;
|
||||
use syntax::util::lev_distance::lev_distance;
|
||||
@ -4907,7 +4906,7 @@ pub fn may_break(cx: &ty::ctxt, id: ast::NodeId, b: &hir::Block) -> bool {
|
||||
}
|
||||
|
||||
pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||
tps: &OwnedSlice<hir::TyParam>,
|
||||
tps: &P<[hir::TyParam]>,
|
||||
ty: Ty<'tcx>) {
|
||||
debug!("check_bounds_are_used(n_tps={}, ty={:?})",
|
||||
tps.len(), ty);
|
||||
|
@ -112,7 +112,7 @@ impl<T, U> Clean<U> for ty::Binder<T> where T: Clean<U> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Clean<U>, U> Clean<Vec<U>> for syntax::owned_slice::OwnedSlice<T> {
|
||||
impl<T: Clean<U>, U> Clean<Vec<U>> for P<[T]> {
|
||||
fn clean(&self, cx: &DocContext) -> Vec<U> {
|
||||
self.iter().map(|x| x.clean(cx)).collect()
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ use codemap::{Span, Spanned, DUMMY_SP, ExpnId};
|
||||
use abi::Abi;
|
||||
use ext::base;
|
||||
use ext::tt::macro_parser;
|
||||
use owned_slice::OwnedSlice;
|
||||
use parse::token::InternedString;
|
||||
use parse::token;
|
||||
use parse::lexer;
|
||||
@ -261,8 +260,8 @@ impl PathParameters {
|
||||
pub fn none() -> PathParameters {
|
||||
AngleBracketedParameters(AngleBracketedParameterData {
|
||||
lifetimes: Vec::new(),
|
||||
types: OwnedSlice::empty(),
|
||||
bindings: OwnedSlice::empty(),
|
||||
types: P::empty(),
|
||||
bindings: P::empty(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -334,10 +333,10 @@ pub struct AngleBracketedParameterData {
|
||||
/// The lifetime parameters for this path segment.
|
||||
pub lifetimes: Vec<Lifetime>,
|
||||
/// The type parameters for this path segment, if present.
|
||||
pub types: OwnedSlice<P<Ty>>,
|
||||
pub types: P<[P<Ty>]>,
|
||||
/// Bindings (equality constraints) on associated types, if present.
|
||||
/// E.g., `Foo<A=Bar>`.
|
||||
pub bindings: OwnedSlice<P<TypeBinding>>,
|
||||
pub bindings: P<[P<TypeBinding>]>,
|
||||
}
|
||||
|
||||
impl AngleBracketedParameterData {
|
||||
@ -394,7 +393,7 @@ pub enum TraitBoundModifier {
|
||||
Maybe,
|
||||
}
|
||||
|
||||
pub type TyParamBounds = OwnedSlice<TyParamBound>;
|
||||
pub type TyParamBounds = P<[TyParamBound]>;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
pub struct TyParam {
|
||||
@ -410,7 +409,7 @@ pub struct TyParam {
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
pub struct Generics {
|
||||
pub lifetimes: Vec<LifetimeDef>,
|
||||
pub ty_params: OwnedSlice<TyParam>,
|
||||
pub ty_params: P<[TyParam]>,
|
||||
pub where_clause: WhereClause,
|
||||
}
|
||||
|
||||
@ -430,7 +429,7 @@ impl Default for Generics {
|
||||
fn default() -> Generics {
|
||||
Generics {
|
||||
lifetimes: Vec::new(),
|
||||
ty_params: OwnedSlice::empty(),
|
||||
ty_params: P::empty(),
|
||||
where_clause: WhereClause {
|
||||
id: DUMMY_NODE_ID,
|
||||
predicates: Vec::new(),
|
||||
@ -466,7 +465,7 @@ pub struct WhereBoundPredicate {
|
||||
/// The type being bounded
|
||||
pub bounded_ty: P<Ty>,
|
||||
/// Trait and lifetime bounds (`Clone+Send+'static`)
|
||||
pub bounds: OwnedSlice<TyParamBound>,
|
||||
pub bounds: TyParamBounds,
|
||||
}
|
||||
|
||||
/// A lifetime predicate, e.g. `'a: 'b+'c`
|
||||
|
@ -12,7 +12,6 @@ use ast::*;
|
||||
use ast;
|
||||
use codemap;
|
||||
use codemap::Span;
|
||||
use owned_slice::OwnedSlice;
|
||||
use parse::token;
|
||||
use print::pprust;
|
||||
use ptr::P;
|
||||
@ -43,8 +42,8 @@ pub fn ident_to_path(s: Span, identifier: Ident) -> Path {
|
||||
identifier: identifier,
|
||||
parameters: ast::AngleBracketedParameters(ast::AngleBracketedParameterData {
|
||||
lifetimes: Vec::new(),
|
||||
types: OwnedSlice::empty(),
|
||||
bindings: OwnedSlice::empty(),
|
||||
types: P::empty(),
|
||||
bindings: P::empty(),
|
||||
})
|
||||
}
|
||||
),
|
||||
|
@ -14,7 +14,6 @@ use ast;
|
||||
use attr;
|
||||
use codemap::{Span, respan, Spanned, DUMMY_SP, Pos};
|
||||
use ext::base::ExtCtxt;
|
||||
use owned_slice::OwnedSlice;
|
||||
use parse::token::special_idents;
|
||||
use parse::token::InternedString;
|
||||
use parse::token;
|
||||
@ -56,7 +55,7 @@ pub trait AstBuilder {
|
||||
|
||||
fn ty(&self, span: Span, ty: ast::Ty_) -> P<ast::Ty>;
|
||||
fn ty_path(&self, ast::Path) -> P<ast::Ty>;
|
||||
fn ty_sum(&self, ast::Path, OwnedSlice<ast::TyParamBound>) -> P<ast::Ty>;
|
||||
fn ty_sum(&self, ast::Path, ast::TyParamBounds) -> P<ast::Ty>;
|
||||
fn ty_ident(&self, span: Span, idents: ast::Ident) -> P<ast::Ty>;
|
||||
|
||||
fn ty_rptr(&self, span: Span,
|
||||
@ -70,13 +69,13 @@ pub trait AstBuilder {
|
||||
fn ty_option(&self, ty: P<ast::Ty>) -> P<ast::Ty>;
|
||||
fn ty_infer(&self, sp: Span) -> P<ast::Ty>;
|
||||
|
||||
fn ty_vars(&self, ty_params: &OwnedSlice<ast::TyParam>) -> Vec<P<ast::Ty>> ;
|
||||
fn ty_vars_global(&self, ty_params: &OwnedSlice<ast::TyParam>) -> Vec<P<ast::Ty>> ;
|
||||
fn ty_vars(&self, ty_params: &P<[ast::TyParam]>) -> Vec<P<ast::Ty>> ;
|
||||
fn ty_vars_global(&self, ty_params: &P<[ast::TyParam]>) -> Vec<P<ast::Ty>> ;
|
||||
|
||||
fn typaram(&self,
|
||||
span: Span,
|
||||
id: ast::Ident,
|
||||
bounds: OwnedSlice<ast::TyParamBound>,
|
||||
bounds: ast::TyParamBounds,
|
||||
default: Option<P<ast::Ty>>) -> ast::TyParam;
|
||||
|
||||
fn trait_ref(&self, path: ast::Path) -> ast::TraitRef;
|
||||
@ -331,8 +330,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
identifier: last_identifier,
|
||||
parameters: ast::AngleBracketedParameters(ast::AngleBracketedParameterData {
|
||||
lifetimes: lifetimes,
|
||||
types: OwnedSlice::from_vec(types),
|
||||
bindings: OwnedSlice::from_vec(bindings),
|
||||
types: P::from_vec(types),
|
||||
bindings: P::from_vec(bindings),
|
||||
})
|
||||
});
|
||||
ast::Path {
|
||||
@ -369,8 +368,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
identifier: ident,
|
||||
parameters: ast::AngleBracketedParameters(ast::AngleBracketedParameterData {
|
||||
lifetimes: lifetimes,
|
||||
types: OwnedSlice::from_vec(types),
|
||||
bindings: OwnedSlice::from_vec(bindings),
|
||||
types: P::from_vec(types),
|
||||
bindings: P::from_vec(bindings),
|
||||
})
|
||||
});
|
||||
|
||||
@ -399,7 +398,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
self.ty(path.span, ast::TyPath(None, path))
|
||||
}
|
||||
|
||||
fn ty_sum(&self, path: ast::Path, bounds: OwnedSlice<ast::TyParamBound>) -> P<ast::Ty> {
|
||||
fn ty_sum(&self, path: ast::Path, bounds: ast::TyParamBounds) -> P<ast::Ty> {
|
||||
self.ty(path.span,
|
||||
ast::TyObjectSum(self.ty_path(path),
|
||||
bounds))
|
||||
@ -448,7 +447,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
fn typaram(&self,
|
||||
span: Span,
|
||||
id: ast::Ident,
|
||||
bounds: OwnedSlice<ast::TyParamBound>,
|
||||
bounds: ast::TyParamBounds,
|
||||
default: Option<P<ast::Ty>>) -> ast::TyParam {
|
||||
ast::TyParam {
|
||||
ident: id,
|
||||
@ -462,11 +461,11 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
// these are strange, and probably shouldn't be used outside of
|
||||
// pipes. Specifically, the global version possible generates
|
||||
// incorrect code.
|
||||
fn ty_vars(&self, ty_params: &OwnedSlice<ast::TyParam>) -> Vec<P<ast::Ty>> {
|
||||
fn ty_vars(&self, ty_params: &P<[ast::TyParam]>) -> Vec<P<ast::Ty>> {
|
||||
ty_params.iter().map(|p| self.ty_ident(DUMMY_SP, p.ident)).collect()
|
||||
}
|
||||
|
||||
fn ty_vars_global(&self, ty_params: &OwnedSlice<ast::TyParam>) -> Vec<P<ast::Ty>> {
|
||||
fn ty_vars_global(&self, ty_params: &P<[ast::TyParam]>) -> Vec<P<ast::Ty>> {
|
||||
ty_params
|
||||
.iter()
|
||||
.map(|p| self.ty_path(self.path_global(DUMMY_SP, vec!(p.ident))))
|
||||
|
@ -23,7 +23,6 @@ use ast;
|
||||
use attr::{ThinAttributes, ThinAttributesExt};
|
||||
use ast_util;
|
||||
use codemap::{respan, Span, Spanned};
|
||||
use owned_slice::OwnedSlice;
|
||||
use parse::token;
|
||||
use ptr::P;
|
||||
use util::small_vector::SmallVector;
|
||||
@ -233,7 +232,7 @@ pub trait Folder : Sized {
|
||||
noop_fold_ty_param(tp, self)
|
||||
}
|
||||
|
||||
fn fold_ty_params(&mut self, tps: OwnedSlice<TyParam>) -> OwnedSlice<TyParam> {
|
||||
fn fold_ty_params(&mut self, tps: P<[TyParam]>) -> P<[TyParam]> {
|
||||
noop_fold_ty_params(tps, self)
|
||||
}
|
||||
|
||||
@ -257,13 +256,13 @@ pub trait Folder : Sized {
|
||||
noop_fold_opt_lifetime(o_lt, self)
|
||||
}
|
||||
|
||||
fn fold_opt_bounds(&mut self, b: Option<OwnedSlice<TyParamBound>>)
|
||||
-> Option<OwnedSlice<TyParamBound>> {
|
||||
fn fold_opt_bounds(&mut self, b: Option<TyParamBounds>)
|
||||
-> Option<TyParamBounds> {
|
||||
noop_fold_opt_bounds(b, self)
|
||||
}
|
||||
|
||||
fn fold_bounds(&mut self, b: OwnedSlice<TyParamBound>)
|
||||
-> OwnedSlice<TyParamBound> {
|
||||
fn fold_bounds(&mut self, b: TyParamBounds)
|
||||
-> TyParamBounds {
|
||||
noop_fold_bounds(b, self)
|
||||
}
|
||||
|
||||
@ -714,8 +713,8 @@ pub fn noop_fold_ty_param<T: Folder>(tp: TyParam, fld: &mut T) -> TyParam {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn noop_fold_ty_params<T: Folder>(tps: OwnedSlice<TyParam>, fld: &mut T)
|
||||
-> OwnedSlice<TyParam> {
|
||||
pub fn noop_fold_ty_params<T: Folder>(tps: P<[TyParam]>, fld: &mut T)
|
||||
-> P<[TyParam]> {
|
||||
tps.move_map(|tp| fld.fold_ty_param(tp))
|
||||
}
|
||||
|
||||
@ -871,8 +870,8 @@ pub fn noop_fold_mt<T: Folder>(MutTy {ty, mutbl}: MutTy, folder: &mut T) -> MutT
|
||||
}
|
||||
}
|
||||
|
||||
pub fn noop_fold_opt_bounds<T: Folder>(b: Option<OwnedSlice<TyParamBound>>, folder: &mut T)
|
||||
-> Option<OwnedSlice<TyParamBound>> {
|
||||
pub fn noop_fold_opt_bounds<T: Folder>(b: Option<TyParamBounds>, folder: &mut T)
|
||||
-> Option<TyParamBounds> {
|
||||
b.map(|bounds| folder.fold_bounds(bounds))
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
/// A non-growable owned slice.
|
||||
#[unstable(feature = "rustc_private", issue = "0")]
|
||||
#[rustc_deprecated(since = "1.7.0", reason = "use `ptr::P<[T]>` instead")]
|
||||
pub type OwnedSlice<T> = ::ptr::P<[T]>;
|
||||
|
@ -668,7 +668,6 @@ mod tests {
|
||||
use super::*;
|
||||
use std::rc::Rc;
|
||||
use codemap::{Span, BytePos, Pos, Spanned, NO_EXPANSION};
|
||||
use owned_slice::OwnedSlice;
|
||||
use ast::{self, TokenTree};
|
||||
use abi;
|
||||
use attr::{first_attr_value_str_by_name, AttrMetaMethods};
|
||||
@ -944,7 +943,7 @@ mod tests {
|
||||
abi::Rust,
|
||||
ast::Generics{ // no idea on either of these:
|
||||
lifetimes: Vec::new(),
|
||||
ty_params: OwnedSlice::empty(),
|
||||
ty_params: P::empty(),
|
||||
where_clause: ast::WhereClause {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
predicates: Vec::new(),
|
||||
|
@ -50,7 +50,7 @@ use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue};
|
||||
use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef};
|
||||
use ast::{Ty, Ty_, TypeBinding, TyMac};
|
||||
use ast::{TyFixedLengthVec, TyBareFn, TyTypeof, TyInfer};
|
||||
use ast::{TyParam, TyParamBound, TyParen, TyPath, TyPtr};
|
||||
use ast::{TyParam, TyParamBounds, TyParen, TyPath, TyPtr};
|
||||
use ast::{TyRptr, TyTup, TyU32, TyVec};
|
||||
use ast::TypeTraitItem;
|
||||
use ast::{UnnamedField, UnsafeBlock};
|
||||
@ -73,7 +73,6 @@ use parse::{new_sub_parser_from_file, ParseSess};
|
||||
use util::parser::{AssocOp, Fixity};
|
||||
use print::pprust;
|
||||
use ptr::P;
|
||||
use owned_slice::OwnedSlice;
|
||||
use parse::PResult;
|
||||
use diagnostic::FatalError;
|
||||
|
||||
@ -752,7 +751,7 @@ impl<'a> Parser<'a> {
|
||||
pub fn parse_seq_to_before_gt_or_return<T, F>(&mut self,
|
||||
sep: Option<token::Token>,
|
||||
mut f: F)
|
||||
-> PResult<(OwnedSlice<T>, bool)> where
|
||||
-> PResult<(P<[T]>, bool)> where
|
||||
F: FnMut(&mut Parser) -> PResult<Option<T>>,
|
||||
{
|
||||
let mut v = Vec::new();
|
||||
@ -773,7 +772,7 @@ impl<'a> Parser<'a> {
|
||||
if i % 2 == 0 {
|
||||
match try!(f(self)) {
|
||||
Some(result) => v.push(result),
|
||||
None => return Ok((OwnedSlice::from_vec(v), true))
|
||||
None => return Ok((P::from_vec(v), true))
|
||||
}
|
||||
} else {
|
||||
if let Some(t) = sep.as_ref() {
|
||||
@ -782,7 +781,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
}
|
||||
}
|
||||
return Ok((OwnedSlice::from_vec(v), false));
|
||||
return Ok((P::from_vec(v), false));
|
||||
}
|
||||
|
||||
/// Parse a sequence bracketed by '<' and '>', stopping
|
||||
@ -790,7 +789,7 @@ impl<'a> Parser<'a> {
|
||||
pub fn parse_seq_to_before_gt<T, F>(&mut self,
|
||||
sep: Option<token::Token>,
|
||||
mut f: F)
|
||||
-> PResult<OwnedSlice<T>> where
|
||||
-> PResult<P<[T]>> where
|
||||
F: FnMut(&mut Parser) -> PResult<T>,
|
||||
{
|
||||
let (result, returned) = try!(self.parse_seq_to_before_gt_or_return(sep,
|
||||
@ -802,7 +801,7 @@ impl<'a> Parser<'a> {
|
||||
pub fn parse_seq_to_gt<T, F>(&mut self,
|
||||
sep: Option<token::Token>,
|
||||
f: F)
|
||||
-> PResult<OwnedSlice<T>> where
|
||||
-> PResult<P<[T]>> where
|
||||
F: FnMut(&mut Parser) -> PResult<T>,
|
||||
{
|
||||
let v = try!(self.parse_seq_to_before_gt(sep, f));
|
||||
@ -813,7 +812,7 @@ impl<'a> Parser<'a> {
|
||||
pub fn parse_seq_to_gt_or_return<T, F>(&mut self,
|
||||
sep: Option<token::Token>,
|
||||
f: F)
|
||||
-> PResult<(OwnedSlice<T>, bool)> where
|
||||
-> PResult<(P<[T]>, bool)> where
|
||||
F: FnMut(&mut Parser) -> PResult<Option<T>>,
|
||||
{
|
||||
let (v, returned) = try!(self.parse_seq_to_before_gt_or_return(sep, f));
|
||||
@ -1077,7 +1076,7 @@ impl<'a> Parser<'a> {
|
||||
let other_bounds = if try!(self.eat(&token::BinOp(token::Plus)) ){
|
||||
try!(self.parse_ty_param_bounds(BoundParsingMode::Bare))
|
||||
} else {
|
||||
OwnedSlice::empty()
|
||||
P::empty()
|
||||
};
|
||||
let all_bounds =
|
||||
Some(TraitTyParamBound(poly_trait_ref, TraitBoundModifier::None)).into_iter()
|
||||
@ -1710,8 +1709,8 @@ impl<'a> Parser<'a> {
|
||||
|
||||
ast::AngleBracketedParameters(ast::AngleBracketedParameterData {
|
||||
lifetimes: lifetimes,
|
||||
types: OwnedSlice::from_vec(types),
|
||||
bindings: OwnedSlice::from_vec(bindings),
|
||||
types: P::from_vec(types),
|
||||
bindings: P::from_vec(bindings),
|
||||
})
|
||||
} else if try!(self.eat(&token::OpenDelim(token::Paren)) ){
|
||||
let lo = self.last_span.lo;
|
||||
@ -1774,8 +1773,8 @@ impl<'a> Parser<'a> {
|
||||
identifier: identifier,
|
||||
parameters: ast::AngleBracketedParameters(ast::AngleBracketedParameterData {
|
||||
lifetimes: lifetimes,
|
||||
types: OwnedSlice::from_vec(types),
|
||||
bindings: OwnedSlice::from_vec(bindings),
|
||||
types: P::from_vec(types),
|
||||
bindings: P::from_vec(bindings),
|
||||
}),
|
||||
});
|
||||
|
||||
@ -3883,10 +3882,10 @@ impl<'a> Parser<'a> {
|
||||
// otherwise returns empty list.
|
||||
fn parse_colon_then_ty_param_bounds(&mut self,
|
||||
mode: BoundParsingMode)
|
||||
-> PResult<OwnedSlice<TyParamBound>>
|
||||
-> PResult<TyParamBounds>
|
||||
{
|
||||
if !try!(self.eat(&token::Colon) ){
|
||||
Ok(OwnedSlice::empty())
|
||||
Ok(P::empty())
|
||||
} else {
|
||||
self.parse_ty_param_bounds(mode)
|
||||
}
|
||||
@ -3898,7 +3897,7 @@ impl<'a> Parser<'a> {
|
||||
// and bound = 'region | trait_ref
|
||||
fn parse_ty_param_bounds(&mut self,
|
||||
mode: BoundParsingMode)
|
||||
-> PResult<OwnedSlice<TyParamBound>>
|
||||
-> PResult<TyParamBounds>
|
||||
{
|
||||
let mut result = vec!();
|
||||
loop {
|
||||
@ -3940,7 +3939,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(OwnedSlice::from_vec(result));
|
||||
return Ok(P::from_vec(result));
|
||||
}
|
||||
|
||||
/// Matches typaram = IDENT (`?` unbound)? optbounds ( EQ ty )?
|
||||
|
@ -17,7 +17,6 @@ use ast::Attribute;
|
||||
use attr::ThinAttributesExt;
|
||||
use util::parser::AssocOp;
|
||||
use attr;
|
||||
use owned_slice::OwnedSlice;
|
||||
use attr::{AttrMetaMethods, AttributeMethods};
|
||||
use codemap::{self, CodeMap, BytePos};
|
||||
use diagnostic;
|
||||
@ -1001,7 +1000,7 @@ impl<'a> State<'a> {
|
||||
ast::TyBareFn(ref f) => {
|
||||
let generics = ast::Generics {
|
||||
lifetimes: f.lifetimes.clone(),
|
||||
ty_params: OwnedSlice::empty(),
|
||||
ty_params: P::empty(),
|
||||
where_clause: ast::WhereClause {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
predicates: Vec::new(),
|
||||
@ -3024,7 +3023,7 @@ impl<'a> State<'a> {
|
||||
}
|
||||
let generics = ast::Generics {
|
||||
lifetimes: Vec::new(),
|
||||
ty_params: OwnedSlice::empty(),
|
||||
ty_params: P::empty(),
|
||||
where_clause: ast::WhereClause {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
predicates: Vec::new(),
|
||||
|
@ -32,7 +32,6 @@ use ext::expand::ExpansionConfig;
|
||||
use fold::Folder;
|
||||
use util::move_map::MoveMap;
|
||||
use fold;
|
||||
use owned_slice::OwnedSlice;
|
||||
use parse::token::{intern, InternedString};
|
||||
use parse::{token, ParseSess};
|
||||
use print::pprust;
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use owned_slice::OwnedSlice;
|
||||
|
||||
use std::ptr;
|
||||
|
||||
pub trait MoveMap<T>: Sized {
|
||||
@ -69,11 +67,11 @@ impl<T> MoveMap<T> for Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MoveMap<T> for OwnedSlice<T> {
|
||||
impl<T> MoveMap<T> for ::ptr::P<[T]> {
|
||||
fn move_flat_map<F, I>(self, f: F) -> Self
|
||||
where F: FnMut(T) -> I,
|
||||
I: IntoIterator<Item=T>
|
||||
{
|
||||
OwnedSlice::from_vec(self.into_vec().move_flat_map(f))
|
||||
::ptr::P::from_vec(self.into_vec().move_flat_map(f))
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,6 @@ use syntax::codemap::{self, DUMMY_SP};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::diagnostic::SpanHandler;
|
||||
use syntax::util::move_map::MoveMap;
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::parse::token::{intern, InternedString};
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::ptr::P;
|
||||
@ -516,7 +515,7 @@ impl<'a> TraitDef<'a> {
|
||||
|
||||
cx.typaram(self.span,
|
||||
ty_param.ident,
|
||||
OwnedSlice::from_vec(bounds),
|
||||
P::from_vec(bounds),
|
||||
None)
|
||||
}));
|
||||
|
||||
@ -528,7 +527,7 @@ impl<'a> TraitDef<'a> {
|
||||
span: self.span,
|
||||
bound_lifetimes: wb.bound_lifetimes.clone(),
|
||||
bounded_ty: wb.bounded_ty.clone(),
|
||||
bounds: OwnedSlice::from_vec(wb.bounds.iter().cloned().collect())
|
||||
bounds: P::from_vec(wb.bounds.iter().cloned().collect())
|
||||
})
|
||||
}
|
||||
ast::WherePredicate::RegionPredicate(ref rb) => {
|
||||
@ -579,7 +578,7 @@ impl<'a> TraitDef<'a> {
|
||||
span: self.span,
|
||||
bound_lifetimes: vec![],
|
||||
bounded_ty: ty,
|
||||
bounds: OwnedSlice::from_vec(bounds),
|
||||
bounds: P::from_vec(bounds),
|
||||
};
|
||||
|
||||
let predicate = ast::WherePredicate::BoundPredicate(predicate);
|
||||
@ -590,7 +589,7 @@ impl<'a> TraitDef<'a> {
|
||||
|
||||
let trait_generics = Generics {
|
||||
lifetimes: lifetimes,
|
||||
ty_params: OwnedSlice::from_vec(ty_params),
|
||||
ty_params: P::from_vec(ty_params),
|
||||
where_clause: where_clause
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,6 @@ use syntax::ast::{Expr,Generics,Ident};
|
||||
use syntax::ext::base::ExtCtxt;
|
||||
use syntax::ext::build::AstBuilder;
|
||||
use syntax::codemap::{Span,respan};
|
||||
use syntax::owned_slice::OwnedSlice;
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::ptr::P;
|
||||
|
||||
@ -209,7 +208,7 @@ fn mk_generics(lifetimes: Vec<ast::LifetimeDef>, ty_params: Vec<ast::TyParam>)
|
||||
-> Generics {
|
||||
Generics {
|
||||
lifetimes: lifetimes,
|
||||
ty_params: OwnedSlice::from_vec(ty_params),
|
||||
ty_params: P::from_vec(ty_params),
|
||||
where_clause: ast::WhereClause {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
predicates: Vec::new(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user