Rollup merge of #73012 - Aaron1011:feature/span-debug-ctxt, r=matthewjasper

Show `SyntaxContext` in formatted `Span` debug output

This is only really useful in debug messages, so I've switched to
calling `span_to_string` in any place that causes a `Span` to end up in
user-visible output.
This commit is contained in:
Dylan DPC 2020-06-11 19:04:09 +02:00 committed by GitHub
commit 80fce3693d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 75 additions and 47 deletions

View file

@ -1,166 +1,166 @@
TokenStream [Ident { ident: "ident", span: $DIR/dump-debug-span-debug.rs:9:5: 9:10 }, Ident { ident: "r#ident", span: $DIR/dump-debug-span-debug.rs:10:5: 10:12 }, Punct { ch: ',', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:11:5: 11:6 }, Punct { ch: '=', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 }, Punct { ch: '=', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 }, Punct { ch: '>', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:12:7: 12:8 }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/dump-debug-span-debug.rs:13:5: 13:7 }, Group { delimiter: Bracket, stream: TokenStream [Ident { ident: "_", span: $DIR/dump-debug-span-debug.rs:14:6: 14:7 }], span: $DIR/dump-debug-span-debug.rs:14:5: 14:8 }, Literal { kind: Integer, symbol: "0", suffix: None, span: $DIR/dump-debug-span-debug.rs:17:5: 17:6 }, Literal { kind: Float, symbol: "1.0", suffix: None, span: $DIR/dump-debug-span-debug.rs:18:5: 18:8 }, Literal { kind: Str, symbol: "S", suffix: None, span: $DIR/dump-debug-span-debug.rs:19:5: 19:8 }, Literal { kind: ByteStr, symbol: "B", suffix: None, span: $DIR/dump-debug-span-debug.rs:20:5: 20:9 }, Literal { kind: StrRaw(0), symbol: "R", suffix: None, span: $DIR/dump-debug-span-debug.rs:21:5: 21:9 }, Literal { kind: StrRaw(2), symbol: "R", suffix: None, span: $DIR/dump-debug-span-debug.rs:22:5: 22:13 }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: None, span: $DIR/dump-debug-span-debug.rs:23:5: 23:11 }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: None, span: $DIR/dump-debug-span-debug.rs:24:5: 24:15 }, Literal { kind: Char, symbol: "C", suffix: None, span: $DIR/dump-debug-span-debug.rs:25:5: 25:8 }, Literal { kind: Byte, symbol: "B", suffix: None, span: $DIR/dump-debug-span-debug.rs:26:5: 26:9 }, Literal { kind: Integer, symbol: "0", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:29:5: 29:7 }, Literal { kind: Float, symbol: "1.0", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:30:5: 30:9 }, Literal { kind: Str, symbol: "S", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:31:5: 31:9 }, Literal { kind: ByteStr, symbol: "B", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:32:5: 32:10 }, Literal { kind: StrRaw(0), symbol: "R", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:33:5: 33:10 }, Literal { kind: StrRaw(2), symbol: "R", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:34:5: 34:14 }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:35:5: 35:12 }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:36:5: 36:16 }, Literal { kind: Char, symbol: "C", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:37:5: 37:9 }, Literal { kind: Byte, symbol: "B", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:38:5: 38:10 }]
TokenStream [Ident { ident: "ident", span: $DIR/dump-debug-span-debug.rs:9:5: 9:10 (#0) }, Ident { ident: "r#ident", span: $DIR/dump-debug-span-debug.rs:10:5: 10:12 (#0) }, Punct { ch: ',', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:11:5: 11:6 (#0) }, Punct { ch: '=', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 (#0) }, Punct { ch: '=', spacing: Joint, span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 (#0) }, Punct { ch: '>', spacing: Alone, span: $DIR/dump-debug-span-debug.rs:12:7: 12:8 (#0) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/dump-debug-span-debug.rs:13:5: 13:7 (#0) }, Group { delimiter: Bracket, stream: TokenStream [Ident { ident: "_", span: $DIR/dump-debug-span-debug.rs:14:6: 14:7 (#0) }], span: $DIR/dump-debug-span-debug.rs:14:5: 14:8 (#0) }, Literal { kind: Integer, symbol: "0", suffix: None, span: $DIR/dump-debug-span-debug.rs:17:5: 17:6 (#0) }, Literal { kind: Float, symbol: "1.0", suffix: None, span: $DIR/dump-debug-span-debug.rs:18:5: 18:8 (#0) }, Literal { kind: Str, symbol: "S", suffix: None, span: $DIR/dump-debug-span-debug.rs:19:5: 19:8 (#0) }, Literal { kind: ByteStr, symbol: "B", suffix: None, span: $DIR/dump-debug-span-debug.rs:20:5: 20:9 (#0) }, Literal { kind: StrRaw(0), symbol: "R", suffix: None, span: $DIR/dump-debug-span-debug.rs:21:5: 21:9 (#0) }, Literal { kind: StrRaw(2), symbol: "R", suffix: None, span: $DIR/dump-debug-span-debug.rs:22:5: 22:13 (#0) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: None, span: $DIR/dump-debug-span-debug.rs:23:5: 23:11 (#0) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: None, span: $DIR/dump-debug-span-debug.rs:24:5: 24:15 (#0) }, Literal { kind: Char, symbol: "C", suffix: None, span: $DIR/dump-debug-span-debug.rs:25:5: 25:8 (#0) }, Literal { kind: Byte, symbol: "B", suffix: None, span: $DIR/dump-debug-span-debug.rs:26:5: 26:9 (#0) }, Literal { kind: Integer, symbol: "0", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:29:5: 29:7 (#0) }, Literal { kind: Float, symbol: "1.0", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:30:5: 30:9 (#0) }, Literal { kind: Str, symbol: "S", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:31:5: 31:9 (#0) }, Literal { kind: ByteStr, symbol: "B", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:32:5: 32:10 (#0) }, Literal { kind: StrRaw(0), symbol: "R", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:33:5: 33:10 (#0) }, Literal { kind: StrRaw(2), symbol: "R", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:34:5: 34:14 (#0) }, Literal { kind: ByteStrRaw(0), symbol: "BR", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:35:5: 35:12 (#0) }, Literal { kind: ByteStrRaw(2), symbol: "BR", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:36:5: 36:16 (#0) }, Literal { kind: Char, symbol: "C", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:37:5: 37:9 (#0) }, Literal { kind: Byte, symbol: "B", suffix: Some("q"), span: $DIR/dump-debug-span-debug.rs:38:5: 38:10 (#0) }]
TokenStream [
Ident {
ident: "ident",
span: $DIR/dump-debug-span-debug.rs:9:5: 9:10,
span: $DIR/dump-debug-span-debug.rs:9:5: 9:10 (#0),
},
Ident {
ident: "r#ident",
span: $DIR/dump-debug-span-debug.rs:10:5: 10:12,
span: $DIR/dump-debug-span-debug.rs:10:5: 10:12 (#0),
},
Punct {
ch: ',',
spacing: Alone,
span: $DIR/dump-debug-span-debug.rs:11:5: 11:6,
span: $DIR/dump-debug-span-debug.rs:11:5: 11:6 (#0),
},
Punct {
ch: '=',
spacing: Joint,
span: $DIR/dump-debug-span-debug.rs:12:5: 12:7,
span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 (#0),
},
Punct {
ch: '=',
spacing: Joint,
span: $DIR/dump-debug-span-debug.rs:12:5: 12:7,
span: $DIR/dump-debug-span-debug.rs:12:5: 12:7 (#0),
},
Punct {
ch: '>',
spacing: Alone,
span: $DIR/dump-debug-span-debug.rs:12:7: 12:8,
span: $DIR/dump-debug-span-debug.rs:12:7: 12:8 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
span: $DIR/dump-debug-span-debug.rs:13:5: 13:7,
span: $DIR/dump-debug-span-debug.rs:13:5: 13:7 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "_",
span: $DIR/dump-debug-span-debug.rs:14:6: 14:7,
span: $DIR/dump-debug-span-debug.rs:14:6: 14:7 (#0),
},
],
span: $DIR/dump-debug-span-debug.rs:14:5: 14:8,
span: $DIR/dump-debug-span-debug.rs:14:5: 14:8 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:17:5: 17:6,
span: $DIR/dump-debug-span-debug.rs:17:5: 17:6 (#0),
},
Literal {
kind: Float,
symbol: "1.0",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:18:5: 18:8,
span: $DIR/dump-debug-span-debug.rs:18:5: 18:8 (#0),
},
Literal {
kind: Str,
symbol: "S",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:19:5: 19:8,
span: $DIR/dump-debug-span-debug.rs:19:5: 19:8 (#0),
},
Literal {
kind: ByteStr,
symbol: "B",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:20:5: 20:9,
span: $DIR/dump-debug-span-debug.rs:20:5: 20:9 (#0),
},
Literal {
kind: StrRaw(0),
symbol: "R",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:21:5: 21:9,
span: $DIR/dump-debug-span-debug.rs:21:5: 21:9 (#0),
},
Literal {
kind: StrRaw(2),
symbol: "R",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:22:5: 22:13,
span: $DIR/dump-debug-span-debug.rs:22:5: 22:13 (#0),
},
Literal {
kind: ByteStrRaw(0),
symbol: "BR",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:23:5: 23:11,
span: $DIR/dump-debug-span-debug.rs:23:5: 23:11 (#0),
},
Literal {
kind: ByteStrRaw(2),
symbol: "BR",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:24:5: 24:15,
span: $DIR/dump-debug-span-debug.rs:24:5: 24:15 (#0),
},
Literal {
kind: Char,
symbol: "C",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:25:5: 25:8,
span: $DIR/dump-debug-span-debug.rs:25:5: 25:8 (#0),
},
Literal {
kind: Byte,
symbol: "B",
suffix: None,
span: $DIR/dump-debug-span-debug.rs:26:5: 26:9,
span: $DIR/dump-debug-span-debug.rs:26:5: 26:9 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:29:5: 29:7,
span: $DIR/dump-debug-span-debug.rs:29:5: 29:7 (#0),
},
Literal {
kind: Float,
symbol: "1.0",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:30:5: 30:9,
span: $DIR/dump-debug-span-debug.rs:30:5: 30:9 (#0),
},
Literal {
kind: Str,
symbol: "S",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:31:5: 31:9,
span: $DIR/dump-debug-span-debug.rs:31:5: 31:9 (#0),
},
Literal {
kind: ByteStr,
symbol: "B",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:32:5: 32:10,
span: $DIR/dump-debug-span-debug.rs:32:5: 32:10 (#0),
},
Literal {
kind: StrRaw(0),
symbol: "R",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:33:5: 33:10,
span: $DIR/dump-debug-span-debug.rs:33:5: 33:10 (#0),
},
Literal {
kind: StrRaw(2),
symbol: "R",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:34:5: 34:14,
span: $DIR/dump-debug-span-debug.rs:34:5: 34:14 (#0),
},
Literal {
kind: ByteStrRaw(0),
symbol: "BR",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:35:5: 35:12,
span: $DIR/dump-debug-span-debug.rs:35:5: 35:12 (#0),
},
Literal {
kind: ByteStrRaw(2),
symbol: "BR",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:36:5: 36:16,
span: $DIR/dump-debug-span-debug.rs:36:5: 36:16 (#0),
},
Literal {
kind: Char,
symbol: "C",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:37:5: 37:9,
span: $DIR/dump-debug-span-debug.rs:37:5: 37:9 (#0),
},
Literal {
kind: Byte,
symbol: "B",
suffix: Some("q"),
span: $DIR/dump-debug-span-debug.rs:38:5: 38:10,
span: $DIR/dump-debug-span-debug.rs:38:5: 38:10 (#0),
},
]