Skip to content

Commit

Permalink
make match exaustive
Browse files Browse the repository at this point in the history
  • Loading branch information
qmx committed Sep 30, 2017
1 parent 59e778e commit a29c770
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/librustc/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,17 @@ fn resolve_associated_item<'a, 'tcx>(
substs: rcvr_substs
})
}
traits::VtableBuiltin(..) if Some(trait_id) == tcx.lang_items().clone_trait() => {
Some(Instance {
def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
substs: rcvr_substs
})
}
_ => {
None
traits::VtableBuiltin(..) => {
if let Some(_) = tcx.lang_items().clone_trait() {
Some(Instance {
def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
substs: rcvr_substs
})
} else {
None
}
}
traits::VtableDefaultImpl(..) | traits::VtableParam(..) => None
}
}

Expand Down Expand Up @@ -287,8 +289,9 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind,
//
// These are both the same at trans time.
Ok(true)
}
_ => Err(()),
}
(ty::ClosureKind::FnMut, _) |
(ty::ClosureKind::FnOnce, _) => Err(())
}
}

Expand Down

0 comments on commit a29c770

Please sign in to comment.