1
Fork 0

Remove unused code from remaining compiler crates

This commit is contained in:
est31 2020-10-09 11:23:40 +02:00
parent 58b3923ad3
commit 215cd36e1c
13 changed files with 0 additions and 221 deletions

View file

@ -139,24 +139,6 @@ impl<'a> ExtCtxt<'a> {
ast::Lifetime { id: ast::DUMMY_NODE_ID, ident: ident.with_span_pos(span) }
}
pub fn lifetime_def(
&self,
span: Span,
ident: Ident,
attrs: Vec<ast::Attribute>,
bounds: ast::GenericBounds,
) -> ast::GenericParam {
let lifetime = self.lifetime(span, ident);
ast::GenericParam {
ident: lifetime.ident,
id: lifetime.id,
attrs: attrs.into(),
bounds,
kind: ast::GenericParamKind::Lifetime,
is_placeholder: false,
}
}
pub fn stmt_expr(&self, expr: P<ast::Expr>) -> ast::Stmt {
ast::Stmt {
id: ast::DUMMY_NODE_ID,
@ -465,24 +447,6 @@ impl<'a> ExtCtxt<'a> {
self.pat_tuple_struct(span, path, vec![pat])
}
pub fn pat_none(&self, span: Span) -> P<ast::Pat> {
let some = self.std_path(&[sym::option, sym::Option, sym::None]);
let path = self.path_global(span, some);
self.pat_path(span, path)
}
pub fn pat_ok(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
let some = self.std_path(&[sym::result, sym::Result, sym::Ok]);
let path = self.path_global(span, some);
self.pat_tuple_struct(span, path, vec![pat])
}
pub fn pat_err(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
let some = self.std_path(&[sym::result, sym::Result, sym::Err]);
let path = self.path_global(span, some);
self.pat_tuple_struct(span, path, vec![pat])
}
pub fn arm(&self, span: Span, pat: P<ast::Pat>, expr: P<ast::Expr>) -> ast::Arm {
ast::Arm {
attrs: vec![],
@ -514,26 +478,6 @@ impl<'a> ExtCtxt<'a> {
self.expr(span, ast::ExprKind::If(cond, self.block_expr(then), els))
}
pub fn lambda_fn_decl(
&self,
span: Span,
fn_decl: P<ast::FnDecl>,
body: P<ast::Expr>,
fn_decl_span: Span,
) -> P<ast::Expr> {
self.expr(
span,
ast::ExprKind::Closure(
ast::CaptureBy::Ref,
ast::Async::No,
ast::Movability::Movable,
fn_decl,
body,
fn_decl_span,
),
)
}
pub fn lambda(&self, span: Span, ids: Vec<Ident>, body: P<ast::Expr>) -> P<ast::Expr> {
let fn_decl = self.fn_decl(
ids.iter().map(|id| self.param(span, *id, self.ty(span, ast::TyKind::Infer))).collect(),
@ -610,47 +554,6 @@ impl<'a> ExtCtxt<'a> {
})
}
pub fn variant(&self, span: Span, ident: Ident, tys: Vec<P<ast::Ty>>) -> ast::Variant {
let vis_span = span.shrink_to_lo();
let fields: Vec<_> = tys
.into_iter()
.map(|ty| ast::StructField {
span: ty.span,
ty,
ident: None,
vis: ast::Visibility {
span: vis_span,
kind: ast::VisibilityKind::Inherited,
tokens: None,
},
attrs: Vec::new(),
id: ast::DUMMY_NODE_ID,
is_placeholder: false,
})
.collect();
let vdata = if fields.is_empty() {
ast::VariantData::Unit(ast::DUMMY_NODE_ID)
} else {
ast::VariantData::Tuple(fields, ast::DUMMY_NODE_ID)
};
ast::Variant {
attrs: Vec::new(),
data: vdata,
disr_expr: None,
id: ast::DUMMY_NODE_ID,
ident,
vis: ast::Visibility {
span: vis_span,
kind: ast::VisibilityKind::Inherited,
tokens: None,
},
span,
is_placeholder: false,
}
}
pub fn item_static(
&self,
span: Span,