internal: don't panic when the crate graph isn't ready #19351

This commit is contained in:
David Barsky 2025-03-13 13:38:29 -04:00
parent 3fc655b239
commit 788232b355
14 changed files with 50 additions and 30 deletions

View file

@ -83,7 +83,7 @@ pub(crate) fn view_memory_layout(
) -> Option<RecursiveMemoryLayout> {
let sema = Semantics::new(db);
let file = sema.parse_guess_edition(position.file_id);
let display_target = sema.first_crate_or_default(position.file_id).to_display_target(db);
let display_target = sema.first_crate(position.file_id)?.to_display_target(db);
let token =
pick_best_token(file.syntax().token_at_offset(position.offset), |kind| match kind {
SyntaxKind::IDENT => 3,