@@ -52,35 +52,71 @@ impl Pos for BytePos {
52
52
fn to_uint ( & self ) -> uint { let BytePos ( n) = * self ; n as uint }
53
53
}
54
54
55
+ // NOTE(stage0): Remove impl after a snapshot
56
+ #[ cfg( stage0) ]
55
57
impl Add < BytePos , BytePos > for BytePos {
56
58
fn add ( & self , rhs : & BytePos ) -> BytePos {
57
59
BytePos ( ( self . to_uint ( ) + rhs. to_uint ( ) ) as u32 )
58
60
}
59
61
}
60
62
63
+ #[ cfg( not( stage0) ) ] // NOTE(stage0): Remove cfg after a snapshot
64
+ impl Add < BytePos , BytePos > for BytePos {
65
+ fn add ( self , rhs : BytePos ) -> BytePos {
66
+ BytePos ( ( self . to_uint ( ) + rhs. to_uint ( ) ) as u32 )
67
+ }
68
+ }
69
+
70
+ // NOTE(stage0): Remove impl after a snapshot
71
+ #[ cfg( stage0) ]
61
72
impl Sub < BytePos , BytePos > for BytePos {
62
73
fn sub ( & self , rhs : & BytePos ) -> BytePos {
63
74
BytePos ( ( self . to_uint ( ) - rhs. to_uint ( ) ) as u32 )
64
75
}
65
76
}
66
77
78
+ #[ cfg( not( stage0) ) ] // NOTE(stage0): Remove cfg after a snapshot
79
+ impl Sub < BytePos , BytePos > for BytePos {
80
+ fn sub ( self , rhs : BytePos ) -> BytePos {
81
+ BytePos ( ( self . to_uint ( ) - rhs. to_uint ( ) ) as u32 )
82
+ }
83
+ }
84
+
67
85
impl Pos for CharPos {
68
86
fn from_uint ( n : uint ) -> CharPos { CharPos ( n) }
69
87
fn to_uint ( & self ) -> uint { let CharPos ( n) = * self ; n }
70
88
}
71
89
90
+ // NOTE(stage0): Remove impl after a snapshot
91
+ #[ cfg( stage0) ]
72
92
impl Add < CharPos , CharPos > for CharPos {
73
93
fn add ( & self , rhs : & CharPos ) -> CharPos {
74
94
CharPos ( self . to_uint ( ) + rhs. to_uint ( ) )
75
95
}
76
96
}
77
97
98
+ #[ cfg( not( stage0) ) ] // NOTE(stage0): Remove cfg after a snapshot
99
+ impl Add < CharPos , CharPos > for CharPos {
100
+ fn add ( self , rhs : CharPos ) -> CharPos {
101
+ CharPos ( self . to_uint ( ) + rhs. to_uint ( ) )
102
+ }
103
+ }
104
+
105
+ // NOTE(stage0): Remove impl after a snapshot
106
+ #[ cfg( stage0) ]
78
107
impl Sub < CharPos , CharPos > for CharPos {
79
108
fn sub ( & self , rhs : & CharPos ) -> CharPos {
80
109
CharPos ( self . to_uint ( ) - rhs. to_uint ( ) )
81
110
}
82
111
}
83
112
113
+ #[ cfg( not( stage0) ) ] // NOTE(stage0): Remove cfg after a snapshot
114
+ impl Sub < CharPos , CharPos > for CharPos {
115
+ fn sub ( self , rhs : CharPos ) -> CharPos {
116
+ CharPos ( self . to_uint ( ) - rhs. to_uint ( ) )
117
+ }
118
+ }
119
+
84
120
/// Spans represent a region of code, used for error reporting. Positions in spans
85
121
/// are *absolute* positions from the beginning of the codemap, not positions
86
122
/// relative to FileMaps. Methods on the CodeMap can be used to relate spans back
0 commit comments