]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/issue-90870.fixed
Auto merge of #106711 - albertlarsan68:use-ci-llvm-when-lld, r=jyn514
[rust.git] / tests / ui / consts / issue-90870.fixed
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
9     //~^ ERROR: cannot call non-const operator in constant functions [E0015]
10     //~| HELP: consider dereferencing here
11 }
12
13 const fn g(a: &&&&i64, b: &&&&i64) -> bool {
14     ****a == ****b
15     //~^ ERROR: cannot call non-const operator in constant functions [E0015]
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 {
22         //~^ ERROR: cannot call non-const operator in constant functions [E0015]
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() {}