]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/increment-notfixed.rs
Auto merge of #100678 - GuillaumeGomez:improve-rustdoc-json-tests, r=aDotInTheVoid
[rust.git] / src / test / ui / parser / increment-notfixed.rs
1 struct Foo {
2     bar: Bar,
3 }
4
5 struct Bar {
6     qux: i32,
7 }
8
9 pub fn post_regular() {
10     let mut i = 0;
11     i++; //~ ERROR Rust has no postfix increment operator
12     println!("{}", i);
13 }
14
15 pub fn post_while() {
16     let mut i = 0;
17     while i++ < 5 {
18         //~^ ERROR Rust has no postfix increment operator
19         println!("{}", i);
20     }
21 }
22
23 pub fn post_regular_tmp() {
24     let mut tmp = 0;
25     tmp++; //~ ERROR Rust has no postfix increment operator
26     println!("{}", tmp);
27 }
28
29 pub fn post_while_tmp() {
30     let mut tmp = 0;
31     while tmp++ < 5 {
32         //~^ ERROR Rust has no postfix increment operator
33         println!("{}", tmp);
34     }
35 }
36
37 pub fn post_field() {
38     let foo = Foo { bar: Bar { qux: 0 } };
39     foo.bar.qux++;
40     //~^ ERROR Rust has no postfix increment operator
41     println!("{}", foo.bar.qux);
42 }
43
44 pub fn post_field_tmp() {
45     struct S {
46         tmp: i32
47     }
48     let s = S { tmp: 0 };
49     s.tmp++;
50     //~^ ERROR Rust has no postfix increment operator
51     println!("{}", s.tmp);
52 }
53
54 pub fn pre_field() {
55     let foo = Foo { bar: Bar { qux: 0 } };
56     ++foo.bar.qux;
57     //~^ ERROR Rust has no prefix increment operator
58     println!("{}", foo.bar.qux);
59 }
60
61 fn main() {}