about summary refs log tree commit diff
path: root/tests/ui/compiletest-self-test/line-annotation-mismatches.rs
blob: d2a14374ed4c7cb55580b903ab3d3783a91618e2 (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
//@ should-fail

// The warning is reported with unknown line
//@ compile-flags: -D raw_pointer_derive
//~? WARN kind and unknown line match the reported warning, but we do not suggest it

// The error is expected but not reported at all.
//~ ERROR this error does not exist

// The error is reported but not expected at all.
// "`main` function not found in crate" (the main function is intentionally not added)

// An "unimportant" diagnostic is expected on a wrong line.
//~ ERROR aborting due to

// An "unimportant" diagnostic is expected with a wrong kind.
//~? ERROR For more information about an error

fn wrong_line_or_kind() {
    // A diagnostic expected on a wrong line.
    unresolved1;
    //~ ERROR cannot find value `unresolved1` in this scope

    // A diagnostic expected with a wrong kind.
    unresolved2; //~ WARN cannot find value `unresolved2` in this scope

    // A diagnostic expected with a missing kind (treated as a wrong kind).
    unresolved3; //~ cannot find value `unresolved3` in this scope

    // A diagnostic expected with a wrong line and kind.
    unresolved4;
    //~ WARN cannot find value `unresolved4` in this scope
}

fn wrong_message() {
    // A diagnostic expected with a wrong message, but the line is known and right.
    unresolvedA; //~ ERROR stub message 1

    // A diagnostic expected with a wrong message, but the line is known and right,
    // even if the kind doesn't match.
    unresolvedB; //~ WARN stub message 2
}