Skip to content

Commit f0dbf68

Browse files
authoredJan 30, 2024
Rollup merge of #120342 - oli-obk:track_errors6, r=nnethercote
Remove various `has_errors` or `err_count` uses follow up to #119895 r? `@nnethercote` since you recently did something similar. There are so many more of these, but I wanted to get a PR out instead of growing the commit list indefinitely. The commits all work on their own and can be reviewed commit by commit.
2 parents a51fc2a + 58de630 commit f0dbf68

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed
 

Diff for: ‎clippy_lints/src/transmute/utils.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ pub(super) fn check_cast<'tcx>(
3737
let inherited = Inherited::new(cx.tcx, local_def_id);
3838
let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, local_def_id);
3939

40-
// If we already have errors, we can't be sure we can pointer cast.
41-
assert!(
42-
!fn_ctxt.errors_reported_since_creation(),
43-
"Newly created FnCtxt contained errors"
44-
);
45-
4640
if let Ok(check) = cast::CastCheck::new(
4741
&fn_ctxt,
4842
e,
@@ -53,17 +47,7 @@ pub(super) fn check_cast<'tcx>(
5347
DUMMY_SP,
5448
hir::Constness::NotConst,
5549
) {
56-
let res = check.do_check(&fn_ctxt);
57-
58-
// do_check's documentation says that it might return Ok and create
59-
// errors in the fcx instead of returning Err in some cases. Those cases
60-
// should be filtered out before getting here.
61-
assert!(
62-
!fn_ctxt.errors_reported_since_creation(),
63-
"`fn_ctxt` contained errors after cast check!"
64-
);
65-
66-
res.ok()
50+
check.do_check(&fn_ctxt).ok()
6751
} else {
6852
None
6953
}

0 commit comments

Comments
 (0)