Skip to content

Commit

Permalink
Rollup merge of #120342 - oli-obk:track_errors6, r=nnethercote
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
GuillaumeGomez authored Jan 30, 2024
2 parents a51fc2a + 58de630 commit f0dbf68
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions clippy_lints/src/transmute/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ pub(super) fn check_cast<'tcx>(
let inherited = Inherited::new(cx.tcx, local_def_id);
let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, local_def_id);

// If we already have errors, we can't be sure we can pointer cast.
assert!(
!fn_ctxt.errors_reported_since_creation(),
"Newly created FnCtxt contained errors"
);

if let Ok(check) = cast::CastCheck::new(
&fn_ctxt,
e,
Expand All @@ -53,17 +47,7 @@ pub(super) fn check_cast<'tcx>(
DUMMY_SP,
hir::Constness::NotConst,
) {
let res = check.do_check(&fn_ctxt);

// do_check's documentation says that it might return Ok and create
// errors in the fcx instead of returning Err in some cases. Those cases
// should be filtered out before getting here.
assert!(
!fn_ctxt.errors_reported_since_creation(),
"`fn_ctxt` contained errors after cast check!"
);

res.ok()
check.do_check(&fn_ctxt).ok()
} else {
None
}
Expand Down

0 comments on commit f0dbf68

Please sign in to comment.