*/
use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder, CFG};
-use crate::thir::{Expr, ExprRef, LintLevel};
+use crate::thir::{Expr, LintLevel};
use rustc_data_structures::fx::FxHashMap;
use rustc_index::vec::IndexVec;
use rustc_middle::middle::region;
{
debug!("in_scope(region_scope={:?})", region_scope);
let source_scope = self.source_scope;
- let tcx = self.hir.tcx();
+ let tcx = self.tcx;
if let LintLevel::Explicit(current_hir_id) = lint_level {
// Use `maybe_lint_level_root_bounded` with `root_lint_level` as a bound
// to avoid adding Hir dependences on our parents.
let parent_root = tcx.maybe_lint_level_root_bounded(
self.source_scopes[source_scope].local_data.as_ref().assert_crate_local().lint_root,
- self.hir.root_lint_level,
+ self.hir_id,
);
- let current_root =
- tcx.maybe_lint_level_root_bounded(current_hir_id, self.hir.root_lint_level);
+ let current_root = tcx.maybe_lint_level_root_bounded(current_hir_id, self.hir_id);
if parent_root != current_root {
self.source_scope = self.new_source_scope(
crate fn break_scope(
&mut self,
mut block: BasicBlock,
- value: Option<ExprRef<'tcx>>,
+ value: Option<&Expr<'_, 'tcx>>,
target: BreakableTarget,
source_info: SourceInfo,
) -> BlockAnd<()> {
if let Some(value) = value {
debug!("stmt_expr Break val block_context.push(SubExpr)");
self.block_context.push(BlockFrame::SubExpr);
- unpack!(block = self.into(destination, block, value));
+ unpack!(block = self.expr_into_dest(destination, block, value));
self.block_context.pop();
} else {
- self.cfg.push_assign_unit(block, source_info, destination, self.hir.tcx())
+ self.cfg.push_assign_unit(block, source_info, destination, self.tcx)
}
} else {
assert!(value.is_none(), "`return` and `break` should have a destination");
) {
let needs_drop = match drop_kind {
DropKind::Value => {
- if !self.hir.needs_drop(self.local_decls[local].ty) {
+ if !self.local_decls[local].ty.needs_drop(self.tcx, self.param_env) {
return;
}
true
}
if scope.region_scope == region_scope {
- let region_scope_span =
- region_scope.span(self.hir.tcx(), &self.hir.region_scope_tree);
+ let region_scope_span = region_scope.span(self.tcx, &self.region_scope_tree);
// Attribute scope exit drops to scope's closing brace.
- let scope_end = self.hir.tcx().sess.source_map().end_point(region_scope_span);
+ let scope_end = self.tcx.sess.source_map().end_point(region_scope_span);
scope.drops.push(DropData {
source_info: SourceInfo { span: scope_end, scope: scope.source_scope },
crate fn test_bool(
&mut self,
mut block: BasicBlock,
- condition: Expr<'tcx>,
+ condition: &Expr<'_, 'tcx>,
source_info: SourceInfo,
) -> (BasicBlock, BasicBlock) {
let cond = unpack!(block = self.as_local_operand(block, condition));
let true_block = self.cfg.start_new_block();
let false_block = self.cfg.start_new_block();
- let term = TerminatorKind::if_(self.hir.tcx(), cond.clone(), true_block, false_block);
+ let term = TerminatorKind::if_(self.tcx, cond.clone(), true_block, false_block);
self.cfg.terminate(block, source_info, term);
match cond {