about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-08-13 18:43:46 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-08-14 15:59:32 +0000
commitcaadc8df3519f1c92ef59ea816eb628345d9f52a (patch)
tree6766e7d1c0c3011c6eec9c88dcf223db18eb7381 /compiler/rustc_resolve/src
parent30017c36d6b5e3382ee7cf018d330a6a4a937d39 (diff)
downloadrust-caadc8df3519f1c92ef59ea816eb628345d9f52a.tar.gz
rust-caadc8df3519f1c92ef59ea816eb628345d9f52a.zip
Do not ICE on private type in field of unresolved struct
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index c5fcbdfb42f..a437f86e377 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -2189,9 +2189,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
         let ast::ExprKind::Struct(struct_expr) = &expr.kind else { return };
         // We don't have to handle type-relative paths because they're forbidden in ADT
         // expressions, but that would change with `#[feature(more_qualified_paths)]`.
-        let Some(Res::Def(_, def_id)) =
-            self.partial_res_map[&struct_expr.path.segments.iter().last().unwrap().id].full_res()
-        else {
+        let Some(segment) = struct_expr.path.segments.last() else { return };
+        let Some(partial_res) = self.partial_res_map.get(&segment.id) else { return };
+        let Some(Res::Def(_, def_id)) = partial_res.full_res() else {
             return;
         };
         let Some(default_fields) = self.field_defaults(def_id) else { return };