Address review comments
This commit is contained in:
parent
7f523e7252
commit
6d2080c448
@ -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::*;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user