fn emit_stmt_ast(&mut self, stmt: &ast::Stmt, env: ParamEnv) -> Result<()> {
        match &stmt.kind {
            ast::ReturnStmt(None) => {
                self.mk_ret(None);
            }
            ast::ReturnStmt(Some(expr)) => {
                let expr = self.emit_rvalue(expr.id(), env)?;
                self.mk_ret(Some(expr));
            }
            ast::BreakStmt => match self.break_stack.last() {
                Some(&block) => {
                    self.mk_br(block);
                }
                None => {
                    self.emit(
                        DiagBuilder2::error("break statement outside of loop")
                            .span(stmt.human_span()),
                    );
                    return Err(());
                }
            },
            ast::ContinueStmt => match self.continue_stack.last() {
                Some(&block) => {
                    self.mk_br(block);
                }
                None => {
                    self.emit(
                        DiagBuilder2::error("continue statement outside of loop")
                            .span(stmt.human_span()),
                    );
                    return Err(());
                }
            },
            _ => {
                error!("{:#?}", stmt);
                bug_span!(
                    stmt.span(),
                    self.cx,
                    "code generation for {} not implemented",
                    stmt.format_indefinite()
                );
            }
        }
        Ok(())
    }
/// Emit the code for a statement for which no HIR node exists.
Emit the code for a statement for which no HIR node exists.
Emit the code for a statement for which no HIR node exists .
fn emit_stmt_ast(&mut self, stmt: &ast::Stmt, env: ParamEnv) -> Result<()> {
        match &stmt.kind {
            ast::ReturnStmt(None) => {
                self.mk_ret(None);
            }
            ast::ReturnStmt(Some(expr)) => {
                let expr = self.emit_rvalue(expr.id(), env)?;
                self.mk_ret(Some(expr));
            }
            ast::BreakStmt => match self.break_stack.last() {
                Some(&block) => {
                    self.mk_br(block);
                }
                None => {
                    self.emit(
                        DiagBuilder2::error("break statement outside of loop")
                            .span(stmt.human_span()),
                    );
                    return Err(());
                }
            },
            ast::ContinueStmt => match self.continue_stack.last() {
                Some(&block) => {
                    self.mk_br(block);
                }
                None => {
                    self.emit(
                        DiagBuilder2::error("continue statement outside of loop")
                            .span(stmt.human_span()),
                    );
                    return Err(());
                }
            },
            _ => {
                error!("{:#?}", stmt);
                bug_span!(
                    stmt.span(),
                    self.cx,
                    "code generation for {} not implemented",
                    stmt.format_indefinite()
                );
            }
        }
        Ok(())
    }
fn emit_stmt_ast ( & mut self , stmt : & ast :: Stmt , env : ParamEnv ) -> Result < ( ) > { match & stmt . kind { ast :: ReturnStmt ( None ) => { self . mk_ret ( None ) ; } ast :: ReturnStmt ( Some ( expr ) ) => { let expr = self . emit_rvalue ( expr . id ( ) , env ) ? ; self . mk_ret ( Some ( expr ) ) ; } ast :: BreakStmt => match self . break_stack . last ( ) { Some ( & block ) => { self . mk_br ( block ) ; } None => { self . emit ( DiagBuilder2 :: error ( " " ) . span ( stmt . human_span ( ) ) , ) ; return Err ( ( ) ) ; } } , ast :: ContinueStmt => match self . continue_stack . last ( ) { Some ( & block ) => { self . mk_br ( block ) ; } None => { self . emit ( DiagBuilder2 :: error ( " " ) . span ( stmt . human_span ( ) ) , ) ; return Err ( ( ) ) ; } } , _ => { error ! ( " " stmt ) ; bug_span ! ( stmt span ( ) self cx " " stmt format_indefinite ( ) ) ; } } Ok ( ( ) ) }
Emit the code for a statement for which no HIR node exists.
Emit the code for a statement for which no HIR node exists .
&mut self
stmt
&ast::Stmt
env
ParamEnv
&mut self
stmt
&ast::Stmt
env
ParamEnv