summaryrefslogtreecommitdiffstats
path: root/third_party/rust/codespan-reporting/tests
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/codespan-reporting/tests')
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty__medium_color.snap11
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty__medium_no_color.snap11
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_ascii_no_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_no_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty__short_color.snap11
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty__short_no_color.snap11
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__medium_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__medium_no_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_ascii_no_color.snap29
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_color.snap29
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_no_color.snap29
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__short_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__short_no_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__medium_color.snap11
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__medium_no_color.snap11
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_ascii_no_color.snap42
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_color.snap42
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_no_color.snap42
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__short_color.snap7
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__short_no_color.snap7
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message__medium_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message__medium_no_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_ascii_no_color.snap13
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_color.snap13
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_no_color.snap13
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message__short_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message__short_no_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__medium_color.snap13
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__medium_no_color.snap13
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_ascii_no_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_no_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__short_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__short_no_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__rich_ascii_no_color.snap21
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__rich_no_color.snap21
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__short_no_color.snap13
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multifile__medium_color.snap12
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multifile__medium_no_color.snap12
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_ascii_no_color.snap35
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_color.snap35
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_no_color.snap35
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multifile__short_color.snap8
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multifile__short_no_color.snap8
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multiline_omit__rich_no_color.snap38
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__medium_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__medium_no_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_ascii_no_color.snap25
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_color.snap25
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_no_color.snap25
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__short_color.snap6
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__short_no_color.snap6
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__medium_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__medium_no_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_ascii_no_color.snap58
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_color.snap58
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_no_color.snap58
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__short_color.snap11
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__short_no_color.snap11
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__medium_no_color.snap7
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__rich_ascii_no_color.snap14
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__rich_no_color.snap14
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__short_no_color.snap6
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_line__medium_color.snap8
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_line__medium_no_color.snap8
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_ascii_no_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_no_color.snap17
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_line__short_color.snap7
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_line__short_no_color.snap7
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__medium_color.snap7
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__medium_no_color.snap7
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_ascii_no_color.snap14
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_color.snap14
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_no_color.snap14
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__short_color.snap6
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__short_no_color.snap6
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_2_no_color.snap23
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_3_no_color.snap23
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_6_no_color.snap23
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_default_no_color.snap23
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_3_no_color.snap23
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_6_no_color.snap23
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_default_no_color.snap23
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__unicode__medium_no_color.snap29
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__unicode__rich_no_color.snap36
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__unicode__short_no_color.snap7
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__medium_no_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__rich_no_color.snap29
-rw-r--r--third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__short_no_color.snap9
-rw-r--r--third_party/rust/codespan-reporting/tests/support/color_buffer.rs137
-rw-r--r--third_party/rust/codespan-reporting/tests/support/mod.rs31
-rw-r--r--third_party/rust/codespan-reporting/tests/term.rs1053
94 files changed, 2814 insertions, 0 deletions
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__medium_color.snap
new file mode 100644
index 0000000000..e4a14fb540
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__medium_color.snap
@@ -0,0 +1,11 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}bug{bold bright}: {/}
+{fg:Red bold bright}error{bold bright}: {/}
+{fg:Yellow bold bright}warning{bold bright}: {/}
+{fg:Green bold bright}note{bold bright}: {/}
+{fg:Cyan bold bright}help{bold bright}: {/}
+{fg:Red bold bright}bug{bold bright}: {/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__medium_no_color.snap
new file mode 100644
index 0000000000..6a8bf45306
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__medium_no_color.snap
@@ -0,0 +1,11 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+bug:
+error:
+warning:
+note:
+help:
+bug:
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..1ec1a94e44
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_ascii_no_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+bug:
+
+error:
+
+warning:
+
+note:
+
+help:
+
+bug:
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_color.snap
new file mode 100644
index 0000000000..f94d46bce9
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}bug{bold bright}: {/}
+
+{fg:Red bold bright}error{bold bright}: {/}
+
+{fg:Yellow bold bright}warning{bold bright}: {/}
+
+{fg:Green bold bright}note{bold bright}: {/}
+
+{fg:Cyan bold bright}help{bold bright}: {/}
+
+{fg:Red bold bright}bug{bold bright}: {/}
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_no_color.snap
new file mode 100644
index 0000000000..1ec1a94e44
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__rich_no_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+bug:
+
+error:
+
+warning:
+
+note:
+
+help:
+
+bug:
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__short_color.snap
new file mode 100644
index 0000000000..e4a14fb540
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__short_color.snap
@@ -0,0 +1,11 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}bug{bold bright}: {/}
+{fg:Red bold bright}error{bold bright}: {/}
+{fg:Yellow bold bright}warning{bold bright}: {/}
+{fg:Green bold bright}note{bold bright}: {/}
+{fg:Cyan bold bright}help{bold bright}: {/}
+{fg:Red bold bright}bug{bold bright}: {/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__short_no_color.snap
new file mode 100644
index 0000000000..6a8bf45306
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty__short_no_color.snap
@@ -0,0 +1,11 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+bug:
+error:
+warning:
+note:
+help:
+bug:
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__medium_color.snap
new file mode 100644
index 0000000000..3713ee4bd5
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__medium_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+hello:1:7: {fg:Green bold bright}note{bold bright}: middle{/}
+hello:1:13: {fg:Green bold bright}note{bold bright}: end of line{/}
+hello:2:11: {fg:Green bold bright}note{bold bright}: end of line{/}
+hello:3:4: {fg:Green bold bright}note{bold bright}: end of file{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__medium_no_color.snap
new file mode 100644
index 0000000000..635a8303d1
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__medium_no_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+hello:1:7: note: middle
+hello:1:13: note: end of line
+hello:2:11: note: end of line
+hello:3:4: note: end of file
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..bbf44fbd48
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_ascii_no_color.snap
@@ -0,0 +1,29 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+note: middle
+ --> hello:1:7
+ |
+1 | Hello world!
+ | ^ middle
+
+note: end of line
+ --> hello:1:13
+ |
+1 | Hello world!
+ | ^ end of line
+
+note: end of line
+ --> hello:2:11
+ |
+2 | Bye world!
+ | ^ end of line
+
+note: end of file
+ --> hello:3:4
+ |
+3 |
+ | ^ end of file
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_color.snap
new file mode 100644
index 0000000000..89bb2c0303
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_color.snap
@@ -0,0 +1,29 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Green bold bright}note{bold bright}: middle{/}
+ {fg:Blue}┌─{/} hello:1:7
+ {fg:Blue}│{/}
+{fg:Blue}1{/} {fg:Blue}│{/} Hello {fg:Green}w{/}orld!
+ {fg:Blue}│{/} {fg:Green}^{/} {fg:Green}middle{/}
+
+{fg:Green bold bright}note{bold bright}: end of line{/}
+ {fg:Blue}┌─{/} hello:1:13
+ {fg:Blue}│{/}
+{fg:Blue}1{/} {fg:Blue}│{/} Hello world!
+ {fg:Blue}│{/} {fg:Green}^{/} {fg:Green}end of line{/}
+
+{fg:Green bold bright}note{bold bright}: end of line{/}
+ {fg:Blue}┌─{/} hello:2:11
+ {fg:Blue}│{/}
+{fg:Blue}2{/} {fg:Blue}│{/} Bye world!
+ {fg:Blue}│{/} {fg:Green}^{/} {fg:Green}end of line{/}
+
+{fg:Green bold bright}note{bold bright}: end of file{/}
+ {fg:Blue}┌─{/} hello:3:4
+ {fg:Blue}│{/}
+{fg:Blue}3{/} {fg:Blue}│{/}
+ {fg:Blue}│{/} {fg:Green}^{/} {fg:Green}end of file{/}
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_no_color.snap
new file mode 100644
index 0000000000..862605cec0
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__rich_no_color.snap
@@ -0,0 +1,29 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+note: middle
+ ┌─ hello:1:7
+ │
+1 │ Hello world!
+ │ ^ middle
+
+note: end of line
+ ┌─ hello:1:13
+ │
+1 │ Hello world!
+ │ ^ end of line
+
+note: end of line
+ ┌─ hello:2:11
+ │
+2 │ Bye world!
+ │ ^ end of line
+
+note: end of file
+ ┌─ hello:3:4
+ │
+3 │
+ │ ^ end of file
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__short_color.snap
new file mode 100644
index 0000000000..3713ee4bd5
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__short_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+hello:1:7: {fg:Green bold bright}note{bold bright}: middle{/}
+hello:1:13: {fg:Green bold bright}note{bold bright}: end of line{/}
+hello:2:11: {fg:Green bold bright}note{bold bright}: end of line{/}
+hello:3:4: {fg:Green bold bright}note{bold bright}: end of file{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__short_no_color.snap
new file mode 100644
index 0000000000..635a8303d1
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__empty_ranges__short_no_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+hello:1:7: note: middle
+hello:1:13: note: end of line
+hello:2:11: note: end of line
+hello:3:4: note: end of file
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__medium_color.snap
new file mode 100644
index 0000000000..ef97c2c0e3
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__medium_color.snap
@@ -0,0 +1,11 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+FizzBuzz.fun:8:12: {fg:Red bold bright}error[E0308]{bold bright}: `case` clauses have incompatible types{/}
+ {fg:Blue}={/} expected type `String`
+ found type `Nat`
+FizzBuzz.fun:16:16: {fg:Red bold bright}error[E0308]{bold bright}: `case` clauses have incompatible types{/}
+ {fg:Blue}={/} expected type `String`
+ found type `Nat`
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__medium_no_color.snap
new file mode 100644
index 0000000000..1120064845
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__medium_no_color.snap
@@ -0,0 +1,11 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+FizzBuzz.fun:8:12: error[E0308]: `case` clauses have incompatible types
+ = expected type `String`
+ found type `Nat`
+FizzBuzz.fun:16:16: error[E0308]: `case` clauses have incompatible types
+ = expected type `String`
+ found type `Nat`
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..55cb453326
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_ascii_no_color.snap
@@ -0,0 +1,42 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0308]: `case` clauses have incompatible types
+ --> FizzBuzz.fun:8:12
+ |
+3 | fizz₁ : Nat → String
+ | ------ expected type `String` found here
+4 | fizz₁ num = case (mod num 5) (mod num 3) of
+ | /-------------'
+5 | | 0 0 => "FizzBuzz"
+6 | | 0 _ => "Fizz"
+7 | | _ 0 => "Buzz"
+8 | | _ _ => num
+ | | ^^^ expected `String`, found `Nat`
+ | \--------------' `case` clauses have incompatible types
+ |
+ = expected type `String`
+ found type `Nat`
+
+error[E0308]: `case` clauses have incompatible types
+ --> FizzBuzz.fun:16:16
+ |
+10 | fizz₂ : Nat → String
+ | ------ expected type `String` found here
+11 | fizz₂ num =
+12 | / case (mod num 5) (mod num 3) of
+13 | | 0 0 => "FizzBuzz"
+ | | ---------- this is found to be of type `String`
+14 | | 0 _ => "Fizz"
+ | | ------ this is found to be of type `String`
+15 | | _ 0 => "Buzz"
+ | | ------ this is found to be of type `String`
+16 | | _ _ => num
+ | | ^^^ expected `String`, found `Nat`
+ | \------------------' `case` clauses have incompatible types
+ |
+ = expected type `String`
+ found type `Nat`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_color.snap
new file mode 100644
index 0000000000..79dded26bd
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_color.snap
@@ -0,0 +1,42 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error[E0308]{bold bright}: `case` clauses have incompatible types{/}
+ {fg:Blue}┌─{/} FizzBuzz.fun:8:12
+ {fg:Blue}│{/}
+{fg:Blue}3{/} {fg:Blue}│{/} fizz₁ : Nat → String
+ {fg:Blue}│{/} {fg:Blue}------{/} {fg:Blue}expected type `String` found here{/}
+{fg:Blue}4{/} {fg:Blue}│{/} fizz₁ num = case (mod num 5) (mod num 3) of
+ {fg:Blue}│{/} {fg:Blue}╭{/}{fg:Blue}─────────────'{/}
+{fg:Blue}5{/} {fg:Blue}│{/} {fg:Blue}│{/} 0 0 => "FizzBuzz"
+{fg:Blue}6{/} {fg:Blue}│{/} {fg:Blue}│{/} 0 _ => "Fizz"
+{fg:Blue}7{/} {fg:Blue}│{/} {fg:Blue}│{/} _ 0 => "Buzz"
+{fg:Blue}8{/} {fg:Blue}│{/} {fg:Blue}│{/} _ _ => {fg:Red}num{/}
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Red}^^^{/} {fg:Red}expected `String`, found `Nat`{/}
+ {fg:Blue}│{/} {fg:Blue}╰{/}{fg:Blue}──────────────' `case` clauses have incompatible types{/}
+ {fg:Blue}│{/}
+ {fg:Blue}={/} expected type `String`
+ found type `Nat`
+
+{fg:Red bold bright}error[E0308]{bold bright}: `case` clauses have incompatible types{/}
+ {fg:Blue}┌─{/} FizzBuzz.fun:16:16
+ {fg:Blue}│{/}
+{fg:Blue}10{/} {fg:Blue}│{/} fizz₂ : Nat → String
+ {fg:Blue}│{/} {fg:Blue}------{/} {fg:Blue}expected type `String` found here{/}
+{fg:Blue}11{/} {fg:Blue}│{/} fizz₂ num =
+{fg:Blue}12{/} {fg:Blue}│{/} {fg:Blue}╭{/} case (mod num 5) (mod num 3) of
+{fg:Blue}13{/} {fg:Blue}│{/} {fg:Blue}│{/} 0 0 => "FizzBuzz"
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Blue}----------{/} {fg:Blue}this is found to be of type `String`{/}
+{fg:Blue}14{/} {fg:Blue}│{/} {fg:Blue}│{/} 0 _ => "Fizz"
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Blue}------{/} {fg:Blue}this is found to be of type `String`{/}
+{fg:Blue}15{/} {fg:Blue}│{/} {fg:Blue}│{/} _ 0 => "Buzz"
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Blue}------{/} {fg:Blue}this is found to be of type `String`{/}
+{fg:Blue}16{/} {fg:Blue}│{/} {fg:Blue}│{/} _ _ => {fg:Red}num{/}
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Red}^^^{/} {fg:Red}expected `String`, found `Nat`{/}
+ {fg:Blue}│{/} {fg:Blue}╰{/}{fg:Blue}──────────────────' `case` clauses have incompatible types{/}
+ {fg:Blue}│{/}
+ {fg:Blue}={/} expected type `String`
+ found type `Nat`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_no_color.snap
new file mode 100644
index 0000000000..a0b7260a92
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__rich_no_color.snap
@@ -0,0 +1,42 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0308]: `case` clauses have incompatible types
+ ┌─ FizzBuzz.fun:8:12
+ │
+3 │ fizz₁ : Nat → String
+ │ ------ expected type `String` found here
+4 │ fizz₁ num = case (mod num 5) (mod num 3) of
+ │ ╭─────────────'
+5 │ │ 0 0 => "FizzBuzz"
+6 │ │ 0 _ => "Fizz"
+7 │ │ _ 0 => "Buzz"
+8 │ │ _ _ => num
+ │ │ ^^^ expected `String`, found `Nat`
+ │ ╰──────────────' `case` clauses have incompatible types
+ │
+ = expected type `String`
+ found type `Nat`
+
+error[E0308]: `case` clauses have incompatible types
+ ┌─ FizzBuzz.fun:16:16
+ │
+10 │ fizz₂ : Nat → String
+ │ ------ expected type `String` found here
+11 │ fizz₂ num =
+12 │ ╭ case (mod num 5) (mod num 3) of
+13 │ │ 0 0 => "FizzBuzz"
+ │ │ ---------- this is found to be of type `String`
+14 │ │ 0 _ => "Fizz"
+ │ │ ------ this is found to be of type `String`
+15 │ │ _ 0 => "Buzz"
+ │ │ ------ this is found to be of type `String`
+16 │ │ _ _ => num
+ │ │ ^^^ expected `String`, found `Nat`
+ │ ╰──────────────────' `case` clauses have incompatible types
+ │
+ = expected type `String`
+ found type `Nat`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__short_color.snap
new file mode 100644
index 0000000000..d25ba9d61b
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__short_color.snap
@@ -0,0 +1,7 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+FizzBuzz.fun:8:12: {fg:Red bold bright}error[E0308]{bold bright}: `case` clauses have incompatible types{/}
+FizzBuzz.fun:16:16: {fg:Red bold bright}error[E0308]{bold bright}: `case` clauses have incompatible types{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__short_no_color.snap
new file mode 100644
index 0000000000..00a243f7ba
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__fizz_buzz__short_no_color.snap
@@ -0,0 +1,7 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+FizzBuzz.fun:8:12: error[E0308]: `case` clauses have incompatible types
+FizzBuzz.fun:16:16: error[E0308]: `case` clauses have incompatible types
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message__medium_color.snap
new file mode 100644
index 0000000000..f0b16d89fe
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message__medium_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error{bold bright}: a message{/}
+{fg:Yellow bold bright}warning{bold bright}: a message{/}
+{fg:Green bold bright}note{bold bright}: a message{/}
+{fg:Cyan bold bright}help{bold bright}: a message{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message__medium_no_color.snap
new file mode 100644
index 0000000000..43565acacb
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message__medium_no_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: a message
+warning: a message
+note: a message
+help: a message
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..d3abe8418e
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_ascii_no_color.snap
@@ -0,0 +1,13 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: a message
+
+warning: a message
+
+note: a message
+
+help: a message
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_color.snap
new file mode 100644
index 0000000000..c1bd4237a8
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_color.snap
@@ -0,0 +1,13 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error{bold bright}: a message{/}
+
+{fg:Yellow bold bright}warning{bold bright}: a message{/}
+
+{fg:Green bold bright}note{bold bright}: a message{/}
+
+{fg:Cyan bold bright}help{bold bright}: a message{/}
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_no_color.snap
new file mode 100644
index 0000000000..d3abe8418e
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message__rich_no_color.snap
@@ -0,0 +1,13 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: a message
+
+warning: a message
+
+note: a message
+
+help: a message
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message__short_color.snap
new file mode 100644
index 0000000000..f0b16d89fe
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message__short_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error{bold bright}: a message{/}
+{fg:Yellow bold bright}warning{bold bright}: a message{/}
+{fg:Green bold bright}note{bold bright}: a message{/}
+{fg:Cyan bold bright}help{bold bright}: a message{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message__short_no_color.snap
new file mode 100644
index 0000000000..43565acacb
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message__short_no_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: a message
+warning: a message
+note: a message
+help: a message
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__medium_color.snap
new file mode 100644
index 0000000000..f44b2a436a
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__medium_color.snap
@@ -0,0 +1,13 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error{bold bright}: a message{/}
+ {fg:Blue}={/} a note
+{fg:Yellow bold bright}warning{bold bright}: a message{/}
+ {fg:Blue}={/} a note
+{fg:Green bold bright}note{bold bright}: a message{/}
+ {fg:Blue}={/} a note
+{fg:Cyan bold bright}help{bold bright}: a message{/}
+ {fg:Blue}={/} a note
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__medium_no_color.snap
new file mode 100644
index 0000000000..bab7a657dd
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__medium_no_color.snap
@@ -0,0 +1,13 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: a message
+ = a note
+warning: a message
+ = a note
+note: a message
+ = a note
+help: a message
+ = a note
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..d4e209ba14
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_ascii_no_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: a message
+ = a note
+
+warning: a message
+ = a note
+
+note: a message
+ = a note
+
+help: a message
+ = a note
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_color.snap
new file mode 100644
index 0000000000..56900e80ef
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error{bold bright}: a message{/}
+ {fg:Blue}={/} a note
+
+{fg:Yellow bold bright}warning{bold bright}: a message{/}
+ {fg:Blue}={/} a note
+
+{fg:Green bold bright}note{bold bright}: a message{/}
+ {fg:Blue}={/} a note
+
+{fg:Cyan bold bright}help{bold bright}: a message{/}
+ {fg:Blue}={/} a note
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_no_color.snap
new file mode 100644
index 0000000000..d4e209ba14
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__rich_no_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: a message
+ = a note
+
+warning: a message
+ = a note
+
+note: a message
+ = a note
+
+help: a message
+ = a note
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__short_color.snap
new file mode 100644
index 0000000000..f0b16d89fe
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__short_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error{bold bright}: a message{/}
+{fg:Yellow bold bright}warning{bold bright}: a message{/}
+{fg:Green bold bright}note{bold bright}: a message{/}
+{fg:Cyan bold bright}help{bold bright}: a message{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__short_no_color.snap
new file mode 100644
index 0000000000..43565acacb
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_and_notes__short_no_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: a message
+warning: a message
+note: a message
+help: a message
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..e82fb7c5e6
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__rich_ascii_no_color.snap
@@ -0,0 +1,21 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0001]: a message
+
+warning[W001]: a message
+
+note[N0815]: a message
+
+help[H4711]: a message
+
+error: where did my errorcode go?
+
+warning: where did my errorcode go?
+
+note: where did my errorcode go?
+
+help: where did my errorcode go?
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__rich_no_color.snap
new file mode 100644
index 0000000000..e82fb7c5e6
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__rich_no_color.snap
@@ -0,0 +1,21 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0001]: a message
+
+warning[W001]: a message
+
+note[N0815]: a message
+
+help[H4711]: a message
+
+error: where did my errorcode go?
+
+warning: where did my errorcode go?
+
+note: where did my errorcode go?
+
+help: where did my errorcode go?
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__short_no_color.snap
new file mode 100644
index 0000000000..ccddd8db4f
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__message_errorcode__short_no_color.snap
@@ -0,0 +1,13 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0001]: a message
+warning[W001]: a message
+note[N0815]: a message
+help[H4711]: a message
+error: where did my errorcode go?
+warning: where did my errorcode go?
+note: where did my errorcode go?
+help: where did my errorcode go?
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__medium_color.snap
new file mode 100644
index 0000000000..6c03d83fd0
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__medium_color.snap
@@ -0,0 +1,12 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+Data/Nat.fun:7:13: {fg:Red bold bright}error{bold bright}: unknown builtin: `NATRAL`{/}
+ {fg:Blue}={/} there is a builtin with a similar name: `NATURAL`
+Data/Nat.fun:17:16: {fg:Yellow bold bright}warning{bold bright}: unused parameter pattern: `n₂`{/}
+ {fg:Blue}={/} consider using a wildcard pattern: `_`
+Test.fun:4:11: {fg:Red bold bright}error[E0001]{bold bright}: unexpected type in application of `_+_`{/}
+ {fg:Blue}={/} expected type `Nat`
+ found type `String`
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__medium_no_color.snap
new file mode 100644
index 0000000000..db33fc01f9
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__medium_no_color.snap
@@ -0,0 +1,12 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+Data/Nat.fun:7:13: error: unknown builtin: `NATRAL`
+ = there is a builtin with a similar name: `NATURAL`
+Data/Nat.fun:17:16: warning: unused parameter pattern: `n₂`
+ = consider using a wildcard pattern: `_`
+Test.fun:4:11: error[E0001]: unexpected type in application of `_+_`
+ = expected type `Nat`
+ found type `String`
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..e162ed2928
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_ascii_no_color.snap
@@ -0,0 +1,35 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: unknown builtin: `NATRAL`
+ --> Data/Nat.fun:7:13
+ |
+7 | {-# BUILTIN NATRAL Nat #-}
+ | ^^^^^^ unknown builtin
+ |
+ = there is a builtin with a similar name: `NATURAL`
+
+warning: unused parameter pattern: `n₂`
+ --> Data/Nat.fun:17:16
+ |
+17 | zero - succ n₂ = zero
+ | ^^ unused parameter
+ |
+ = consider using a wildcard pattern: `_`
+
+error[E0001]: unexpected type in application of `_+_`
+ --> Test.fun:4:11
+ |
+ 4 | _ = 123 + "hello"
+ | ^^^^^^^ expected `Nat`, found `String`
+ |
+ --> Data/Nat.fun:11:1
+ |
+11 | _+_ : Nat → Nat → Nat
+ | --------------------- based on the definition of `_+_`
+ |
+ = expected type `Nat`
+ found type `String`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_color.snap
new file mode 100644
index 0000000000..514be49db4
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_color.snap
@@ -0,0 +1,35 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error{bold bright}: unknown builtin: `NATRAL`{/}
+ {fg:Blue}┌─{/} Data/Nat.fun:7:13
+ {fg:Blue}│{/}
+{fg:Blue}7{/} {fg:Blue}│{/} {-# BUILTIN {fg:Red}NATRAL{/} Nat #-}
+ {fg:Blue}│{/} {fg:Red}^^^^^^{/} {fg:Red}unknown builtin{/}
+ {fg:Blue}│{/}
+ {fg:Blue}={/} there is a builtin with a similar name: `NATURAL`
+
+{fg:Yellow bold bright}warning{bold bright}: unused parameter pattern: `n₂`{/}
+ {fg:Blue}┌─{/} Data/Nat.fun:17:16
+ {fg:Blue}│{/}
+{fg:Blue}17{/} {fg:Blue}│{/} zero - succ {fg:Yellow}n₂{/} = zero
+ {fg:Blue}│{/} {fg:Yellow}^^{/} {fg:Yellow}unused parameter{/}
+ {fg:Blue}│{/}
+ {fg:Blue}={/} consider using a wildcard pattern: `_`
+
+{fg:Red bold bright}error[E0001]{bold bright}: unexpected type in application of `_+_`{/}
+ {fg:Blue}┌─{/} Test.fun:4:11
+ {fg:Blue}│{/}
+{fg:Blue} 4{/} {fg:Blue}│{/} _ = 123 + {fg:Red}"hello"{/}
+ {fg:Blue}│{/} {fg:Red}^^^^^^^{/} {fg:Red}expected `Nat`, found `String`{/}
+ {fg:Blue}│{/}
+ {fg:Blue}┌─{/} Data/Nat.fun:11:1
+ {fg:Blue}│{/}
+{fg:Blue}11{/} {fg:Blue}│{/} _+_ : Nat → Nat → Nat
+ {fg:Blue}│{/} {fg:Blue}---------------------{/} {fg:Blue}based on the definition of `_+_`{/}
+ {fg:Blue}│{/}
+ {fg:Blue}={/} expected type `Nat`
+ found type `String`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_no_color.snap
new file mode 100644
index 0000000000..a626b54b1e
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__rich_no_color.snap
@@ -0,0 +1,35 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: unknown builtin: `NATRAL`
+ ┌─ Data/Nat.fun:7:13
+ │
+7 │ {-# BUILTIN NATRAL Nat #-}
+ │ ^^^^^^ unknown builtin
+ │
+ = there is a builtin with a similar name: `NATURAL`
+
+warning: unused parameter pattern: `n₂`
+ ┌─ Data/Nat.fun:17:16
+ │
+17 │ zero - succ n₂ = zero
+ │ ^^ unused parameter
+ │
+ = consider using a wildcard pattern: `_`
+
+error[E0001]: unexpected type in application of `_+_`
+ ┌─ Test.fun:4:11
+ │
+ 4 │ _ = 123 + "hello"
+ │ ^^^^^^^ expected `Nat`, found `String`
+ │
+ ┌─ Data/Nat.fun:11:1
+ │
+11 │ _+_ : Nat → Nat → Nat
+ │ --------------------- based on the definition of `_+_`
+ │
+ = expected type `Nat`
+ found type `String`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__short_color.snap
new file mode 100644
index 0000000000..e9f40664a7
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__short_color.snap
@@ -0,0 +1,8 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+Data/Nat.fun:7:13: {fg:Red bold bright}error{bold bright}: unknown builtin: `NATRAL`{/}
+Data/Nat.fun:17:16: {fg:Yellow bold bright}warning{bold bright}: unused parameter pattern: `n₂`{/}
+Test.fun:4:11: {fg:Red bold bright}error[E0001]{bold bright}: unexpected type in application of `_+_`{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__short_no_color.snap
new file mode 100644
index 0000000000..e3e020e363
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multifile__short_no_color.snap
@@ -0,0 +1,8 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+Data/Nat.fun:7:13: error: unknown builtin: `NATRAL`
+Data/Nat.fun:17:16: warning: unused parameter pattern: `n₂`
+Test.fun:4:11: error[E0001]: unexpected type in application of `_+_`
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_omit__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_omit__rich_no_color.snap
new file mode 100644
index 0000000000..bb9363d91b
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_omit__rich_no_color.snap
@@ -0,0 +1,38 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[empty_if]: empty elseif block
+ ┌─ empty_if_comments.lua:1:1
+ │
+ 1 │ ╭ elseif 3 then
+ 2 │ │
+ 3 │ │ ╭
+ 4 │ │ │
+ 5 │ │ │
+ · │ │
+ 8 │ │ │
+ 9 │ │ │
+ │ │ ╰' content should be in here
+10 │ │ else
+ │ ╰───^
+
+error[E0308]: mismatched types
+ ┌─ src/lib.rs:2:6
+ │
+ 2 │ 1
+ │ ╭─────^
+ 3 │ │ + 1
+ 4 │ │ + 1
+ · │
+ 7 │ │ +1
+ │ │ - missing whitespace
+ 8 │ │ + 1
+ 9 │ │ + 1
+10 │ │ + 1
+ │ ╰───────^ expected (), found integer
+ │
+ = note: expected type `()`
+ found type `{integer}`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__medium_color.snap
new file mode 100644
index 0000000000..afddf2456e
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__medium_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+codespan/src/file.rs:4:34: {fg:Red bold bright}error[E0308]{bold bright}: match arms have incompatible types{/}
+ {fg:Blue}={/} expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+ found type `LineIndexOutOfBoundsError`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__medium_no_color.snap
new file mode 100644
index 0000000000..0e50bd86d9
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__medium_no_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+codespan/src/file.rs:4:34: error[E0308]: match arms have incompatible types
+ = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+ found type `LineIndexOutOfBoundsError`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..3623d4d96a
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_ascii_no_color.snap
@@ -0,0 +1,25 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0308]: match arms have incompatible types
+ --> codespan/src/file.rs:4:34
+ |
+1 | / match line_index.compare(self.last_line_index()) {
+2 | | Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
+ | | --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+3 | | Ordering::Equal => Ok(self.source_span().end()),
+ | | ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+4 | | Ordering::Greater => LineIndexOutOfBoundsError {
+ | /-|----------------------------------^
+5 | | | given: line_index,
+6 | | | max: self.last_line_index(),
+7 | | | },
+ | \-|-------------^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`
+8 | | }
+ | \---------' `match` arms have incompatible types
+ |
+ = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+ found type `LineIndexOutOfBoundsError`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_color.snap
new file mode 100644
index 0000000000..10701fbbb5
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_color.snap
@@ -0,0 +1,25 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error[E0308]{bold bright}: match arms have incompatible types{/}
+ {fg:Blue}┌─{/} codespan/src/file.rs:4:34
+ {fg:Blue}│{/}
+{fg:Blue}1{/} {fg:Blue}│{/} {fg:Blue}╭{/} match line_index.compare(self.last_line_index()) {
+{fg:Blue}2{/} {fg:Blue}│{/} {fg:Blue}│{/} Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Blue}---------------------------------------------{/} {fg:Blue}this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`{/}
+{fg:Blue}3{/} {fg:Blue}│{/} {fg:Blue}│{/} Ordering::Equal => Ok(self.source_span().end()),
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Blue}----------------------------{/} {fg:Blue}this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`{/}
+{fg:Blue}4{/} {fg:Blue}│{/} {fg:Blue}│{/} Ordering::Greater => {fg:Red}LineIndexOutOfBoundsError {{/}
+ {fg:Blue}│{/} {fg:Red}╭{/}{fg:Red}─{/}{fg:Blue}│{/}{fg:Red}──────────────────────────────────^{/}
+{fg:Blue}5{/} {fg:Blue}│{/} {fg:Red}│{/} {fg:Blue}│{/} {fg:Red} given: line_index,{/}
+{fg:Blue}6{/} {fg:Blue}│{/} {fg:Red}│{/} {fg:Blue}│{/} {fg:Red} max: self.last_line_index(),{/}
+{fg:Blue}7{/} {fg:Blue}│{/} {fg:Red}│{/} {fg:Blue}│{/} {fg:Red} }{/},
+ {fg:Blue}│{/} {fg:Red}╰{/}{fg:Red}─{/}{fg:Blue}│{/}{fg:Red}─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`{/}
+{fg:Blue}8{/} {fg:Blue}│{/} {fg:Blue}│{/} }
+ {fg:Blue}│{/} {fg:Blue}╰{/}{fg:Blue}─────────' `match` arms have incompatible types{/}
+ {fg:Blue}│{/}
+ {fg:Blue}={/} expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+ found type `LineIndexOutOfBoundsError`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_no_color.snap
new file mode 100644
index 0000000000..f6802c80e2
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__rich_no_color.snap
@@ -0,0 +1,25 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0308]: match arms have incompatible types
+ ┌─ codespan/src/file.rs:4:34
+ │
+1 │ ╭ match line_index.compare(self.last_line_index()) {
+2 │ │ Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
+ │ │ --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+3 │ │ Ordering::Equal => Ok(self.source_span().end()),
+ │ │ ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+4 │ │ Ordering::Greater => LineIndexOutOfBoundsError {
+ │ ╭─│──────────────────────────────────^
+5 │ │ │ given: line_index,
+6 │ │ │ max: self.last_line_index(),
+7 │ │ │ },
+ │ ╰─│─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`
+8 │ │ }
+ │ ╰─────────' `match` arms have incompatible types
+ │
+ = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+ found type `LineIndexOutOfBoundsError`
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__short_color.snap
new file mode 100644
index 0000000000..808c6d09d4
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__short_color.snap
@@ -0,0 +1,6 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+codespan/src/file.rs:4:34: {fg:Red bold bright}error[E0308]{bold bright}: match arms have incompatible types{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__short_no_color.snap
new file mode 100644
index 0000000000..0254b6e779
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__multiline_overlapping__short_no_color.snap
@@ -0,0 +1,6 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+codespan/src/file.rs:4:34: error[E0308]: match arms have incompatible types
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__medium_color.snap
new file mode 100644
index 0000000000..9ccf3e5c4b
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__medium_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+nested_impl_trait.rs:5:56: {fg:Red bold bright}error[E0666]{bold bright}: nested `impl Trait` is not allowed{/}
+typeck_type_placeholder_item.rs:1:18: {fg:Red bold bright}error[E0121]{bold bright}: the type placeholder `_` is not allowed within types on item signatures{/}
+typeck_type_placeholder_item.rs:2:25: {fg:Red bold bright}error[E0121]{bold bright}: the type placeholder `_` is not allowed within types on item signatures{/}
+typeck_type_placeholder_item.rs:2:28: {fg:Red bold bright}error[E0121]{bold bright}: the type placeholder `_` is not allowed within types on item signatures{/}
+no_send_res_ports.rs:25:5: {fg:Red bold bright}error[E0277]{bold bright}: `std::rc::Rc<()>` cannot be sent between threads safely{/}
+ {fg:Blue}={/} help: within `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
+ {fg:Blue}={/} note: required because it appears within the type `Port<()>`
+ {fg:Blue}={/} note: required because it appears within the type `main::Foo`
+ {fg:Blue}={/} note: required because it appears within the type `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`
+{fg:Red bold bright}error{bold bright}: aborting due 5 previous errors{/}
+ {fg:Blue}={/} Some errors have detailed explanations: E0121, E0277, E0666.
+ {fg:Blue}={/} For more information about an error, try `rustc --explain E0121`.
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__medium_no_color.snap
new file mode 100644
index 0000000000..3b9eac98f9
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__medium_no_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+nested_impl_trait.rs:5:56: error[E0666]: nested `impl Trait` is not allowed
+typeck_type_placeholder_item.rs:1:18: error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+typeck_type_placeholder_item.rs:2:25: error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+typeck_type_placeholder_item.rs:2:28: error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+no_send_res_ports.rs:25:5: error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
+ = help: within `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
+ = note: required because it appears within the type `Port<()>`
+ = note: required because it appears within the type `main::Foo`
+ = note: required because it appears within the type `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`
+error: aborting due 5 previous errors
+ = Some errors have detailed explanations: E0121, E0277, E0666.
+ = For more information about an error, try `rustc --explain E0121`.
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..b6002fcfc0
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_ascii_no_color.snap
@@ -0,0 +1,58 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0666]: nested `impl Trait` is not allowed
+ --> nested_impl_trait.rs:5:56
+ |
+5 | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
+ | ----------^^^^^^^^^^-
+ | | |
+ | | nested `impl Trait` here
+ | outer `impl Trait`
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ --> typeck_type_placeholder_item.rs:1:18
+ |
+1 | fn fn_test1() -> _ { 5 }
+ | ^
+ | |
+ | not allowed in type signatures
+ | help: replace with the correct return type: `i32`
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ --> typeck_type_placeholder_item.rs:2:25
+ |
+2 | fn fn_test2(x: i32) -> (_, _) { (x, x) }
+ | -^--^-
+ | || |
+ | || not allowed in type signatures
+ | |not allowed in type signatures
+ | help: replace with the correct return type: `(i32, i32)`
+
+error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
+ --> no_send_res_ports.rs:25:5
+ |
+25 | thread::spawn(move|| {
+ | ^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely
+ | /-------------------'
+26 | | let y = x;
+27 | | println!("{:?}", y);
+28 | | });
+ | \------' within this `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`
+ |
+ --> libstd/thread/mod.rs:5:8
+ |
+ 5 | F: Send + 'static,
+ | ---- required by this bound in `std::thread::spawn`
+ |
+ = help: within `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
+ = note: required because it appears within the type `Port<()>`
+ = note: required because it appears within the type `main::Foo`
+ = note: required because it appears within the type `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`
+
+error: aborting due 5 previous errors
+ = Some errors have detailed explanations: E0121, E0277, E0666.
+ = For more information about an error, try `rustc --explain E0121`.
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_color.snap
new file mode 100644
index 0000000000..d29a429aea
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_color.snap
@@ -0,0 +1,58 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error[E0666]{bold bright}: nested `impl Trait` is not allowed{/}
+ {fg:Blue}┌─{/} nested_impl_trait.rs:5:56
+ {fg:Blue}│{/}
+{fg:Blue}5{/} {fg:Blue}│{/} fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<{fg:Red}impl Debug{/}> { x }
+ {fg:Blue}│{/} {fg:Blue}----------{fg:Red}^^^^^^^^^^{fg:Blue}-{/}
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Red}│{/}
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Red}nested `impl Trait` here{/}
+ {fg:Blue}│{/} {fg:Blue}outer `impl Trait`{/}
+
+{fg:Red bold bright}error[E0121]{bold bright}: the type placeholder `_` is not allowed within types on item signatures{/}
+ {fg:Blue}┌─{/} typeck_type_placeholder_item.rs:1:18
+ {fg:Blue}│{/}
+{fg:Blue}1{/} {fg:Blue}│{/} fn fn_test1() -> {fg:Red}_{/} { 5 }
+ {fg:Blue}│{/} {fg:Red}^{/}
+ {fg:Blue}│{/} {fg:Red}│{/}
+ {fg:Blue}│{/} {fg:Red}not allowed in type signatures{/}
+ {fg:Blue}│{/} {fg:Blue}help: replace with the correct return type: `i32`{/}
+
+{fg:Red bold bright}error[E0121]{bold bright}: the type placeholder `_` is not allowed within types on item signatures{/}
+ {fg:Blue}┌─{/} typeck_type_placeholder_item.rs:2:25
+ {fg:Blue}│{/}
+{fg:Blue}2{/} {fg:Blue}│{/} fn fn_test2(x: i32) -> ({fg:Red}_{/}, {fg:Red}_{/}) { (x, x) }
+ {fg:Blue}│{/} {fg:Blue}-{fg:Red}^{fg:Blue}--{fg:Red}^{fg:Blue}-{/}
+ {fg:Blue}│{/} {fg:Blue}│{/}{fg:Red}│{/} {fg:Red}│{/}
+ {fg:Blue}│{/} {fg:Blue}│{/}{fg:Red}│{/} {fg:Red}not allowed in type signatures{/}
+ {fg:Blue}│{/} {fg:Blue}│{/}{fg:Red}not allowed in type signatures{/}
+ {fg:Blue}│{/} {fg:Blue}help: replace with the correct return type: `(i32, i32)`{/}
+
+{fg:Red bold bright}error[E0277]{bold bright}: `std::rc::Rc<()>` cannot be sent between threads safely{/}
+ {fg:Blue}┌─{/} no_send_res_ports.rs:25:5
+ {fg:Blue}│{/}
+{fg:Blue}25{/} {fg:Blue}│{/} {fg:Red}thread::spawn{/}(move|| {
+ {fg:Blue}│{/} {fg:Red}^^^^^^^^^^^^^{/} {fg:Red}`std::rc::Rc<()>` cannot be sent between threads safely{/}
+ {fg:Blue}│{/} {fg:Blue}╭{/}{fg:Blue}───────────────────'{/}
+{fg:Blue}26{/} {fg:Blue}│{/} {fg:Blue}│{/} let y = x;
+{fg:Blue}27{/} {fg:Blue}│{/} {fg:Blue}│{/} println!("{:?}", y);
+{fg:Blue}28{/} {fg:Blue}│{/} {fg:Blue}│{/} });
+ {fg:Blue}│{/} {fg:Blue}╰{/}{fg:Blue}──────' within this `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`{/}
+ {fg:Blue}│{/}
+ {fg:Blue}┌─{/} libstd/thread/mod.rs:5:8
+ {fg:Blue}│{/}
+{fg:Blue} 5{/} {fg:Blue}│{/} F: Send + 'static,
+ {fg:Blue}│{/} {fg:Blue}----{/} {fg:Blue}required by this bound in `std::thread::spawn`{/}
+ {fg:Blue}│{/}
+ {fg:Blue}={/} help: within `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
+ {fg:Blue}={/} note: required because it appears within the type `Port<()>`
+ {fg:Blue}={/} note: required because it appears within the type `main::Foo`
+ {fg:Blue}={/} note: required because it appears within the type `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`
+
+{fg:Red bold bright}error{bold bright}: aborting due 5 previous errors{/}
+ {fg:Blue}={/} Some errors have detailed explanations: E0121, E0277, E0666.
+ {fg:Blue}={/} For more information about an error, try `rustc --explain E0121`.
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_no_color.snap
new file mode 100644
index 0000000000..32f8eeca91
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__rich_no_color.snap
@@ -0,0 +1,58 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0666]: nested `impl Trait` is not allowed
+ ┌─ nested_impl_trait.rs:5:56
+ │
+5 │ fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
+ │ ----------^^^^^^^^^^-
+ │ │ │
+ │ │ nested `impl Trait` here
+ │ outer `impl Trait`
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ ┌─ typeck_type_placeholder_item.rs:1:18
+ │
+1 │ fn fn_test1() -> _ { 5 }
+ │ ^
+ │ │
+ │ not allowed in type signatures
+ │ help: replace with the correct return type: `i32`
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ ┌─ typeck_type_placeholder_item.rs:2:25
+ │
+2 │ fn fn_test2(x: i32) -> (_, _) { (x, x) }
+ │ -^--^-
+ │ ││ │
+ │ ││ not allowed in type signatures
+ │ │not allowed in type signatures
+ │ help: replace with the correct return type: `(i32, i32)`
+
+error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
+ ┌─ no_send_res_ports.rs:25:5
+ │
+25 │ thread::spawn(move|| {
+ │ ^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely
+ │ ╭───────────────────'
+26 │ │ let y = x;
+27 │ │ println!("{:?}", y);
+28 │ │ });
+ │ ╰──────' within this `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`
+ │
+ ┌─ libstd/thread/mod.rs:5:8
+ │
+ 5 │ F: Send + 'static,
+ │ ---- required by this bound in `std::thread::spawn`
+ │
+ = help: within `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
+ = note: required because it appears within the type `Port<()>`
+ = note: required because it appears within the type `main::Foo`
+ = note: required because it appears within the type `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`
+
+error: aborting due 5 previous errors
+ = Some errors have detailed explanations: E0121, E0277, E0666.
+ = For more information about an error, try `rustc --explain E0121`.
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__short_color.snap
new file mode 100644
index 0000000000..8e33cbf8c9
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__short_color.snap
@@ -0,0 +1,11 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+nested_impl_trait.rs:5:56: {fg:Red bold bright}error[E0666]{bold bright}: nested `impl Trait` is not allowed{/}
+typeck_type_placeholder_item.rs:1:18: {fg:Red bold bright}error[E0121]{bold bright}: the type placeholder `_` is not allowed within types on item signatures{/}
+typeck_type_placeholder_item.rs:2:25: {fg:Red bold bright}error[E0121]{bold bright}: the type placeholder `_` is not allowed within types on item signatures{/}
+typeck_type_placeholder_item.rs:2:28: {fg:Red bold bright}error[E0121]{bold bright}: the type placeholder `_` is not allowed within types on item signatures{/}
+no_send_res_ports.rs:25:5: {fg:Red bold bright}error[E0277]{bold bright}: `std::rc::Rc<()>` cannot be sent between threads safely{/}
+{fg:Red bold bright}error{bold bright}: aborting due 5 previous errors{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__short_no_color.snap
new file mode 100644
index 0000000000..47ed5db2f0
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__overlapping__short_no_color.snap
@@ -0,0 +1,11 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+nested_impl_trait.rs:5:56: error[E0666]: nested `impl Trait` is not allowed
+typeck_type_placeholder_item.rs:1:18: error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+typeck_type_placeholder_item.rs:2:25: error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+typeck_type_placeholder_item.rs:2:28: error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+no_send_res_ports.rs:25:5: error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
+error: aborting due 5 previous errors
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__medium_no_color.snap
new file mode 100644
index 0000000000..0e40c83596
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__medium_no_color.snap
@@ -0,0 +1,7 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+tests/main.js:4:3: warning[ParserWarning]: The strict mode declaration in the body of function `foo` is redundant, as the outer scope is already in strict mode
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..d99ad148f3
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__rich_ascii_no_color.snap
@@ -0,0 +1,14 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning[ParserWarning]: The strict mode declaration in the body of function `foo` is redundant, as the outer scope is already in strict mode
+ --> tests/main.js:4:3
+ |
+1 | "use strict";
+ | ------------ Strict mode is first declared here
+ .
+4 | "use strict";
+ | ^^^^^^^^^^^^ This strict mode declaration is redundant
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__rich_no_color.snap
new file mode 100644
index 0000000000..35217e4bef
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__rich_no_color.snap
@@ -0,0 +1,14 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning[ParserWarning]: The strict mode declaration in the body of function `foo` is redundant, as the outer scope is already in strict mode
+ ┌─ tests/main.js:4:3
+ │
+1 │ "use strict";
+ │ ------------ Strict mode is first declared here
+ ·
+4 │ "use strict";
+ │ ^^^^^^^^^^^^ This strict mode declaration is redundant
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__short_no_color.snap
new file mode 100644
index 0000000000..3ec348d0ab
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__position_indicator__short_no_color.snap
@@ -0,0 +1,6 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+tests/main.js:4:3: warning[ParserWarning]: The strict mode declaration in the body of function `foo` is redundant, as the outer scope is already in strict mode
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__medium_color.snap
new file mode 100644
index 0000000000..43e1eb0b78
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__medium_color.snap
@@ -0,0 +1,8 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+one_line.rs:3:12: {fg:Red bold bright}error[E0499]{bold bright}: cannot borrow `v` as mutable more than once at a time{/}
+{fg:Red bold bright}error{bold bright}: aborting due to previous error{/}
+ {fg:Blue}={/} For more information about this error, try `rustc --explain E0499`.
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__medium_no_color.snap
new file mode 100644
index 0000000000..6bb55edb8d
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__medium_no_color.snap
@@ -0,0 +1,8 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+one_line.rs:3:12: error[E0499]: cannot borrow `v` as mutable more than once at a time
+error: aborting due to previous error
+ = For more information about this error, try `rustc --explain E0499`.
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..60e7afbdf2
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_ascii_no_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> one_line.rs:3:12
+ |
+3 | v.push(v.pop().unwrap());
+ | - ---- ^ second mutable borrow occurs here
+ | | |
+ | | first mutable borrow occurs here
+ | first borrow later used by call
+
+error: aborting due to previous error
+ = For more information about this error, try `rustc --explain E0499`.
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_color.snap
new file mode 100644
index 0000000000..38addbb216
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error[E0499]{bold bright}: cannot borrow `v` as mutable more than once at a time{/}
+ {fg:Blue}┌─{/} one_line.rs:3:12
+ {fg:Blue}│{/}
+{fg:Blue}3{/} {fg:Blue}│{/} v.push({fg:Red}v{/}.pop().unwrap());
+ {fg:Blue}│{/} {fg:Blue}-{/} {fg:Blue}----{/} {fg:Red}^{/} {fg:Red}second mutable borrow occurs here{/}
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Blue}│{/}
+ {fg:Blue}│{/} {fg:Blue}│{/} {fg:Blue}first mutable borrow occurs here{/}
+ {fg:Blue}│{/} {fg:Blue}first borrow later used by call{/}
+
+{fg:Red bold bright}error{bold bright}: aborting due to previous error{/}
+ {fg:Blue}={/} For more information about this error, try `rustc --explain E0499`.
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_no_color.snap
new file mode 100644
index 0000000000..75511a45bc
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__rich_no_color.snap
@@ -0,0 +1,17 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ ┌─ one_line.rs:3:12
+ │
+3 │ v.push(v.pop().unwrap());
+ │ - ---- ^ second mutable borrow occurs here
+ │ │ │
+ │ │ first mutable borrow occurs here
+ │ first borrow later used by call
+
+error: aborting due to previous error
+ = For more information about this error, try `rustc --explain E0499`.
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__short_color.snap
new file mode 100644
index 0000000000..c2d86c7546
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__short_color.snap
@@ -0,0 +1,7 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+one_line.rs:3:12: {fg:Red bold bright}error[E0499]{bold bright}: cannot borrow `v` as mutable more than once at a time{/}
+{fg:Red bold bright}error{bold bright}: aborting due to previous error{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__short_no_color.snap
new file mode 100644
index 0000000000..d4f94e1c0c
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_line__short_no_color.snap
@@ -0,0 +1,7 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+one_line.rs:3:12: error[E0499]: cannot borrow `v` as mutable more than once at a time
+error: aborting due to previous error
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__medium_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__medium_color.snap
new file mode 100644
index 0000000000..095b975897
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__medium_color.snap
@@ -0,0 +1,7 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+same_range:1:5: {fg:Red bold bright}error{bold bright}: Unexpected token{/}
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__medium_no_color.snap
new file mode 100644
index 0000000000..a452022ed0
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__medium_no_color.snap
@@ -0,0 +1,7 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+same_range:1:5: error: Unexpected token
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_ascii_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_ascii_no_color.snap
new file mode 100644
index 0000000000..d64f0991cd
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_ascii_no_color.snap
@@ -0,0 +1,14 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: Unexpected token
+ --> same_range:1:5
+ |
+1 | ::S { }
+ | ^
+ | |
+ | Unexpected '{'
+ | Expected '('
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_color.snap
new file mode 100644
index 0000000000..e6ec885e91
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_color.snap
@@ -0,0 +1,14 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+{fg:Red bold bright}error{bold bright}: Unexpected token{/}
+ {fg:Blue}┌─{/} same_range:1:5
+ {fg:Blue}│{/}
+{fg:Blue}1{/} {fg:Blue}│{/} ::S {fg:Red}{{/} }
+ {fg:Blue}│{/} {fg:Red}^{/}
+ {fg:Blue}│{/} {fg:Red}│{/}
+ {fg:Blue}│{/} {fg:Red}Unexpected '{'{/}
+ {fg:Blue}│{/} {fg:Blue}Expected '('{/}
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_no_color.snap
new file mode 100644
index 0000000000..09510e6fbf
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__rich_no_color.snap
@@ -0,0 +1,14 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error: Unexpected token
+ ┌─ same_range:1:5
+ │
+1 │ ::S { }
+ │ ^
+ │ │
+ │ Unexpected '{'
+ │ Expected '('
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__short_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__short_color.snap
new file mode 100644
index 0000000000..14ccc40b74
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__short_color.snap
@@ -0,0 +1,6 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_color(&config)
+---
+same_range:1:5: {fg:Red bold bright}error{bold bright}: Unexpected token{/}
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__short_no_color.snap
new file mode 100644
index 0000000000..94bdc592d4
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__same_ranges__short_no_color.snap
@@ -0,0 +1,6 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+same_range:1:5: error: Unexpected token
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_2_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_2_no_color.snap
new file mode 100644
index 0000000000..0faa8d83e1
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_2_no_color.snap
@@ -0,0 +1,23 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning: tab test
+ ┌─ tab_columns:1:2
+ │
+1 │ hello
+ │ ^^^^^
+2 │ ∙ hello
+ │ ^^^^^
+3 │ ∙∙ hello
+ │ ^^^^^
+4 │ ∙∙∙ hello
+ │ ^^^^^
+5 │ ∙∙∙∙ hello
+ │ ^^^^^
+6 │ ∙∙∙∙∙ hello
+ │ ^^^^^
+7 │ ∙∙∙∙∙∙ hello
+ │ ^^^^^
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_3_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_3_no_color.snap
new file mode 100644
index 0000000000..40f20a68dc
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_3_no_color.snap
@@ -0,0 +1,23 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning: tab test
+ ┌─ tab_columns:1:2
+ │
+1 │ hello
+ │ ^^^^^
+2 │ ∙ hello
+ │ ^^^^^
+3 │ ∙∙ hello
+ │ ^^^^^
+4 │ ∙∙∙ hello
+ │ ^^^^^
+5 │ ∙∙∙∙ hello
+ │ ^^^^^
+6 │ ∙∙∙∙∙ hello
+ │ ^^^^^
+7 │ ∙∙∙∙∙∙ hello
+ │ ^^^^^
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_6_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_6_no_color.snap
new file mode 100644
index 0000000000..018a402775
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_6_no_color.snap
@@ -0,0 +1,23 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning: tab test
+ ┌─ tab_columns:1:2
+ │
+1 │ hello
+ │ ^^^^^
+2 │ ∙ hello
+ │ ^^^^^
+3 │ ∙∙ hello
+ │ ^^^^^
+4 │ ∙∙∙ hello
+ │ ^^^^^
+5 │ ∙∙∙∙ hello
+ │ ^^^^^
+6 │ ∙∙∙∙∙ hello
+ │ ^^^^^
+7 │ ∙∙∙∙∙∙ hello
+ │ ^^^^^
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_default_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_default_no_color.snap
new file mode 100644
index 0000000000..67cd187a7b
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__tab_columns__tab_width_default_no_color.snap
@@ -0,0 +1,23 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning: tab test
+ ┌─ tab_columns:1:2
+ │
+1 │ hello
+ │ ^^^^^
+2 │ ∙ hello
+ │ ^^^^^
+3 │ ∙∙ hello
+ │ ^^^^^
+4 │ ∙∙∙ hello
+ │ ^^^^^
+5 │ ∙∙∙∙ hello
+ │ ^^^^^
+6 │ ∙∙∙∙∙ hello
+ │ ^^^^^
+7 │ ∙∙∙∙∙∙ hello
+ │ ^^^^^
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_3_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_3_no_color.snap
new file mode 100644
index 0000000000..f7328c3196
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_3_no_color.snap
@@ -0,0 +1,23 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning: unknown weapon `DogJaw`
+ ┌─ tabbed:3:11
+ │
+3 │ Weapon: DogJaw
+ │ ^^^^^^ the weapon
+
+warning: unknown condition `attack-cooldown`
+ ┌─ tabbed:4:23
+ │
+4 │ ReloadingCondition: attack-cooldown
+ │ ^^^^^^^^^^^^^^^ the condition
+
+warning: unknown field `Foo`
+ ┌─ tabbed:5:2
+ │
+5 │ Foo: Bar
+ │ ^^^ the field
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_6_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_6_no_color.snap
new file mode 100644
index 0000000000..bcd1b2b660
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_6_no_color.snap
@@ -0,0 +1,23 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning: unknown weapon `DogJaw`
+ ┌─ tabbed:3:11
+ │
+3 │ Weapon: DogJaw
+ │ ^^^^^^ the weapon
+
+warning: unknown condition `attack-cooldown`
+ ┌─ tabbed:4:23
+ │
+4 │ ReloadingCondition: attack-cooldown
+ │ ^^^^^^^^^^^^^^^ the condition
+
+warning: unknown field `Foo`
+ ┌─ tabbed:5:2
+ │
+5 │ Foo: Bar
+ │ ^^^ the field
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_default_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_default_no_color.snap
new file mode 100644
index 0000000000..d3a41a07d7
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__tabbed__tab_width_default_no_color.snap
@@ -0,0 +1,23 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+warning: unknown weapon `DogJaw`
+ ┌─ tabbed:3:11
+ │
+3 │ Weapon: DogJaw
+ │ ^^^^^^ the weapon
+
+warning: unknown condition `attack-cooldown`
+ ┌─ tabbed:4:23
+ │
+4 │ ReloadingCondition: attack-cooldown
+ │ ^^^^^^^^^^^^^^^ the condition
+
+warning: unknown field `Foo`
+ ┌─ tabbed:5:2
+ │
+5 │ Foo: Bar
+ │ ^^^ the field
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__medium_no_color.snap
new file mode 100644
index 0000000000..b5f8780d05
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__medium_no_color.snap
@@ -0,0 +1,29 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+unicode.rs:1:8: error[E0703]: invalid ABI: found `路濫狼á́́`
+ = valid ABIs:
+ - aapcs
+ - amdgpu-kernel
+ - C
+ - cdecl
+ - efiapi
+ - fastcall
+ - msp430-interrupt
+ - platform-intrinsic
+ - ptx-kernel
+ - Rust
+ - rust-call
+ - rust-intrinsic
+ - stdcall
+ - system
+ - sysv64
+ - thiscall
+ - unadjusted
+ - vectorcall
+ - win64
+ - x86-interrupt
+error: aborting due to previous error
+ = For more information about this error, try `rustc --explain E0703`.
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__rich_no_color.snap
new file mode 100644
index 0000000000..520d10a28f
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__rich_no_color.snap
@@ -0,0 +1,36 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E0703]: invalid ABI: found `路濫狼á́́`
+ ┌─ unicode.rs:1:8
+ │
+1 │ extern "路濫狼á́́" fn foo() {}
+ │ ^^^^^^^^^ invalid ABI
+ │
+ = valid ABIs:
+ - aapcs
+ - amdgpu-kernel
+ - C
+ - cdecl
+ - efiapi
+ - fastcall
+ - msp430-interrupt
+ - platform-intrinsic
+ - ptx-kernel
+ - Rust
+ - rust-call
+ - rust-intrinsic
+ - stdcall
+ - system
+ - sysv64
+ - thiscall
+ - unadjusted
+ - vectorcall
+ - win64
+ - x86-interrupt
+
+error: aborting due to previous error
+ = For more information about this error, try `rustc --explain E0703`.
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__short_no_color.snap
new file mode 100644
index 0000000000..ad1dae1983
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode__short_no_color.snap
@@ -0,0 +1,7 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+unicode.rs:1:8: error[E0703]: invalid ABI: found `路濫狼á́́`
+error: aborting due to previous error
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__medium_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__medium_no_color.snap
new file mode 100644
index 0000000000..1b19451afa
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__medium_no_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+moon_jump.rs:1:1: error[E01]: cow may not jump during new moon.
+note: invalid unicode range
+note: invalid unicode range
+note: invalid unicode range
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__rich_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__rich_no_color.snap
new file mode 100644
index 0000000000..653a60e0e9
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__rich_no_color.snap
@@ -0,0 +1,29 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+error[E01]: cow may not jump during new moon.
+ ┌─ moon_jump.rs:1:1
+ │
+1 │ 🐄🌑🐄🌒🐄🌓🐄🌔🐄🌕🐄🌖🐄🌗🐄🌘🐄
+ │ ^^ Invalid jump
+
+note: invalid unicode range
+ ┌─ moon_jump.rs:1:1
+ │
+1 │ 🐄🌑🐄🌒🐄🌓🐄🌔🐄🌕🐄🌖🐄🌗🐄🌘🐄
+ │ -- Cow range does not start at boundary.
+
+note: invalid unicode range
+ ┌─ moon_jump.rs:1:3
+ │
+1 │ 🐄🌑🐄🌒🐄🌓🐄🌔🐄🌕🐄🌖🐄🌗🐄🌘🐄
+ │ -- Cow range does not end at boundary.
+
+note: invalid unicode range
+ ┌─ moon_jump.rs:1:1
+ │
+1 │ 🐄🌑🐄🌒🐄🌓🐄🌔🐄🌕🐄🌖🐄🌗🐄🌘🐄
+ │ ------ Cow does not start or end at boundary.
+
+
diff --git a/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__short_no_color.snap b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__short_no_color.snap
new file mode 100644
index 0000000000..1b19451afa
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/snapshots/term__unicode_spans__short_no_color.snap
@@ -0,0 +1,9 @@
+---
+source: codespan-reporting/tests/term.rs
+expression: TEST_DATA.emit_no_color(&config)
+---
+moon_jump.rs:1:1: error[E01]: cow may not jump during new moon.
+note: invalid unicode range
+note: invalid unicode range
+note: invalid unicode range
+
diff --git a/third_party/rust/codespan-reporting/tests/support/color_buffer.rs b/third_party/rust/codespan-reporting/tests/support/color_buffer.rs
new file mode 100644
index 0000000000..b51360ce63
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/support/color_buffer.rs
@@ -0,0 +1,137 @@
+use std::io;
+use std::io::prelude::*;
+use termcolor::{ColorSpec, WriteColor};
+
+// Color tester from:
+// https://github.com/wycats/language-reporting/blob/b021c87e0d4916b5f32756151bf215c220eee52d/crates/render-tree/src/stylesheet/accumulator.rs
+
+/// A facility for creating visually inspectable representations of colored output
+/// so they can be easily tested.
+///
+/// A new color is represented as `{style}` and a reset is represented by `{/}`.
+///
+/// Attributes are printed in this order:
+///
+/// - Foreground color as `fg:Color`
+/// - Background color as `bg:Color`
+/// - Bold as `bold`
+/// - Underline as `underline`
+/// - Intense as `bright`
+///
+/// For example, the style "intense, bold red foreground" would be printed as:
+///
+/// ```text
+/// {fg:Red bold intense}
+/// ```
+///
+/// Since this implementation attempts to make it possible to faithfully
+/// understand what real WriteColor implementations would do, it tries
+/// to approximate the contract in the WriteColor trait: "Subsequent
+/// writes to this write will use these settings until either reset is
+/// called or new color settings are set.")
+///
+/// - If set_color is called with a style, `{...}` is emitted containing the
+/// color attributes.
+/// - If set_color is called with no style, `{/}` is emitted
+/// - If reset is called, `{/}` is emitted.
+pub struct ColorBuffer {
+ buf: Vec<u8>,
+ color: ColorSpec,
+}
+
+impl ColorBuffer {
+ pub fn new() -> ColorBuffer {
+ ColorBuffer {
+ buf: Vec::new(),
+ color: ColorSpec::new(),
+ }
+ }
+
+ pub fn into_string(self) -> String {
+ String::from_utf8(self.buf).unwrap()
+ }
+}
+
+impl io::Write for ColorBuffer {
+ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+ self.buf.extend(buf);
+ Ok(buf.len())
+ }
+
+ fn flush(&mut self) -> io::Result<()> {
+ Ok(())
+ }
+}
+
+impl WriteColor for ColorBuffer {
+ fn supports_color(&self) -> bool {
+ true
+ }
+
+ fn set_color(&mut self, spec: &ColorSpec) -> io::Result<()> {
+ #![allow(unused_assignments)]
+
+ if self.color == *spec {
+ return Ok(());
+ } else {
+ self.color = spec.clone();
+ }
+
+ if spec.is_none() {
+ write!(self, "{{/}}")?;
+ return Ok(());
+ } else {
+ write!(self, "{{")?;
+ }
+
+ let mut first = true;
+
+ fn write_first(first: bool, write: &mut ColorBuffer) -> io::Result<bool> {
+ if !first {
+ write!(write, " ")?;
+ }
+
+ Ok(false)
+ };
+
+ if let Some(fg) = spec.fg() {
+ first = write_first(first, self)?;
+ write!(self, "fg:{:?}", fg)?;
+ }
+
+ if let Some(bg) = spec.bg() {
+ first = write_first(first, self)?;
+ write!(self, "bg:{:?}", bg)?;
+ }
+
+ if spec.bold() {
+ first = write_first(first, self)?;
+ write!(self, "bold")?;
+ }
+
+ if spec.underline() {
+ first = write_first(first, self)?;
+ write!(self, "underline")?;
+ }
+
+ if spec.intense() {
+ first = write_first(first, self)?;
+ write!(self, "bright")?;
+ }
+
+ write!(self, "}}")?;
+
+ Ok(())
+ }
+
+ fn reset(&mut self) -> io::Result<()> {
+ let color = self.color.clone();
+
+ if color != ColorSpec::new() {
+ write!(self, "{{/}}")?;
+ self.color = ColorSpec::new();
+ }
+
+ Ok(())
+ }
+}
diff --git a/third_party/rust/codespan-reporting/tests/support/mod.rs b/third_party/rust/codespan-reporting/tests/support/mod.rs
new file mode 100644
index 0000000000..4f7313ac36
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/support/mod.rs
@@ -0,0 +1,31 @@
+use codespan_reporting::diagnostic::Diagnostic;
+use codespan_reporting::files::Files;
+use codespan_reporting::term::{emit, Config};
+use termcolor::{Buffer, WriteColor};
+
+mod color_buffer;
+
+use self::color_buffer::ColorBuffer;
+
+pub struct TestData<'files, F: Files<'files>> {
+ pub files: F,
+ pub diagnostics: Vec<Diagnostic<F::FileId>>,
+}
+
+impl<'files, F: Files<'files>> TestData<'files, F> {
+ fn emit<W: WriteColor>(&'files self, mut writer: W, config: &Config) -> W {
+ for diagnostic in &self.diagnostics {
+ emit(&mut writer, config, &self.files, &diagnostic).unwrap();
+ }
+ writer
+ }
+
+ pub fn emit_color(&'files self, config: &Config) -> String {
+ self.emit(ColorBuffer::new(), &config).into_string()
+ }
+
+ pub fn emit_no_color(&'files self, config: &Config) -> String {
+ let buffer = self.emit(Buffer::no_color(), &config);
+ String::from_utf8_lossy(buffer.as_slice()).into_owned()
+ }
+}
diff --git a/third_party/rust/codespan-reporting/tests/term.rs b/third_party/rust/codespan-reporting/tests/term.rs
new file mode 100644
index 0000000000..035db9b459
--- /dev/null
+++ b/third_party/rust/codespan-reporting/tests/term.rs
@@ -0,0 +1,1053 @@
+use codespan_reporting::diagnostic::{Diagnostic, Label};
+use codespan_reporting::files::{SimpleFile, SimpleFiles};
+use codespan_reporting::term::{termcolor::Color, Chars, Config, DisplayStyle, Styles};
+
+mod support;
+
+use self::support::TestData;
+
+lazy_static::lazy_static! {
+ static ref TEST_CONFIG: Config = Config {
+ // Always use blue so tests are consistent across platforms
+ styles: Styles::with_blue(Color::Blue),
+ ..Config::default()
+ };
+}
+
+macro_rules! test_emit {
+ (rich_color) => {
+ #[test]
+ fn rich_color() {
+ let config = Config {
+ display_style: DisplayStyle::Rich,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_color(&config));
+ }
+ };
+ (medium_color) => {
+ #[test]
+ fn medium_color() {
+ let config = Config {
+ display_style: DisplayStyle::Medium,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_color(&config));
+ }
+ };
+ (short_color) => {
+ #[test]
+ fn short_color() {
+ let config = Config {
+ display_style: DisplayStyle::Short,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_color(&config));
+ }
+ };
+ (rich_no_color) => {
+ #[test]
+ fn rich_no_color() {
+ let config = Config {
+ display_style: DisplayStyle::Rich,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+ };
+ (medium_no_color) => {
+ #[test]
+ fn medium_no_color() {
+ let config = Config {
+ display_style: DisplayStyle::Medium,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+ };
+ (short_no_color) => {
+ #[test]
+ fn short_no_color() {
+ let config = Config {
+ display_style: DisplayStyle::Short,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+ };
+ (rich_ascii_no_color) => {
+ #[test]
+ fn rich_ascii_no_color() {
+ let config = Config {
+ display_style: DisplayStyle::Rich,
+ chars: Chars::ascii(),
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+ };
+}
+
+mod empty {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, &'static str>> = {
+ let files = SimpleFiles::new();
+
+ let diagnostics = vec![
+ Diagnostic::bug(),
+ Diagnostic::error(),
+ Diagnostic::warning(),
+ Diagnostic::note(),
+ Diagnostic::help(),
+ Diagnostic::bug(),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+/// Based on:
+/// - https://github.com/rust-lang/rust/blob/c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be/src/test/ui/codemap_tests/one_line.stderr
+mod same_line {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, String>> = {
+ let mut files = SimpleFiles::new();
+
+ let file_id1 = files.add(
+ "one_line.rs",
+ unindent::unindent(r#"
+ fn main() {
+ let mut v = vec![Some("foo"), Some("bar")];
+ v.push(v.pop().unwrap());
+ }
+ "#),
+ );
+
+ let diagnostics = vec![
+ Diagnostic::error()
+ .with_code("E0499")
+ .with_message("cannot borrow `v` as mutable more than once at a time")
+ .with_labels(vec![
+ Label::primary(file_id1, 71..72)
+ .with_message("second mutable borrow occurs here"),
+ Label::secondary(file_id1, 64..65)
+ .with_message("first borrow later used by call"),
+ Label::secondary(file_id1, 66..70)
+ .with_message("first mutable borrow occurs here"),
+ ]),
+ Diagnostic::error()
+ .with_message("aborting due to previous error")
+ .with_notes(vec![
+ "For more information about this error, try `rustc --explain E0499`.".to_owned(),
+ ]),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+/// Based on:
+/// - https://github.com/rust-lang/rust/blob/c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be/src/test/ui/nested_impl_trait.stderr
+/// - https://github.com/rust-lang/rust/blob/c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be/src/test/ui/typeck/typeck_type_placeholder_item.stderr
+/// - https://github.com/rust-lang/rust/blob/c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be/src/test/ui/no_send_res_ports.stderr
+mod overlapping {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, String>> = {
+ let mut files = SimpleFiles::new();
+
+ let file_id1 = files.add(
+ "nested_impl_trait.rs",
+ unindent::unindent(r#"
+ use std::fmt::Debug;
+
+ fn fine(x: impl Into<u32>) -> impl Into<u32> { x }
+
+ fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
+ "#),
+ );
+ let file_id2 = files.add(
+ "typeck_type_placeholder_item.rs",
+ unindent::unindent(r#"
+ fn fn_test1() -> _ { 5 }
+ fn fn_test2(x: i32) -> (_, _) { (x, x) }
+ "#),
+ );
+ let file_id3 = files.add(
+ "libstd/thread/mod.rs",
+ unindent::unindent(r#"
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub fn spawn<F, T>(self, f: F) -> io::Result<JoinHandle<T>>
+ where
+ F: FnOnce() -> T,
+ F: Send + 'static,
+ T: Send + 'static,
+ {
+ unsafe { self.spawn_unchecked(f) }
+ }
+ "#),
+ );
+ let file_id4 = files.add(
+ "no_send_res_ports.rs",
+ unindent::unindent(r#"
+ use std::thread;
+ use std::rc::Rc;
+
+ #[derive(Debug)]
+ struct Port<T>(Rc<T>);
+
+ fn main() {
+ #[derive(Debug)]
+ struct Foo {
+ _x: Port<()>,
+ }
+
+ impl Drop for Foo {
+ fn drop(&mut self) {}
+ }
+
+ fn foo(x: Port<()>) -> Foo {
+ Foo {
+ _x: x
+ }
+ }
+
+ let x = foo(Port(Rc::new(())));
+
+ thread::spawn(move|| {
+ let y = x;
+ println!("{:?}", y);
+ });
+ }
+ "#),
+ );
+
+ let diagnostics = vec![
+ Diagnostic::error()
+ .with_code("E0666")
+ .with_message("nested `impl Trait` is not allowed")
+ .with_labels(vec![
+ Label::primary(file_id1, 129..139)
+ .with_message("nested `impl Trait` here"),
+ Label::secondary(file_id1, 119..140)
+ .with_message("outer `impl Trait`"),
+ ]),
+ Diagnostic::error()
+ .with_code("E0121")
+ .with_message("the type placeholder `_` is not allowed within types on item signatures")
+ .with_labels(vec![
+ Label::primary(file_id2, 17..18)
+ .with_message("not allowed in type signatures"),
+ Label::secondary(file_id2, 17..18)
+ .with_message("help: replace with the correct return type: `i32`"),
+ ]),
+ Diagnostic::error()
+ .with_code("E0121")
+ .with_message("the type placeholder `_` is not allowed within types on item signatures")
+ .with_labels(vec![
+ Label::primary(file_id2, 49..50)
+ .with_message("not allowed in type signatures"),
+ Label::primary(file_id2, 52..53)
+ .with_message("not allowed in type signatures"),
+ Label::secondary(file_id2, 48..54)
+ .with_message("help: replace with the correct return type: `(i32, i32)`"),
+ ]),
+ Diagnostic::error()
+ .with_code("E0277")
+ .with_message("`std::rc::Rc<()>` cannot be sent between threads safely")
+ .with_labels(vec![
+ Label::primary(file_id4, 339..352)
+ .with_message("`std::rc::Rc<()>` cannot be sent between threads safely"),
+ Label::secondary(file_id4, 353..416)
+ .with_message("within this `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`"),
+ Label::secondary(file_id3, 141..145)
+ .with_message("required by this bound in `std::thread::spawn`"),
+ ])
+ .with_notes(vec![
+ "help: within `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`".to_owned(),
+ "note: required because it appears within the type `Port<()>`".to_owned(),
+ "note: required because it appears within the type `main::Foo`".to_owned(),
+ "note: required because it appears within the type `[closure@no_send_res_ports.rs:29:19: 33:6 x:main::Foo]`".to_owned(),
+ ]),
+ Diagnostic::error()
+ .with_message("aborting due 5 previous errors")
+ .with_notes(vec![
+ "Some errors have detailed explanations: E0121, E0277, E0666.".to_owned(),
+ "For more information about an error, try `rustc --explain E0121`.".to_owned(),
+ ]),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod message {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, &'static str>> = {
+ let files = SimpleFiles::new();
+
+ let diagnostics = vec![
+ Diagnostic::error().with_message("a message"),
+ Diagnostic::warning().with_message("a message"),
+ Diagnostic::note().with_message("a message"),
+ Diagnostic::help().with_message("a message"),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod message_and_notes {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, &'static str>> = {
+ let files = SimpleFiles::new();
+
+ let diagnostics = vec![
+ Diagnostic::error().with_message("a message").with_notes(vec!["a note".to_owned()]),
+ Diagnostic::warning().with_message("a message").with_notes(vec!["a note".to_owned()]),
+ Diagnostic::note().with_message("a message").with_notes(vec!["a note".to_owned()]),
+ Diagnostic::help().with_message("a message").with_notes(vec!["a note".to_owned()]),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod message_errorcode {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, &'static str>> = {
+ let files = SimpleFiles::new();
+
+ let diagnostics = vec![
+ Diagnostic::error().with_message("a message").with_code("E0001"),
+ Diagnostic::warning().with_message("a message").with_code("W001"),
+ Diagnostic::note().with_message("a message").with_code("N0815"),
+ Diagnostic::help().with_message("a message").with_code("H4711"),
+ Diagnostic::error().with_message("where did my errorcode go?").with_code(""),
+ Diagnostic::warning().with_message("where did my errorcode go?").with_code(""),
+ Diagnostic::note().with_message("where did my errorcode go?").with_code(""),
+ Diagnostic::help().with_message("where did my errorcode go?").with_code(""),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod empty_ranges {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFile<&'static str, &'static str>> = {
+ let file = SimpleFile::new("hello", "Hello world!\nBye world!\n ");
+ let eof = file.source().len();
+
+ let diagnostics = vec![
+ Diagnostic::note()
+ .with_message("middle")
+ .with_labels(vec![Label::primary((), 6..6).with_message("middle")]),
+ Diagnostic::note()
+ .with_message("end of line")
+ .with_labels(vec![Label::primary((), 12..12).with_message("end of line")]),
+ Diagnostic::note()
+ .with_message("end of line")
+ .with_labels(vec![Label::primary((), 23..23).with_message("end of line")]),
+ Diagnostic::note()
+ .with_message("end of file")
+ .with_labels(vec![Label::primary((), eof..eof).with_message("end of file")]),
+ ];
+
+ TestData { files: file, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod same_ranges {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFile<&'static str, &'static str>> = {
+ let file = SimpleFile::new("same_range", "::S { }");
+
+ let diagnostics = vec![
+ Diagnostic::error()
+ .with_message("Unexpected token")
+ .with_labels(vec![
+ Label::primary((), 4..4).with_message("Unexpected '{'"),
+ Label::secondary((), 4..4).with_message("Expected '('"),
+ ]),
+ ];
+
+ TestData { files: file, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod multifile {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, String>> = {
+ let mut files = SimpleFiles::new();
+
+ let file_id1 = files.add(
+ "Data/Nat.fun",
+ unindent::unindent(
+ "
+ module Data.Nat where
+
+ data Nat : Type where
+ zero : Nat
+ succ : Nat → Nat
+
+ {-# BUILTIN NATRAL Nat #-}
+
+ infixl 6 _+_ _-_
+
+ _+_ : Nat → Nat → Nat
+ zero + n₂ = n₂
+ succ n₁ + n₂ = succ (n₁ + n₂)
+
+ _-_ : Nat → Nat → Nat
+ n₁ - zero = n₁
+ zero - succ n₂ = zero
+ succ n₁ - succ n₂ = n₁ - n₂
+ ",
+ ),
+ );
+
+ let file_id2 = files.add(
+ "Test.fun",
+ unindent::unindent(
+ r#"
+ module Test where
+
+ _ : Nat
+ _ = 123 + "hello"
+ "#,
+ ),
+ );
+
+ let diagnostics = vec![
+ // Unknown builtin error
+ Diagnostic::error()
+ .with_message("unknown builtin: `NATRAL`")
+ .with_labels(vec![Label::primary(file_id1, 96..102).with_message("unknown builtin")])
+ .with_notes(vec![
+ "there is a builtin with a similar name: `NATURAL`".to_owned(),
+ ]),
+ // Unused parameter warning
+ Diagnostic::warning()
+ .with_message("unused parameter pattern: `n₂`")
+ .with_labels(vec![Label::primary(file_id1, 285..289).with_message("unused parameter")])
+ .with_notes(vec!["consider using a wildcard pattern: `_`".to_owned()]),
+ // Unexpected type error
+ Diagnostic::error()
+ .with_message("unexpected type in application of `_+_`")
+ .with_code("E0001")
+ .with_labels(vec![
+ Label::primary(file_id2, 37..44).with_message("expected `Nat`, found `String`"),
+ Label::secondary(file_id1, 130..155).with_message("based on the definition of `_+_`"),
+ ])
+ .with_notes(vec![unindent::unindent(
+ "
+ expected type `Nat`
+ found type `String`
+ ",
+ )]),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod fizz_buzz {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, String>> = {
+ let mut files = SimpleFiles::new();
+
+ let file_id = files.add(
+ "FizzBuzz.fun",
+ unindent::unindent(
+ r#"
+ module FizzBuzz where
+
+ fizz₁ : Nat → String
+ fizz₁ num = case (mod num 5) (mod num 3) of
+ 0 0 => "FizzBuzz"
+ 0 _ => "Fizz"
+ _ 0 => "Buzz"
+ _ _ => num
+
+ fizz₂ : Nat → String
+ fizz₂ num =
+ case (mod num 5) (mod num 3) of
+ 0 0 => "FizzBuzz"
+ 0 _ => "Fizz"
+ _ 0 => "Buzz"
+ _ _ => num
+ "#,
+ ),
+ );
+
+ let diagnostics = vec![
+ // Incompatible match clause error
+ Diagnostic::error()
+ .with_message("`case` clauses have incompatible types")
+ .with_code("E0308")
+ .with_labels(vec![
+ Label::primary(file_id, 163..166).with_message("expected `String`, found `Nat`"),
+ Label::secondary(file_id, 62..166).with_message("`case` clauses have incompatible types"),
+ Label::secondary(file_id, 41..47).with_message("expected type `String` found here"),
+ ])
+ .with_notes(vec![unindent::unindent(
+ "
+ expected type `String`
+ found type `Nat`
+ ",
+ )]),
+ // Incompatible match clause error
+ Diagnostic::error()
+ .with_message("`case` clauses have incompatible types")
+ .with_code("E0308")
+ .with_labels(vec![
+ Label::primary(file_id, 328..331).with_message("expected `String`, found `Nat`"),
+ Label::secondary(file_id, 211..331).with_message("`case` clauses have incompatible types"),
+ Label::secondary(file_id, 258..268).with_message("this is found to be of type `String`"),
+ Label::secondary(file_id, 284..290).with_message("this is found to be of type `String`"),
+ Label::secondary(file_id, 306..312).with_message("this is found to be of type `String`"),
+ Label::secondary(file_id, 186..192).with_message("expected type `String` found here"),
+ ])
+ .with_notes(vec![unindent::unindent(
+ "
+ expected type `String`
+ found type `Nat`
+ ",
+ )]),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod multiline_overlapping {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFile<&'static str, String>> = {
+ let file = SimpleFile::new(
+ "codespan/src/file.rs",
+ [
+ " match line_index.compare(self.last_line_index()) {",
+ " Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),",
+ " Ordering::Equal => Ok(self.source_span().end()),",
+ " Ordering::Greater => LineIndexOutOfBoundsError {",
+ " given: line_index,",
+ " max: self.last_line_index(),",
+ " },",
+ " }",
+ ].join("\n"),
+ );
+
+ let diagnostics = vec![
+ Diagnostic::error()
+ .with_message("match arms have incompatible types")
+ .with_code("E0308")
+ .with_labels(vec![
+ // this secondary label is before the primary label to test the locus calculation (see issue #259)
+ Label::secondary((), 89..134).with_message("this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`"),
+ Label::primary((), 230..351).with_message("expected enum `Result`, found struct `LineIndexOutOfBoundsError`"),
+ Label::secondary((), 8..362).with_message("`match` arms have incompatible types"),
+ Label::secondary((), 167..195).with_message("this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`"),
+ ])
+ .with_notes(vec![unindent::unindent(
+ "
+ expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
+ found type `LineIndexOutOfBoundsError`
+ ",
+ )]),
+ ];
+
+ TestData { files: file, diagnostics }
+ };
+ }
+
+ test_emit!(rich_color);
+ test_emit!(medium_color);
+ test_emit!(short_color);
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod tabbed {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, String>> = {
+ let mut files = SimpleFiles::new();
+
+ let file_id = files.add(
+ "tabbed",
+ [
+ "Entity:",
+ "\tArmament:",
+ "\t\tWeapon: DogJaw",
+ "\t\tReloadingCondition:\tattack-cooldown",
+ "\tFoo: Bar",
+ ]
+ .join("\n"),
+ );
+
+ let diagnostics = vec![
+ Diagnostic::warning()
+ .with_message("unknown weapon `DogJaw`")
+ .with_labels(vec![Label::primary(file_id, 29..35).with_message("the weapon")]),
+ Diagnostic::warning()
+ .with_message("unknown condition `attack-cooldown`")
+ .with_labels(vec![Label::primary(file_id, 58..73).with_message("the condition")]),
+ Diagnostic::warning()
+ .with_message("unknown field `Foo`")
+ .with_labels(vec![Label::primary(file_id, 75..78).with_message("the field")]),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ #[test]
+ fn tab_width_default_no_color() {
+ let config = TEST_CONFIG.clone();
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+
+ #[test]
+ fn tab_width_3_no_color() {
+ let config = Config {
+ tab_width: 3,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+
+ #[test]
+ fn tab_width_6_no_color() {
+ let config = Config {
+ tab_width: 6,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+}
+
+mod tab_columns {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, String>> = {
+ let mut files = SimpleFiles::new();
+
+ let source = [
+ "\thello",
+ "∙\thello",
+ "∙∙\thello",
+ "∙∙∙\thello",
+ "∙∙∙∙\thello",
+ "∙∙∙∙∙\thello",
+ "∙∙∙∙∙∙\thello",
+ ].join("\n");
+ let hello_ranges = source
+ .match_indices("hello")
+ .map(|(start, hello)| start..(start+hello.len()))
+ .collect::<Vec<_>>();
+
+ let file_id = files.add("tab_columns", source);
+
+ let diagnostics = vec![
+ Diagnostic::warning()
+ .with_message("tab test")
+ .with_labels(
+ hello_ranges
+ .into_iter()
+ .map(|range| Label::primary(file_id, range))
+ .collect(),
+ ),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ #[test]
+ fn tab_width_default_no_color() {
+ let config = TEST_CONFIG.clone();
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+
+ #[test]
+ fn tab_width_2_no_color() {
+ let config = Config {
+ tab_width: 2,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+
+ #[test]
+ fn tab_width_3_no_color() {
+ let config = Config {
+ tab_width: 3,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+
+ #[test]
+ fn tab_width_6_no_color() {
+ let config = Config {
+ tab_width: 6,
+ ..TEST_CONFIG.clone()
+ };
+
+ insta::assert_snapshot!(TEST_DATA.emit_no_color(&config));
+ }
+}
+
+/// Based on:
+/// - https://github.com/TheSamsa/rust/blob/75cf41afb468152611212271bae026948cd3ba46/src/test/ui/codemap_tests/unicode.stderr
+mod unicode {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFile<&'static str, String>> = {
+ let prefix = r#"extern "#;
+ let abi = r#""路濫狼á́́""#;
+ let suffix = r#" fn foo() {}"#;
+
+ let file = SimpleFile::new(
+ "unicode.rs",
+ format!("{}{}{}", prefix, abi, suffix),
+ );
+
+ let diagnostics = vec![
+ Diagnostic::error()
+ .with_code("E0703")
+ .with_message("invalid ABI: found `路濫狼á́́`")
+ .with_labels(vec![
+ Label::primary((), prefix.len()..(prefix.len() + abi.len()))
+ .with_message("invalid ABI"),
+ ])
+ .with_notes(vec![unindent::unindent(
+ "
+ valid ABIs:
+ - aapcs
+ - amdgpu-kernel
+ - C
+ - cdecl
+ - efiapi
+ - fastcall
+ - msp430-interrupt
+ - platform-intrinsic
+ - ptx-kernel
+ - Rust
+ - rust-call
+ - rust-intrinsic
+ - stdcall
+ - system
+ - sysv64
+ - thiscall
+ - unadjusted
+ - vectorcall
+ - win64
+ - x86-interrupt
+ ",
+ )]),
+ Diagnostic::error()
+ .with_message("aborting due to previous error")
+ .with_notes(vec![
+ "For more information about this error, try `rustc --explain E0703`.".to_owned(),
+ ]),
+ ];
+
+ TestData { files: file, diagnostics }
+ };
+ }
+
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+}
+
+mod unicode_spans {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFile<&'static str, String>> = {
+ let moon_phases = format!("{}", r#"🐄🌑🐄🌒🐄🌓🐄🌔🐄🌕🐄🌖🐄🌗🐄🌘🐄"#);
+ let invalid_start = 1;
+ let invalid_end = "🐄".len() - 1;
+ assert_eq!(moon_phases.is_char_boundary(invalid_start), false);
+ assert_eq!(moon_phases.is_char_boundary(invalid_end), false);
+ assert_eq!("🐄".len(), 4);
+ let file = SimpleFile::new(
+ "moon_jump.rs",
+ moon_phases,
+ );
+ let diagnostics = vec![
+ Diagnostic::error()
+ .with_code("E01")
+ .with_message("cow may not jump during new moon.")
+ .with_labels(vec![
+ Label::primary((), invalid_start..invalid_end)
+ .with_message("Invalid jump"),
+ ]),
+ Diagnostic::note()
+ .with_message("invalid unicode range")
+ .with_labels(vec![
+ Label::secondary((), invalid_start.."🐄".len())
+ .with_message("Cow range does not start at boundary."),
+ ]),
+ Diagnostic::note()
+ .with_message("invalid unicode range")
+ .with_labels(vec![
+ Label::secondary((), "🐄🌑".len().."🐄🌑🐄".len() - 1)
+ .with_message("Cow range does not end at boundary."),
+ ]),
+ Diagnostic::note()
+ .with_message("invalid unicode range")
+ .with_labels(vec![
+ Label::secondary((), invalid_start.."🐄🌑🐄".len() - 1)
+ .with_message("Cow does not start or end at boundary."),
+ ]),
+ ];
+ TestData{files: file, diagnostics }
+ };
+ }
+
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+}
+
+mod position_indicator {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_DATA: TestData<'static, SimpleFile<&'static str, String>> = {
+ let file = SimpleFile::new(
+ "tests/main.js",
+ [
+ "\"use strict\";",
+ "let zero=0;",
+ "function foo() {",
+ " \"use strict\";",
+ " one=1;",
+ "}",
+ ].join("\n"),
+ );
+ let diagnostics = vec![
+ Diagnostic::warning()
+ .with_code("ParserWarning")
+ .with_message("The strict mode declaration in the body of function `foo` is redundant, as the outer scope is already in strict mode")
+ .with_labels(vec![
+ Label::primary((), 45..57)
+ .with_message("This strict mode declaration is redundant"),
+ Label::secondary((), 0..12)
+ .with_message("Strict mode is first declared here"),
+ ]),
+ ];
+ TestData{files: file, diagnostics }
+ };
+ }
+
+ test_emit!(rich_no_color);
+ test_emit!(medium_no_color);
+ test_emit!(short_no_color);
+ test_emit!(rich_ascii_no_color);
+}
+
+mod multiline_omit {
+ use super::*;
+
+ lazy_static::lazy_static! {
+ static ref TEST_CONFIG: Config = Config {
+ styles: Styles::with_blue(Color::Blue),
+ start_context_lines: 2,
+ end_context_lines: 1,
+ ..Config::default()
+ };
+
+ static ref TEST_DATA: TestData<'static, SimpleFiles<&'static str, String>> = {
+ let mut files = SimpleFiles::new();
+
+ let file_id1 = files.add(
+ "empty_if_comments.lua",
+ [
+ "elseif 3 then", // primary label starts here
+ "", // context line
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "", // context line
+ "else", // primary label ends here
+ ]
+ .join("\n"),
+ );
+
+ let file_id2 = files.add(
+ "src/lib.rs",
+ [
+ "fn main() {",
+ " 1", // primary label starts here
+ " + 1", // context line
+ " + 1", // skip
+ " + 1", // skip
+ " + 1", // skip
+ " +1", // secondary label here
+ " + 1", // this single line will not be skipped; the previously filtered out label must be retrieved
+ " + 1", // context line
+ " + 1", // primary label ends here
+ "}",
+ ]
+ .join("\n"),
+ );
+
+ let diagnostics = vec![
+ Diagnostic::error()
+ .with_message("empty elseif block")
+ .with_code("empty_if")
+ .with_labels(vec![
+ Label::primary(file_id1, 0..23),
+ Label::secondary(file_id1, 15..21).with_message("content should be in here"),
+ ]),
+ Diagnostic::error()
+ .with_message("mismatched types")
+ .with_code("E0308")
+ .with_labels(vec![
+ Label::primary(file_id2, 17..80).with_message("expected (), found integer"),
+ Label::secondary(file_id2, 55..55).with_message("missing whitespace"),
+ ])
+ .with_notes(vec![
+ "note:\texpected type `()`\n\tfound type `{integer}`".to_owned()
+ ]),
+ ];
+
+ TestData { files, diagnostics }
+ };
+ }
+
+ test_emit!(rich_no_color);
+}