Skip to content

Commit 4b5f19a

Browse files
committed
remove the old UserAssertTy support
1 parent 34575e6 commit 4b5f19a

File tree

3 files changed

+2
-38
lines changed

3 files changed

+2
-38
lines changed

src/librustc_mir/build/block.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
106106
remainder_scope,
107107
init_scope,
108108
pattern,
109-
ty,
110109
initializer,
111110
lint_level
112111
} => {
@@ -136,23 +135,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
136135
opt_destruction_scope.map(|de|(de, source_info)), block, |this| {
137136
let scope = (init_scope, source_info);
138137
this.in_scope(scope, lint_level, block, |this| {
139-
this.expr_into_pattern(block, ty, pattern, init)
138+
this.expr_into_pattern(block, pattern, init)
140139
})
141140
}));
142141
} else {
143142
scope = this.declare_bindings(
144143
None, remainder_span, lint_level, slice::from_ref(&pattern),
145144
ArmHasGuard(false), None);
146145

147-
// FIXME(#47184): We currently only insert `UserAssertTy` statements for
148-
// patterns that are bindings, this is as we do not want to deconstruct
149-
// the type being assertion to match the pattern.
150-
if let PatternKind::Binding { var, .. } = *pattern.kind {
151-
if let Some(ty) = ty {
152-
this.user_assert_ty(block, ty, var, span);
153-
}
154-
}
155-
156146
this.visit_bindings(&pattern, &mut |this, _, _, _, node, span, _| {
157147
this.storage_live_binding(block, node, span, OutsideGuard);
158148
this.schedule_drop_for_binding(node, span, OutsideGuard);

src/librustc_mir/build/matches/mod.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -219,26 +219,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
219219
end_block.unit()
220220
}
221221

222-
pub fn user_assert_ty(&mut self, block: BasicBlock, hir_id: hir::HirId,
223-
var: NodeId, span: Span) {
224-
if self.hir.tcx().sess.opts.debugging_opts.disable_nll_user_type_assert { return; }
225-
226-
let local_id = self.var_local_id(var, OutsideGuard);
227-
let source_info = self.source_info(span);
228-
229-
debug!("user_assert_ty: local_id={:?}", hir_id.local_id);
230-
if let Some(c_ty) = self.hir.tables.user_provided_tys().get(hir_id) {
231-
debug!("user_assert_ty: c_ty={:?}", c_ty);
232-
self.cfg.push(block, Statement {
233-
source_info,
234-
kind: StatementKind::UserAssertTy(*c_ty, local_id),
235-
});
236-
}
237-
}
238-
239222
pub fn expr_into_pattern(&mut self,
240223
mut block: BasicBlock,
241-
ty: Option<hir::HirId>,
242224
irrefutable_pat: Pattern<'tcx>,
243225
initializer: ExprRef<'tcx>)
244226
-> BlockAnd<()> {
@@ -249,11 +231,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
249231
subpattern: None, .. } => {
250232
let place = self.storage_live_binding(block, var, irrefutable_pat.span,
251233
OutsideGuard);
252-
253-
if let Some(ty) = ty {
254-
self.user_assert_ty(block, ty, var, irrefutable_pat.span);
255-
}
256-
257234
unpack!(block = self.into(&place, block, initializer));
258235
self.schedule_drop_for_binding(var, irrefutable_pat.span, OutsideGuard);
259236
block.unit()

src/librustc_mir/hair/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,9 @@ pub enum StmtKind<'tcx> {
9393
/// lifetime of temporaries
9494
init_scope: region::Scope,
9595

96-
/// let <PAT>: ty = ...
96+
/// `let <PAT> = ...`
9797
pattern: Pattern<'tcx>,
9898

99-
/// let pat: <TY> = init ...
100-
ty: Option<hir::HirId>,
101-
10299
/// let pat: ty = <INIT> ...
103100
initializer: Option<ExprRef<'tcx>>,
104101

0 commit comments

Comments
 (0)