Skip to content

Commit 60f9ddf

Browse files
committed
Add more tests for unicode output
1 parent 3979d5e commit 60f9ddf

15 files changed

+178
-24
lines changed

tests/ui/diagnostic-width/E0271.stderr renamed to tests/ui/diagnostic-width/E0271.ascii.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0271]: type mismatch resolving `<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ...>>, ...>>, ...> as Future>::Error == Foo`
2-
--> $DIR/E0271.rs:18:5
2+
--> $DIR/E0271.rs:20:5
33
|
44
LL | / Box::new(
55
LL | | Ok::<_, ()>(
@@ -11,7 +11,7 @@ LL | | )
1111
| |_____^ type mismatch resolving `<Result<Result<(), Result<Result<(), ...>, ...>>, ...> as Future>::Error == Foo`
1212
|
1313
note: expected this to be `Foo`
14-
--> $DIR/E0271.rs:8:18
14+
--> $DIR/E0271.rs:10:18
1515
|
1616
LL | type Error = E;
1717
| ^

tests/ui/diagnostic-width/E0271.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//@ compile-flags: --diagnostic-width=40
1+
//@ revisions: ascii unicode
2+
//@[ascii] compile-flags: --diagnostic-width=40
3+
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode --diagnostic-width=40
24
//@ normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
35
trait Future {
46
type Error;
@@ -15,7 +17,7 @@ impl<T> Future for Option<T> {
1517
struct Foo;
1618

1719
fn foo() -> Box<dyn Future<Error=Foo>> {
18-
Box::new( //~ ERROR E0271
20+
Box::new( //[ascii]~ ERROR E0271
1921
Ok::<_, ()>(
2022
Err::<(), _>(
2123
Ok::<_, ()>(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0271]: type mismatch resolving `<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ...>>, ...>>, ...> as Future>::Error == Foo`
2+
╭▸ $DIR/E0271.rs:20:5
3+
4+
LL │ ┏ Box::new(
5+
LL │ ┃ Ok::<_, ()>(
6+
LL │ ┃ Err::<(), _>(
7+
LL │ ┃ Ok::<_, ()>(
8+
‡ ┃
9+
LL │ ┃ )
10+
LL │ ┃ )
11+
│ ┗━━━━━┛ type mismatch resolving `<Result<Result<(), Result<Result<(), ...>, ...>>, ...> as Future>::Error == Foo`
12+
╰╴
13+
note: expected this to be `Foo`
14+
╭▸ $DIR/E0271.rs:10:18
15+
16+
LL │ type Error = E;
17+
│ ━
18+
╰ note: required for the cast from `Box<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ()>>, ()>>, ()>>` to `Box<(dyn Future<Error = Foo> + 'static)>`
19+
20+
error: aborting due to 1 previous error
21+
22+
For more information about this error, try `rustc --explain E0271`.

tests/ui/diagnostic-width/flag-human.stderr renamed to tests/ui/diagnostic-width/flag-human.ascii.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/flag-human.rs:7:17
2+
--> $DIR/flag-human.rs:9:17
33
|
44
LL | ..._: () = 42;
55
| -- ^^ expected `()`, found integer
+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
//@ compile-flags: --diagnostic-width=20
1+
//@ revisions: ascii unicode
2+
//@[ascii] compile-flags: --diagnostic-width=20
3+
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode --diagnostic-width=20
24

35
// This test checks that `-Z output-width` effects the human error output by restricting it to an
46
// arbitrarily low value so that the effect is visible.
57

68
fn main() {
79
let _: () = 42;
8-
//~^ ERROR mismatched types
10+
//[ascii]~^ ERROR mismatched types
911
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0308]: mismatched types
2+
╭▸ $DIR/flag-human.rs:9:17
3+
4+
LL │ …t _: () = 42;
5+
│ ┬─ ━━ expected `()`, found integer
6+
│ │
7+
╰╴ expected due to this
8+
9+
error: aborting due to 1 previous error
10+
11+
For more information about this error, try `rustc --explain E0308`.

tests/ui/diagnostic-width/long-E0308.stderr renamed to tests/ui/diagnostic-width/long-E0308.ascii.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/long-E0308.rs:44:9
2+
--> $DIR/long-E0308.rs:46:9
33
|
44
LL | let x: Atype<
55
| _____________-
@@ -20,11 +20,11 @@ LL | | ))))))))))))))))))))))))))))));
2020
|
2121
= note: expected struct `Atype<Btype<..., ...>, ...>`
2222
| found enum `Result<Result<..., ...>, ...>`
23-
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
23+
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt'
2424
= note: consider using `--verbose` to print the full type name to the console
2525

