Fix panic in 'remove semicolon' when types are not local
It's not possible to check if removing a semicolon fixes the type error when checking match arms and one or both of the last arm's and the current arm's return types are imported "opaque" types. In these cases we don't generate a "consider removing semicolon" suggestions. Fixes #81839
This commit is contained in:
parent
cb2effd44e
commit
5fd1ebe50f
1 changed files with 10 additions and 2 deletions
|
@ -1078,8 +1078,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
"both opaque, likely future {:?} {:?} {:?} {:?}",
|
||||
last_def_id, last_bounds, exp_def_id, exp_bounds
|
||||
);
|
||||
let last_hir_id = self.tcx.hir().local_def_id_to_hir_id(last_def_id.expect_local());
|
||||
let exp_hir_id = self.tcx.hir().local_def_id_to_hir_id(exp_def_id.expect_local());
|
||||
|
||||
let (last_local_id, exp_local_id) =
|
||||
match (last_def_id.as_local(), exp_def_id.as_local()) {
|
||||
(Some(last_hir_id), Some(exp_hir_id)) => (last_hir_id, exp_hir_id),
|
||||
(_, _) => return None,
|
||||
};
|
||||
|
||||
let last_hir_id = self.tcx.hir().local_def_id_to_hir_id(last_local_id);
|
||||
let exp_hir_id = self.tcx.hir().local_def_id_to_hir_id(exp_local_id);
|
||||
|
||||
match (
|
||||
&self.tcx.hir().expect_item(last_hir_id).kind,
|
||||
&self.tcx.hir().expect_item(exp_hir_id).kind,
|
||||
|
|
Loading…
Reference in a new issue