-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: bugCategory: bug
Description
PR #15990 introduced a bug when unwrapping this file_id
:
rust-analyzer/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs
Line 47 in 932d85b
FileRange { file_id: d.file_id.file_id().unwrap(), range: diagnostic_range }, |
The function returns None
if the file is a macro file:
rust-analyzer/crates/span/src/lib.rs
Lines 253 to 259 in 932d85b
#[inline] | |
pub fn file_id(self) -> Option<FileId> { | |
match self.0 & Self::MACRO_FILE_TAG_MASK { | |
0 => Some(FileId::from_raw(self.0)), | |
_ => None, | |
} | |
} |
Maybe changing it to something like trait_impl_missing_assoc_item
will work?
rust-analyzer/crates/ide-diagnostics/src/handlers/trait_impl_missing_assoc_item.rs
Lines 23 to 31 in f532576
Diagnostic::new( | |
DiagnosticCode::RustcHardError("E0046"), | |
format!("not all trait items implemented, missing: {missing}"), | |
adjusted_display_range::<ast::Impl>( | |
ctx, | |
InFile { file_id: d.file_id, value: d.impl_.syntax_node_ptr() }, | |
&|impl_| impl_.trait_().map(|t| t.syntax().text_range()), | |
), | |
) |
Young-Flash
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug