mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-23 14:05:27 +00:00
37 lines
711 B
Rust
37 lines
711 B
Rust
|
// run-rustfix
|
||
|
|
||
|
fn post_regular() {
|
||
|
let mut i = 0;
|
||
|
{ let tmp = i; i += 1; tmp }; //~ ERROR Rust has no postfix increment operator
|
||
|
println!("{}", i);
|
||
|
}
|
||
|
|
||
|
fn post_while() {
|
||
|
let mut i = 0;
|
||
|
while { let tmp = i; i += 1; tmp } < 5 {
|
||
|
//~^ ERROR Rust has no postfix increment operator
|
||
|
println!("{}", i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn pre_regular() {
|
||
|
let mut i = 0;
|
||
|
i += 1; //~ ERROR Rust has no prefix increment operator
|
||
|
println!("{}", i);
|
||
|
}
|
||
|
|
||
|
fn pre_while() {
|
||
|
let mut i = 0;
|
||
|
while { i += 1; i } < 5 {
|
||
|
//~^ ERROR Rust has no prefix increment operator
|
||
|
println!("{}", i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
post_regular();
|
||
|
post_while();
|
||
|
pre_regular();
|
||
|
pre_while();
|
||
|
}
|