2626
error[E0308]: mismatched types
27-
--> $DIR/long-E0308.rs:57:26
27+
--> $DIR/long-E0308.rs:59:26
2828
|
2929
LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
3030
| __________________________^
@@ -36,11 +36,11 @@ LL | | ))))))))))))))))))))))));
3636
|
3737
= note: expected enum `Option<Result<..., ...>>`
3838
| found enum `Result<Result<..., ...>, ...>`
39-
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
39+
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt'
4040
= note: consider using `--verbose` to print the full type name to the console
4141

4242
error[E0308]: mismatched types
43-
--> $DIR/long-E0308.rs:88:9
43+
--> $DIR/long-E0308.rs:90:9
4444
|
4545
LL | let x: Atype<
4646
| ____________-
@@ -56,11 +56,11 @@ LL | | > = ();
5656
|
5757
= note: expected struct `Atype<Btype<..., ...>, ...>`
5858
| found unit type `()`
59-
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
59+
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt'
6060
= note: consider using `--verbose` to print the full type name to the console
6161

6262
error[E0308]: mismatched types
63-
--> $DIR/long-E0308.rs:91:17
63+
--> $DIR/long-E0308.rs:93:17
6464
|
6565
LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
6666
| ____________--___^
@@ -74,7 +74,7 @@ LL | | ))))))))))))))))))))))));
7474
|
7575
= note: expected unit type `()`
7676
| found enum `Result<Result<..., ...>, ...>`
77-
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
77+
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt'
7878
= note: consider using `--verbose` to print the full type name to the console
7979

8080
error: aborting due to 4 previous errors

tests/ui/diagnostic-width/long-E0308.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
1+
//@ revisions: ascii unicode
2+
//@[ascii] compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
3+
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
24
//@ normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
35

46
mod a {
@@ -46,7 +48,7 @@ fn main() {
4648
Ok("")
4749
))))))))))))))))))))))))))))))
4850
))))))))))))))))))))))))))))));
49-
//~^^^^^ ERROR E0308
51+
//[ascii]~^^^^^ ERROR E0308
5052

5153
let _ = Some(Ok(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(
5254
Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(
@@ -59,7 +61,7 @@ fn main() {
5961
Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
6062
))))))))))))))))))))))))))))))
6163
))))))))))))))))))))))));
62-
//~^^^^^ ERROR E0308
64+
//[ascii]~^^^^^ ERROR E0308
6365

6466
let x: Atype<
6567
Btype<
@@ -86,12 +88,12 @@ fn main() {
8688
>,
8789
i32
8890
> = ();
89-
//~^ ERROR E0308
91+
//[ascii]~^ ERROR E0308
9092

9193
let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
9294
Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
9395
Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
9496
))))))))))))))))))))))))))))))
9597
))))))))))))))))))))))));
96-
//~^^^^^ ERROR E0308
98+
//[ascii]~^^^^^ ERROR E0308
9799
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
error[E0308]: mismatched types
2+
╭▸ $DIR/long-E0308.rs:46:9
3+
4+
LL │ let x: Atype<
5+
│ ┌─────────────┘
6+
LL │ │ Btype<
7+
LL │ │ Ctype<
8+
LL │ │ Atype<
9+
‡ │
10+
LL │ │ i32
11+
LL │ │ > = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O…
12+
│ │┏━━━━━│━━━┛
13+
│ └┃─────┤
14+
│ ┃ expected due to this
15+
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O…
16+
LL │ ┃ Ok("")
17+
LL │ ┃ ))))))))))))))))))))))))))))))
18+
LL │ ┃ ))))))))))))))))))))))))))))));
19+
│ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Atype<Btype<..., ...>, ...>`, found `Result<Result<..., ...>, ...>`
20+
21+
├ note: expected struct `Atype<Btype<..., ...>, ...>`
22+
│ found enum `Result<Result<..., ...>, ...>`
23+
├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt'
24+
╰ note: consider using `--verbose` to print the full type name to the console
25+
26+
error[E0308]: mismatched types
27+
╭▸ $DIR/long-E0308.rs:59:26
28+
29+
LL │ ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(…
30+
│ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛
31+
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok…
32+
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
33+
LL │ ┃ ))))))))))))))))))))))))))))))
34+
LL │ ┃ ))))))))))))))))))))))));
35+
│ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Option<Result<..., ...>>`, found `Result<Result<..., ...>, ...>`
36+
37+
├ note: expected enum `Option<Result<..., ...>>`
38+
│ found enum `Result<Result<..., ...>, ...>`
39+
├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt'
40+
╰ note: consider using `--verbose` to print the full type name to the console
41+
42+
error[E0308]: mismatched types
43+
╭▸ $DIR/long-E0308.rs:90:9
44+
45+
LL │ let x: Atype<
46+
│ ┌────────────┘
47+
LL │ │ Btype<
48+
LL │ │ Ctype<
49+
LL │ │ Atype<
50+
‡ │
51+
LL │ │ i32
52+
LL │ │ > = ();
53+
│ │ │ ━━ expected `Atype<Btype<..., ...>, ...>`, found `()`
54+
│ └─────┤
55+
│ expected due to this
56+
57+
├ note: expected struct `Atype<Btype<..., ...>, ...>`
58+
│ found unit type `()`
59+
├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt'
60+
╰ note: consider using `--verbose` to print the full type name to the console
61+
62+
error[E0308]: mismatched types
63+
╭▸ $DIR/long-E0308.rs:93:17
64+
65+
LL │ let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(…
66+
│ ┏━━━━━━━━━━━━┬─━━━┛
67+
│ ┃ │
68+
│ ┃ expected due to this
69+
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok…
70+
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
71+
LL │ ┃ ))))))))))))))))))))))))))))))
72+
LL │ ┃ ))))))))))))))))))))))));
73+
│ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `()`, found `Result<Result<..., ...>, ...>`
74+
75+
├ note: expected unit type `()`
76+
│ found enum `Result<Result<..., ...>, ...>`
77+
├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt'
78+
╰ note: consider using `--verbose` to print the full type name to the console
79+
80+
error: aborting due to 4 previous errors
81+
82+
For more information about this error, try `rustc --explain E0308`.

tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.stderr renamed to tests/ui/diagnostic-width/non-1-width-unicode-multiline-label.ascii.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0369]: cannot add `&str` to `&str`
2-
--> $DIR/non-1-width-unicode-multiline-label.rs:5:260
2+
--> $DIR/non-1-width-unicode-multiline-label.rs:7:260
33
|
44
LL | ...ཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇...࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
55
| -------------- ^ -------------- &str
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
//@ revisions: ascii unicode
2+
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode
13
// ignore-tidy-linelength
24

35
fn main() {
46
let unicode_is_fun = "؁‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥";
57
let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
6-
//~^ ERROR cannot add `&str` to `&str`
8+
//[ascii]~^ ERROR cannot add `&str` to `&str`
79
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error[E0369]: cannot add `&str` to `&str`
2+
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:7:260
3+
4+
LL │ …ཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉…࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
5+
│ ┬───────────── ┯ ────────────── &str
6+
│ │ │
7+
│ │ `+` cannot be used to concatenate two `&str` strings
8+
│ &str
9+
10+
╰ note: string concatenation requires an owned `String` on the left
11+
help: create an owned `String` from a string reference
12+
╭╴
13+
LL │ let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun.to_owned() + " really fun!";
14+
╰╴ +++++++++++
15+
16+
error: aborting due to 1 previous error
17+
18+
For more information about this error, try `rustc --explain E0369`.

tests/ui/diagnostic-width/non-whitespace-trimming-2.stderr renamed to tests/ui/diagnostic-width/non-whitespace-trimming-2.ascii.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/non-whitespace-trimming-2.rs:4:311
2+
--> $DIR/non-whitespace-trimming-2.rs:6:311
33
|
44
LL | ...13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let ...
55
| -- ^^ expected `()`, found integer
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
//@ revisions: ascii unicode
2+
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode
13
// ignore-tidy-linelength
24

35
fn main() {
46
let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _: usize = 4; let _: usize = 5; let _: usize = 6; let _: usize = 7; let _: usize = 8; let _: usize = 9; let _: usize = 10; let _: usize = 11; let _: usize = 12; let _: usize = 13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _: usize = 4; let _: usize = 5; let _: usize = 6; let _: usize = 7; let _: usize = 8; let _: usize = 9; let _: usize = 10; let _: usize = 11; let _: usize = 12; let _: usize = 13; let _: usize = 14; let _: usize = 15;
5-
//~^ ERROR mismatched types
7+
//[ascii]~^ ERROR mismatched types
68
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0308]: mismatched types
2+
╭▸ $DIR/non-whitespace-trimming-2.rs:6:311
3+
4+
LL │ …= 13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _:…
5+
│ ┬─ ━━ expected `()`, found integer
6+
│ │
7+
╰╴ expected due to this
8+
9+
error: aborting due to 1 previous error
10+
11+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)