Address review comments

This commit is contained in:
Jakub Bukaj 2014-10-28 18:32:05 +01:00
parent 7f523e7252
commit 6d2080c448
4 changed files with 9 additions and 12 deletions

View File

@ -104,6 +104,8 @@
* fallthrough node. It is only live if the function could converge
* via means other than an explicit `return` expression. That is, it is
* only dead if the end of the function's block can never be reached.
* It is the responsibility of typeck to ensure that there are no
* `return` expressions in a function declared as diverging.
*/
use middle::def::*;

View File

@ -876,11 +876,8 @@ pub fn trans_call_inner<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
_ => {}
}
match ret_ty {
ty::FnConverging(_) => {},
ty::FnDiverging => {
Unreachable(bcx);
}
if ret_ty == ty::FnDiverging {
Unreachable(bcx);
}
Result::new(bcx, llresult)

View File

@ -204,7 +204,7 @@ pub fn trans_intrinsic_call<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, node: ast::N
fcx.pop_custom_cleanup_scope(cleanup_scope);
// The only intrinsic function that diverges.
// These are the only intrinsic functions that diverge.
if name.get() == "abort" {
let llfn = ccx.get_intrinsic(&("llvm.trap"));
Call(bcx, llfn, [], None);

View File

@ -957,12 +957,10 @@ impl Repr for ty::FnSig {
impl Repr for ty::FnOutput {
fn repr(&self, tcx: &ctxt) -> String {
match *self {
ty::FnConverging(ty) => {
format!("FnConverging({0})", ty.repr(tcx))
}
ty::FnDiverging => {
"FnDiverging".to_string()
}
ty::FnConverging(ty) =>
format!("FnConverging({0})", ty.repr(tcx)),
ty::FnDiverging =>
"FnDiverging".to_string()
}
}
}