summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/bad-lit-suffixes.rs
blob: 8cb9ef7e0c9219d88785bac368c2317252d699cc (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
#![feature(rustc_attrs)]

extern
    "C"suffix //~ ERROR suffixes on string literals are invalid
    fn foo() {}

extern
    "C"suffix //~ ERROR suffixes on string literals are invalid
{}

fn main() {
    ""suffix; //~ ERROR suffixes on string literals are invalid
    b""suffix; //~ ERROR suffixes on byte string literals are invalid
    r#""#suffix; //~ ERROR suffixes on string literals are invalid
    br#""#suffix; //~ ERROR suffixes on byte string literals are invalid
    'a'suffix; //~ ERROR suffixes on char literals are invalid
    b'a'suffix; //~ ERROR suffixes on byte literals are invalid

    1234u1024; //~ ERROR invalid width `1024` for integer literal
    1234i1024; //~ ERROR invalid width `1024` for integer literal
    1234f1024; //~ ERROR invalid width `1024` for float literal
    1234.5f1024; //~ ERROR invalid width `1024` for float literal

    1234suffix; //~ ERROR invalid suffix `suffix` for number literal
    0b101suffix; //~ ERROR invalid suffix `suffix` for number literal
    1.0suffix; //~ ERROR invalid suffix `suffix` for float literal
    1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal
}

#[rustc_dummy = "string"suffix]
//~^ ERROR unexpected expression: `"string"suffix`
fn f() {}

#[must_use = "string"suffix]
//~^ ERROR unexpected expression: `"string"suffix`
fn g() {}

#[link(name = "string"suffix)]
//~^ ERROR suffixes on string literals are invalid
extern "C" {}

#[rustc_layout_scalar_valid_range_start(0suffix)]
//~^ ERROR invalid suffix `suffix` for number literal
struct S;