Skip to content

Commit fdf8543

Browse files
committed
add nonempty encoding for spans
Before this change, encoding an object containing a codemap::span using the JSON encodeng produced invalid JSON, for instance: [{"span":,"global":false,"idents":["abc"]}] Since the decoder for codemap::span's ignores its argument, I conjecture that this will not damage decoding, and should improve it for many decoders.
1 parent 19bb166 commit fdf8543

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libsyntax/codemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl cmp::Eq for span {
140140

141141
impl<S:Encoder> Encodable<S> for span {
142142
/* Note #1972 -- spans are encoded but not decoded */
143-
fn encode(&self, _s: &S) { }
143+
fn encode(&self, _s: &S) { _s.emit_nil() }
144144
}
145145

146146
impl<D:Decoder> Decodable<D> for span {

0 commit comments

Comments
 (0)