Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[breaking-batch] Remove some old code from libsyntax #33157

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ impl PathParameters {
pub fn none() -> PathParameters {
PathParameters::AngleBracketed(AngleBracketedParameterData {
lifetimes: Vec::new(),
types: P::empty(),
bindings: P::empty(),
types: P::new(),
bindings: P::new(),
})
}

Expand Down Expand Up @@ -421,7 +421,7 @@ impl Default for Generics {
fn default() -> Generics {
Generics {
lifetimes: Vec::new(),
ty_params: P::empty(),
ty_params: P::new(),
where_clause: WhereClause {
id: DUMMY_NODE_ID,
predicates: Vec::new(),
Expand Down
1 change: 0 additions & 1 deletion src/libsyntax/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ pub mod config;
pub mod entry;
pub mod feature_gate;
pub mod fold;
pub mod owned_slice;
pub mod parse;
pub mod ptr;
pub mod show_span;
Expand Down
14 changes: 0 additions & 14 deletions src/libsyntax/owned_slice.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/libsyntax/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ mod tests {
Abi::Rust,
ast::Generics{ // no idea on either of these:
lifetimes: Vec::new(),
ty_params: P::empty(),
ty_params: P::new(),
where_clause: ast::WhereClause {
id: ast::DUMMY_NODE_ID,
predicates: Vec::new(),
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ impl<'a> Parser<'a> {
let other_bounds = if self.eat(&token::BinOp(token::Plus)) {
self.parse_ty_param_bounds(BoundParsingMode::Bare)?
} else {
P::empty()
P::new()
};
let all_bounds =
Some(TraitTyParamBound(poly_trait_ref, TraitBoundModifier::None)).into_iter()
Expand Down Expand Up @@ -4240,7 +4240,7 @@ impl<'a> Parser<'a> {
-> PResult<'a, TyParamBounds>
{
if !self.eat(&token::Colon) {
Ok(P::empty())
Ok(P::new())
} else {
self.parse_ty_param_bounds(mode)
}
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ impl<'a> State<'a> {
ast::TyKind::BareFn(ref f) => {
let generics = ast::Generics {
lifetimes: f.lifetimes.clone(),
ty_params: P::empty(),
ty_params: P::new(),
where_clause: ast::WhereClause {
id: ast::DUMMY_NODE_ID,
predicates: Vec::new(),
Expand Down Expand Up @@ -3021,7 +3021,7 @@ impl<'a> State<'a> {
}
let generics = ast::Generics {
lifetimes: Vec::new(),
ty_params: P::empty(),
ty_params: P::new(),
where_clause: ast::WhereClause {
id: ast::DUMMY_NODE_ID,
predicates: Vec::new(),
Expand Down
42 changes: 6 additions & 36 deletions src/libsyntax/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ impl<T: 'static> P<T> {
}
}

impl<T> Deref for P<T> {
impl<T: ?Sized> Deref for P<T> {
type Target = T;

fn deref<'a>(&'a self) -> &'a T {
fn deref(&self) -> &T {
&self.ptr
}
}
Expand All @@ -97,11 +97,12 @@ impl<T: 'static + Clone> Clone for P<T> {
}
}

impl<T: Debug> Debug for P<T> {
impl<T: ?Sized + Debug> Debug for P<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Debug::fmt(&**self, f)
Debug::fmt(&self.ptr, f)
}
}

impl<T: Display> Display for P<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Display::fmt(&**self, f)
Expand All @@ -126,19 +127,8 @@ impl<T: Encodable> Encodable for P<T> {
}
}


impl<T:fmt::Debug> fmt::Debug for P<[T]> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self.ptr.fmt(fmt)
}
}

impl<T> P<[T]> {
pub fn new() -> P<[T]> {
P::empty()
}

pub fn empty() -> P<[T]> {
P { ptr: Default::default() }
}

Expand All @@ -151,31 +141,11 @@ impl<T> P<[T]> {
pub fn into_vec(self) -> Vec<T> {
self.ptr.into_vec()
}

pub fn as_slice<'a>(&'a self) -> &'a [T] {
&self.ptr
}

pub fn move_iter(self) -> vec::IntoIter<T> {
self.into_vec().into_iter()
}

pub fn map<U, F: FnMut(&T) -> U>(&self, f: F) -> P<[U]> {
self.iter().map(f).collect()
}
}

impl<T> Deref for P<[T]> {
type Target = [T];

fn deref(&self) -> &[T] {
self.as_slice()
}
}

impl<T> Default for P<[T]> {
fn default() -> P<[T]> {
P::empty()
P::new()
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/libsyntax_ext/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ impl<'a> TraitDef<'a> {
span: self.span,
bound_lifetimes: wb.bound_lifetimes.clone(),
bounded_ty: wb.bounded_ty.clone(),
bounds: P::from_vec(wb.bounds.iter().cloned().collect())
bounds: wb.bounds.iter().cloned().collect(),
})
}
ast::WherePredicate::RegionPredicate(ref rb) => {
Expand Down Expand Up @@ -596,9 +596,9 @@ impl<'a> TraitDef<'a> {
let trait_ref = cx.trait_ref(trait_path);

// Create the type parameters on the `self` path.
let self_ty_params = generics.ty_params.map(|ty_param| {
let self_ty_params = generics.ty_params.iter().map(|ty_param| {
cx.ty_ident(self.span, ty_param.ident)
});
}).collect();

let self_lifetimes: Vec<ast::Lifetime> =
generics.lifetimes
Expand All @@ -609,7 +609,7 @@ impl<'a> TraitDef<'a> {
// Create the type of `self`.
let self_type = cx.ty_path(
cx.path_all(self.span, false, vec!( type_ident ), self_lifetimes,
self_ty_params.into_vec(), Vec::new()));
self_ty_params, Vec::new()));

let attr = cx.attribute(
self.span,
Expand Down
7 changes: 3 additions & 4 deletions src/libsyntax_ext/deriving/generic/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ impl<'a> Ty<'a> {
-> ast::Path {
match *self {
Self_ => {
let self_params = self_generics.ty_params.map(|ty_param| {
let self_params = self_generics.ty_params.iter().map(|ty_param| {
cx.ty_ident(span, ty_param.ident)
});
}).collect();
let lifetimes = self_generics.lifetimes.iter()
.map(|d| d.lifetime)
.collect();

cx.path_all(span, false, vec!(self_ty), lifetimes,
self_params.into_vec(), Vec::new())
cx.path_all(span, false, vec![self_ty], lifetimes, self_params, Vec::new())
}
Literal(ref p) => {
p.to_path(cx, span, self_ty, self_generics)
Expand Down