@@ -453,41 +453,6 @@ impl SourceMap {
453
453
}
454
454
}
455
455
456
- /// Returns `Some(span)`, a union of the LHS and RHS span. The LHS must precede the RHS. If
457
- /// there are gaps between LHS and RHS, the resulting union will cross these gaps.
458
- /// For this to work,
459
- ///
460
- /// * the syntax contexts of both spans much match,
461
- /// * the LHS span needs to end on the same line the RHS span begins,
462
- /// * the LHS span must start at or before the RHS span.
463
- pub fn merge_spans ( & self , sp_lhs : Span , sp_rhs : Span ) -> Option < Span > {
464
- // Ensure we're at the same expansion ID.
465
- if sp_lhs. ctxt ( ) != sp_rhs. ctxt ( ) {
466
- return None ;
467
- }
468
-
469
- let lhs_end = match self . lookup_line ( sp_lhs. hi ( ) ) {
470
- Ok ( x) => x,
471
- Err ( _) => return None ,
472
- } ;
473
- let rhs_begin = match self . lookup_line ( sp_rhs. lo ( ) ) {
474
- Ok ( x) => x,
475
- Err ( _) => return None ,
476
- } ;
477
-
478
- // If we must cross lines to merge, don't merge.
479
- if lhs_end. line != rhs_begin. line {
480
- return None ;
481
- }
482
-
483
- // Ensure these follow the expected order and that we don't overlap.
484
- if ( sp_lhs. lo ( ) <= sp_rhs. lo ( ) ) && ( sp_lhs. hi ( ) <= sp_rhs. lo ( ) ) {
485
- Some ( sp_lhs. to ( sp_rhs) )
486
- } else {
487
- None
488
- }
489
- }
490
-
491
456
pub fn span_to_string ( & self , sp : Span ) -> String {
492
457
if self . files . borrow ( ) . source_files . is_empty ( ) && sp. is_dummy ( ) {
493
458
return "no-location" . to_string ( ) ;
@@ -931,13 +896,6 @@ impl SourceMap {
931
896
SourceFileAndBytePos { sf, pos : offset }
932
897
}
933
898
934
- /// Converts an absolute `BytePos` to a `CharPos` relative to the `SourceFile`.
935
- pub fn bytepos_to_file_charpos ( & self , bpos : BytePos ) -> CharPos {
936
- let idx = self . lookup_source_file_idx ( bpos) ;
937
- let sf = & ( * self . files . borrow ( ) . source_files ) [ idx] ;
938
- sf. bytepos_to_file_charpos ( bpos)
939
- }
940
-
941
899
// Returns the index of the `SourceFile` (in `self.files`) that contains `pos`.
942
900
// This index is guaranteed to be valid for the lifetime of this `SourceMap`,
943
901
// since `source_files` is a `MonotonicVec`
0 commit comments