about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-10-22 16:43:43 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-01-15 21:26:25 +0100
commitd9c6e70c57d16b248b65ec578ca9b77028ea0725 (patch)
tree078445e3e01ffd7aa61dfe560a3c23f81f33fcca
parent67727aa7c31a24ea73a91a9134c3653fae8209ab (diff)
Do not ICE when accesing large LocalDefId.
-rw-r--r--compiler/rustc_middle/src/hir/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs
index 900f8f43bb7..8164eefd6cb 100644
--- a/compiler/rustc_middle/src/hir/mod.rs
+++ b/compiler/rustc_middle/src/hir/mod.rs
@@ -64,7 +64,7 @@ pub fn provide(providers: &mut Providers) {
     providers.crate_hash = map::crate_hash;
     providers.hir_module_items = map::hir_module_items;
     providers.hir_owner = |tcx, id| {
-        let owner = tcx.hir_crate(()).owners[id].as_ref()?;
+        let owner = tcx.hir_crate(()).owners.get(id)?.as_ref()?;
         let node = owner.node();
         Some(Owner { node, hash_without_bodies: owner.nodes.hash_without_bodies })
     };