mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Fix error spans for include! and compile_error!
This commit is contained in:
parent
ae9c553902
commit
d46060b168
4 changed files with 56 additions and 29 deletions
|
@ -33,6 +33,16 @@ pub const FIXUP_ERASED_FILE_AST_ID_MARKER: ErasedFileAstId =
|
|||
|
||||
pub type Span = SpanData<SyntaxContextId>;
|
||||
|
||||
impl Span {
|
||||
pub fn cover(self, other: Span) -> Span {
|
||||
if self.anchor != other.anchor {
|
||||
return self;
|
||||
}
|
||||
let range = self.range.cover(other.range);
|
||||
Span { range, ..self }
|
||||
}
|
||||
}
|
||||
|
||||
/// Spans represent a region of code, used by the IDE to be able link macro inputs and outputs
|
||||
/// together. Positions in spans are relative to some [`SpanAnchor`] to make them more incremental
|
||||
/// friendly.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue