summaryrefslogtreecommitdiffstats
path: root/tests/ui/editions/edition-cstr-2015-2018.rs
blob: 4c35c48646a03eb4350fdd2af4febba683e35b98 (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
56
57
58
59
60
61
62
macro_rules! construct { ($x:ident) => { $x"str" } }
    //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
    //~| NOTE expected one of 8 possible tokens

macro_rules! contain { () => { c"str" } }
    //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
    //~| NOTE expected one of 8 possible tokens
    //~| NOTE you may be trying to write a c-string literal
    //~| NOTE c-string literals require Rust 2021 or later
    //~| HELP pass `--edition 2021` to `rustc`
    //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide

fn check_macro_construct() {
    construct!(c); //~ NOTE in this expansion of construct!
}

fn check_macro_contain() {
    contain!();
    //~^ NOTE in this expansion of contain!
    //~| NOTE in this expansion of contain!
    //~| NOTE in this expansion of contain!
    //~| NOTE in this expansion of contain!
    //~| NOTE in this expansion of contain!
}

fn check_basic() {
    c"str";
    //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
    //~| NOTE expected one of 8 possible tokens
    //~| NOTE you may be trying to write a c-string literal
    //~| NOTE c-string literals require Rust 2021 or later
    //~| HELP pass `--edition 2021` to `rustc`
    //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
}

fn check_craw() {
    cr"str";
    //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
    //~| NOTE expected one of 8 possible tokens
    //~| NOTE you may be trying to write a c-string literal
    //~| NOTE c-string literals require Rust 2021 or later
    //~| HELP pass `--edition 2021` to `rustc`
    //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
}

fn check_craw_hash() {
    cr##"str"##;
    //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `#`
    //~| NOTE expected one of 8 possible tokens
    //~| NOTE you may be trying to write a c-string literal
    //~| NOTE c-string literals require Rust 2021 or later
    //~| HELP pass `--edition 2021` to `rustc`
    //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
}

fn check_cstr_space() {
    c "str";
    //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
    //~| NOTE expected one of 8 possible tokens
}

fn main() {}