Skip to content

Commit 34be164

Browse files
committed
Revert "visit_nested_body for LateLint should return earlier if there is an error"
This reverts commit 11c5ecd.
1 parent b3de4c7 commit 34be164

File tree

5 files changed

+10
-28
lines changed

5 files changed

+10
-28
lines changed

compiler/rustc_lint/src/builtin.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ declare_lint_pass!(NonShorthandFieldPatterns => [NON_SHORTHAND_FIELD_PATTERNS]);
152152

153153
impl<'tcx> LateLintPass<'tcx> for NonShorthandFieldPatterns {
154154
fn check_pat(&mut self, cx: &LateContext<'_>, pat: &hir::Pat<'_>) {
155-
if let PatKind::Struct(ref qpath, field_pats, _) = pat.kind {
155+
// The result shouldn't be tainted, otherwise it will cause ICE.
156+
if let PatKind::Struct(ref qpath, field_pats, _) = pat.kind
157+
&& cx.typeck_results().tainted_by_errors.is_none()
158+
{
156159
let variant = cx
157160
.typeck_results()
158161
.pat_ty(pat)

compiler/rustc_lint/src/late.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
8989
}
9090

9191
fn visit_nested_body(&mut self, body_id: hir::BodyId) {
92-
// The result shouldn't be tainted, otherwise it will cause ICE.
93-
if self.context.tcx.typeck_body(body_id).tainted_by_errors.is_some() {
94-
return;
95-
}
96-
9792
let old_enclosing_body = self.context.enclosing_body.replace(body_id);
9893
let old_cached_typeck_results = self.context.cached_typeck_results.get();
9994

tests/crashes/138361.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #138361
2+
3+
fn main() {
4+
[0; loop{}];
5+
std::mem::transmute(4)
6+
}

tests/ui/consts/long-constant-evaluation-cause-ice-in-sty.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/ui/consts/long-constant-evaluation-cause-ice-in-sty.stderr

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)