Skip to content

Commit

Permalink
remove the old UserAssertTy support
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Sep 10, 2018
1 parent 34575e6 commit 4b5f19a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
12 changes: 1 addition & 11 deletions src/librustc_mir/build/block.rs
Expand Up @@ -106,7 +106,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
remainder_scope,
init_scope,
pattern,
ty,
initializer,
lint_level
} => {
Expand Down Expand Up @@ -136,23 +135,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
opt_destruction_scope.map(|de|(de, source_info)), block, |this| {
let scope = (init_scope, source_info);
this.in_scope(scope, lint_level, block, |this| {
this.expr_into_pattern(block, ty, pattern, init)
this.expr_into_pattern(block, pattern, init)
})
}));
} else {
scope = this.declare_bindings(
None, remainder_span, lint_level, slice::from_ref(&pattern),
ArmHasGuard(false), None);

// FIXME(#47184): We currently only insert `UserAssertTy` statements for
// patterns that are bindings, this is as we do not want to deconstruct
// the type being assertion to match the pattern.
if let PatternKind::Binding { var, .. } = *pattern.kind {
if let Some(ty) = ty {
this.user_assert_ty(block, ty, var, span);
}
}

this.visit_bindings(&pattern, &mut |this, _, _, _, node, span, _| {
this.storage_live_binding(block, node, span, OutsideGuard);
this.schedule_drop_for_binding(node, span, OutsideGuard);
Expand Down
23 changes: 0 additions & 23 deletions src/librustc_mir/build/matches/mod.rs
Expand Up @@ -219,26 +219,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
end_block.unit()
}

pub fn user_assert_ty(&mut self, block: BasicBlock, hir_id: hir::HirId,
var: NodeId, span: Span) {
if self.hir.tcx().sess.opts.debugging_opts.disable_nll_user_type_assert { return; }

let local_id = self.var_local_id(var, OutsideGuard);
let source_info = self.source_info(span);

debug!("user_assert_ty: local_id={:?}", hir_id.local_id);
if let Some(c_ty) = self.hir.tables.user_provided_tys().get(hir_id) {
debug!("user_assert_ty: c_ty={:?}", c_ty);
self.cfg.push(block, Statement {
source_info,
kind: StatementKind::UserAssertTy(*c_ty, local_id),
});
}
}

pub fn expr_into_pattern(&mut self,
mut block: BasicBlock,
ty: Option<hir::HirId>,
irrefutable_pat: Pattern<'tcx>,
initializer: ExprRef<'tcx>)
-> BlockAnd<()> {
Expand All @@ -249,11 +231,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
subpattern: None, .. } => {
let place = self.storage_live_binding(block, var, irrefutable_pat.span,
OutsideGuard);

if let Some(ty) = ty {
self.user_assert_ty(block, ty, var, irrefutable_pat.span);
}

unpack!(block = self.into(&place, block, initializer));
self.schedule_drop_for_binding(var, irrefutable_pat.span, OutsideGuard);
block.unit()
Expand Down
5 changes: 1 addition & 4 deletions src/librustc_mir/hair/mod.rs
Expand Up @@ -93,12 +93,9 @@ pub enum StmtKind<'tcx> {
/// lifetime of temporaries
init_scope: region::Scope,

/// let <PAT>: ty = ...
/// `let <PAT> = ...`
pattern: Pattern<'tcx>,

/// let pat: <TY> = init ...
ty: Option<hir::HirId>,

/// let pat: ty = <INIT> ...
initializer: Option<ExprRef<'tcx>>,

Expand Down

0 comments on commit 4b5f19a

Please sign in to comment.