From d3a89cd214a41e8c339db0baf6fc7acb463e64ec Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 13 Feb 2024 10:44:50 +0000 Subject: Avoid an ICE in diagnostics --- compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_borrowck/src') diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index b3d684086c2..65643e93d27 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -698,7 +698,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { ), .. }) => { - let hir::Ty { span, .. } = inputs[local.index() - 1]; + let hir::Ty { span, .. } = *inputs.get(local.index() - 1)?; Some(span) } _ => None, -- cgit 1.4.1-3-g733a5