about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-15 16:16:40 +1000
committerGitHub <noreply@github.com>2025-08-15 16:16:40 +1000
commit36515e780a22441f67c77ffecc3d3c64e2d50610 (patch)
tree079537d03e324dc90b0d359c6a59fcbdac7b58a2 /compiler/rustc_resolve/src
parentb672a2ad5ce4a9257fa41f2d0690bb80e9b44b62 (diff)
parentcaadc8df3519f1c92ef59ea816eb628345d9f52a (diff)
downloadrust-36515e780a22441f67c77ffecc3d3c64e2d50610.tar.gz
rust-36515e780a22441f67c77ffecc3d3c64e2d50610.zip
Rollup merge of #145369 - estebank:issue-145367, r=compiler-errors
Do not ICE on private type in field of unresolved struct

Fix rust-lang/rust#145367.
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 };