fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
772 B27 linesraw
1// compile-flags: --error-format pretty-json -Zunstable-options
2// build-pass (FIXME(62277): could be check-pass?)
3// run-rustfix
4
5// The output for humans should just highlight the whole span without showing
6// the suggested replacement, but we also want to test that suggested
7// replacement only removes one set of parentheses, rather than naïvely
8// stripping away any starting or ending parenthesis characters—hence this
9// test of the JSON error format.
10
11#![warn(unused_parens)]
12#![allow(unreachable_code)]
13
14fn main() {
15    // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
16    // the malformed `1 / (2 + 3`
17    let _a = 1 / (2 + 3);
18    f();
19}
20
21fn f() -> bool {
22    loop {
23        if (break { return true }) {
24        }
25    }
26    false
27}