about summary refs log tree commit diff
path: root/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.rs
blob: 82c2db7e26d7f0e2476f7d055021e1945e0d1624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//@ reference: attributes.diagnostic.on_unimplemented.invalid-string
#[diagnostic::on_unimplemented(message = "{{Test } thing")]
//~^WARN unmatched `}` found
//~|WARN unmatched `}` found
trait ImportantTrait1 {}

#[diagnostic::on_unimplemented(message = "Test {}")]
//~^WARN positional format arguments are not allowed here
//~|WARN positional format arguments are not allowed here
trait ImportantTrait2 {}

#[diagnostic::on_unimplemented(message = "Test {1:}")]
//~^WARN positional format arguments are not allowed here
//~|WARN positional format arguments are not allowed here
//~|WARN invalid format specifier [malformed_diagnostic_format_literals]
//~|WARN invalid format specifier [malformed_diagnostic_format_literals]
trait ImportantTrait3 {}

#[diagnostic::on_unimplemented(message = "Test {Self:123}")]
//~^WARN invalid format specifier
//~|WARN invalid format specifier
trait ImportantTrait4 {}

#[diagnostic::on_unimplemented(message = "Test {Self:!}")]
//~^WARN invalid format specifier [malformed_diagnostic_format_literals]
//~|WARN invalid format specifier [malformed_diagnostic_format_literals]
trait ImportantTrait5 {}

#[diagnostic::on_unimplemented(message = "Test {Self:}")]
//~^WARN invalid format specifier [malformed_diagnostic_format_literals]
//~|WARN invalid format specifier [malformed_diagnostic_format_literals]
trait ImportantTrait6 {}


fn check_1(_: impl ImportantTrait1) {}
fn check_2(_: impl ImportantTrait2) {}
fn check_3(_: impl ImportantTrait3) {}
fn check_4(_: impl ImportantTrait4) {}
fn check_5(_: impl ImportantTrait5) {}
fn check_6(_: impl ImportantTrait6) {}

fn main() {
    check_1(());
    //~^ERROR {{Test } thing
    check_2(());
    //~^ERROR Test {}
    check_3(());
    //~^ERROR Test {1}
    check_4(());
    //~^ERROR Test ()
    check_5(());
    //~^ERROR Test ()
    check_6(());
    //~^ERROR Test ()
}