Skip to content

librustc: remove check::FnKind enum since we only ever use one variant. #14632

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

Merged
merged 1 commit into from
Jun 4, 2014
Merged
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
24 changes: 2 additions & 22 deletions src/librustc/middle/typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,6 @@ pub struct Inherited<'a> {
upvar_borrow_map: RefCell<ty::UpvarBorrowMap>,
}

#[deriving(Clone)]
pub enum FnKind {
// A do-closure.
DoBlock,

// A normal closure or fn item.
Vanilla
}

#[deriving(Clone)]
pub struct FnStyleState {
pub def: ast::NodeId,
Expand Down Expand Up @@ -249,11 +240,6 @@ pub struct FnCtxt<'a> {
// can actually be made to live as long as it needs to live.
region_lb: Cell<ast::NodeId>,

// Says whether we're inside a for loop, in a do block
// or neither. Helps with error messages involving the
// function return type.
fn_kind: FnKind,

inh: &'a Inherited<'a>,

ccx: &'a CrateCtxt<'a>,
Expand Down Expand Up @@ -289,7 +275,6 @@ fn blank_fn_ctxt<'a>(ccx: &'a CrateCtxt<'a>,
ret_ty: rty,
ps: RefCell::new(FnStyleState::function(ast::NormalFn, 0)),
region_lb: Cell::new(region_bnd),
fn_kind: Vanilla,
inh: inh,
ccx: ccx
}
Expand Down Expand Up @@ -356,7 +341,7 @@ fn check_bare_fn(ccx: &CrateCtxt,
ty::ty_bare_fn(ref fn_ty) => {
let inh = Inherited::new(ccx.tcx, param_env);
let fcx = check_fn(ccx, fn_ty.fn_style, &fn_ty.sig,
decl, id, body, Vanilla, &inh);
decl, id, body, &inh);

vtable::resolve_in_block(&fcx, body);
regionck::regionck_fn(&fcx, body);
Expand Down Expand Up @@ -440,7 +425,6 @@ fn check_fn<'a>(ccx: &'a CrateCtxt<'a>,
decl: &ast::FnDecl,
id: ast::NodeId,
body: &ast::Block,
fn_kind: FnKind,
inherited: &'a Inherited<'a>) -> FnCtxt<'a>
{
/*!
Expand Down Expand Up @@ -479,7 +463,6 @@ fn check_fn<'a>(ccx: &'a CrateCtxt<'a>,
ret_ty: ret_ty,
ps: RefCell::new(FnStyleState::function(fn_style, id)),
region_lb: Cell::new(body.id),
fn_kind: fn_kind,
inh: inherited,
ccx: ccx
};
Expand Down Expand Up @@ -2295,7 +2278,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
store: ty::TraitStore,
decl: &ast::FnDecl,
body: ast::P<ast::Block>,
fn_kind: FnKind,
expected: Option<ty::t>) {
let tcx = fcx.ccx.tcx;

Expand Down Expand Up @@ -2373,7 +2355,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
};

check_fn(fcx.ccx, inherited_style, &fty_sig,
decl, id, body, fn_kind, fcx.inh);
decl, id, body, fcx.inh);
}


Expand Down Expand Up @@ -3044,7 +3026,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
ty::RegionTraitStore(region, ast::MutMutable),
decl,
body,
Vanilla,
expected);
}
ast::ExprProc(decl, body) => {
Expand All @@ -3053,7 +3034,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
ty::UniqTraitStore,
decl,
body,
Vanilla,
expected);
}
ast::ExprBlock(b) => {
Expand Down