]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/issue-90870.fixed
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / consts / issue-90870.fixed
CommitLineData
a2a8927a
XL
1// Regression test for issue #90870.
2
3// run-rustfix
4
5#![allow(dead_code)]
6
7const 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
13const 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
19const 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
34fn main() {}