fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.3 KiB63 linesraw
1// run-rustfix
2
3struct Foo {
4    bar: Bar,
5}
6
7struct Bar {
8    qux: i32,
9}
10
11pub fn post_regular() {
12    let mut i = 0;
13    i += 1; //~ ERROR Rust has no postfix increment operator
14    println!("{}", i);
15}
16
17pub fn post_while() {
18    let mut i = 0;
19    while { let tmp = i; i += 1; tmp } < 5 {
20        //~^ ERROR Rust has no postfix increment operator
21        println!("{}", i);
22    }
23}
24
25pub fn post_regular_tmp() {
26    let mut tmp = 0;
27    tmp += 1; //~ ERROR Rust has no postfix increment operator
28    println!("{}", tmp);
29}
30
31pub fn post_while_tmp() {
32    let mut tmp = 0;
33    while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 {
34        //~^ ERROR Rust has no postfix increment operator
35        println!("{}", tmp);
36    }
37}
38
39pub fn post_field() {
40    let mut foo = Foo { bar: Bar { qux: 0 } };
41    foo.bar.qux += 1;
42    //~^ ERROR Rust has no postfix increment operator
43    println!("{}", foo.bar.qux);
44}
45
46pub fn post_field_tmp() {
47    struct S {
48        tmp: i32
49    }
50    let mut s = S { tmp: 0 };
51    s.tmp += 1;
52    //~^ ERROR Rust has no postfix increment operator
53    println!("{}", s.tmp);
54}
55
56pub fn pre_field() {
57    let mut foo = Foo { bar: Bar { qux: 0 } };
58    foo.bar.qux += 1;
59    //~^ ERROR Rust has no prefix increment operator
60    println!("{}", foo.bar.qux);
61}
62
63fn main() {}