]>
Commit | Line | Data |
---|---|---|
a2a8927a XL |
1 | // Regression test for issue #90870. |
2 | ||
3 | // run-rustfix | |
4 | ||
5 | #![allow(dead_code)] | |
6 | ||
7 | const fn f(a: &u8, b: &u8) -> bool { | |
8 | *a == *b | |
5099ac24 | 9 | //~^ ERROR: cannot call non-const operator in constant functions [E0015] |
a2a8927a XL |
10 | //~| HELP: consider dereferencing here |
11 | } | |
12 | ||
13 | const fn g(a: &&&&i64, b: &&&&i64) -> bool { | |
14 | ****a == ****b | |
5099ac24 | 15 | //~^ ERROR: cannot call non-const operator in constant functions [E0015] |
a2a8927a XL |
16 | //~| HELP: consider dereferencing here |
17 | } | |
18 | ||
19 | const fn h(mut a: &[u8], mut b: &[u8]) -> bool { | |
20 | while let ([l, at @ ..], [r, bt @ ..]) = (a, b) { | |
21 | if *l == *r { | |
5099ac24 | 22 | //~^ ERROR: cannot call non-const operator in constant functions [E0015] |
a2a8927a XL |
23 | //~| HELP: consider dereferencing here |
24 | a = at; | |
25 | b = bt; | |
26 | } else { | |
27 | return false; | |
28 | } | |
29 | } | |
30 | ||
31 | a.is_empty() && b.is_empty() | |
32 | } | |
33 | ||
34 | fn main() {} |