Remove constraints argument from path_all

It was never used
This commit is contained in:
Mark Rousskov
2019-09-21 15:01:10 -04:00
parent 5349e69ae2
commit 67d88f607e
6 changed files with 13 additions and 14 deletions

View File

@@ -14,20 +14,19 @@ pub trait AstBuilder {}
impl<'a> ExtCtxt<'a> { impl<'a> ExtCtxt<'a> {
pub fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path { pub fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
self.path_all(span, false, strs, vec![], vec![]) self.path_all(span, false, strs, vec![])
} }
pub fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path { pub fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
self.path(span, vec![id]) self.path(span, vec![id])
} }
pub fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path { pub fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
self.path_all(span, true, strs, vec![], vec![]) self.path_all(span, true, strs, vec![])
} }
pub fn path_all(&self, pub fn path_all(&self,
span: Span, span: Span,
global: bool, global: bool,
mut idents: Vec<ast::Ident> , mut idents: Vec<ast::Ident> ,
args: Vec<ast::GenericArg>, args: Vec<ast::GenericArg>)
constraints: Vec<ast::AssocTyConstraint> )
-> ast::Path { -> ast::Path {
assert!(!idents.is_empty()); assert!(!idents.is_empty());
let add_root = global && !idents[0].is_path_segment_keyword(); let add_root = global && !idents[0].is_path_segment_keyword();
@@ -39,8 +38,8 @@ impl<'a> ExtCtxt<'a> {
segments.extend(idents.into_iter().map(|ident| { segments.extend(idents.into_iter().map(|ident| {
ast::PathSegment::from_ident(ident.with_span_pos(span)) ast::PathSegment::from_ident(ident.with_span_pos(span))
})); }));
let args = if !args.is_empty() || !constraints.is_empty() { let args = if !args.is_empty() {
ast::AngleBracketedArgs { args, constraints, span }.into() ast::AngleBracketedArgs { args, constraints: Vec::new(), span }.into()
} else { } else {
None None
}; };

View File

@@ -115,7 +115,7 @@ fn cs_clone_shallow(name: &str,
let span = cx.with_def_site_ctxt(span); let span = cx.with_def_site_ctxt(span);
let assert_path = cx.path_all(span, true, let assert_path = cx.path_all(span, true,
cx.std_path(&[sym::clone, Symbol::intern(helper_name)]), cx.std_path(&[sym::clone, Symbol::intern(helper_name)]),
vec![GenericArg::Type(ty)], vec![]); vec![GenericArg::Type(ty)]);
stmts.push(cx.stmt_let_type_only(span, cx.ty_path(assert_path))); stmts.push(cx.stmt_let_type_only(span, cx.ty_path(assert_path)));
} }
fn process_variant(cx: &mut ExtCtxt<'_>, stmts: &mut Vec<ast::Stmt>, variant: &VariantData) { fn process_variant(cx: &mut ExtCtxt<'_>, stmts: &mut Vec<ast::Stmt>, variant: &VariantData) {

View File

@@ -56,7 +56,7 @@ fn cs_total_eq_assert(cx: &mut ExtCtxt<'_>,
let span = cx.with_def_site_ctxt(span); let span = cx.with_def_site_ctxt(span);
let assert_path = cx.path_all(span, true, let assert_path = cx.path_all(span, true,
cx.std_path(&[sym::cmp, Symbol::intern(helper_name)]), cx.std_path(&[sym::cmp, Symbol::intern(helper_name)]),
vec![GenericArg::Type(ty)], vec![]); vec![GenericArg::Type(ty)]);
stmts.push(cx.stmt_let_type_only(span, cx.ty_path(assert_path))); stmts.push(cx.stmt_let_type_only(span, cx.ty_path(assert_path)));
} }
fn process_variant(cx: &mut ExtCtxt<'_>, fn process_variant(cx: &mut ExtCtxt<'_>,

View File

@@ -664,7 +664,7 @@ impl<'a> TraitDef<'a> {
}).collect(); }).collect();
// Create the type of `self`. // Create the type of `self`.
let path = cx.path_all(self.span, false, vec![type_ident], self_params, vec![]); let path = cx.path_all(self.span, false, vec![type_ident], self_params);
let self_type = cx.ty_path(path); let self_type = cx.ty_path(path);
let attr = cx.attribute(cx.meta_word(self.span, sym::automatically_derived)); let attr = cx.attribute(cx.meta_word(self.span, sym::automatically_derived));

View File

@@ -82,12 +82,12 @@ impl<'a> Path<'a> {
.collect(); .collect();
match self.kind { match self.kind {
PathKind::Global => cx.path_all(span, true, idents, params, Vec::new()), PathKind::Global => cx.path_all(span, true, idents, params),
PathKind::Local => cx.path_all(span, false, idents, params, Vec::new()), PathKind::Local => cx.path_all(span, false, idents, params),
PathKind::Std => { PathKind::Std => {
let def_site = cx.with_def_site_ctxt(DUMMY_SP); let def_site = cx.with_def_site_ctxt(DUMMY_SP);
idents.insert(0, Ident::new(kw::DollarCrate, def_site)); idents.insert(0, Ident::new(kw::DollarCrate, def_site));
cx.path_all(span, false, idents, params, Vec::new()) cx.path_all(span, false, idents, params)
} }
} }
@@ -183,7 +183,7 @@ impl<'a> Ty<'a> {
} }
}).collect(); }).collect();
cx.path_all(span, false, vec![self_ty], params, vec![]) cx.path_all(span, false, vec![self_ty], params)
} }
Literal(ref p) => p.to_path(cx, span, self_ty, generics), Literal(ref p) => p.to_path(cx, span, self_ty, generics),
Ptr(..) => cx.span_bug(span, "pointer in a path in generic `derive`"), Ptr(..) => cx.span_bug(span, "pointer in a path in generic `derive`"),

View File

@@ -32,7 +32,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt<'_>,
Ident::new(sym::str, sp)), Ident::new(sym::str, sp)),
Some(lt), Some(lt),
ast::Mutability::Immutable))], ast::Mutability::Immutable))],
vec![])) ))
} }
Ok(s) => { Ok(s) => {
cx.expr_call_global(sp, cx.expr_call_global(sp,