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