fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
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 9 //~^ ERROR: cannot call non-const operator in constant functions [E0015] 10 //~| HELP: consider dereferencing here 11 //~| HELP: add `#![feature(const_trait_impl)]` 12} 13 14const fn g(a: &&&&i64, b: &&&&i64) -> bool { 15 ****a == ****b 16 //~^ ERROR: cannot call non-const operator in constant functions [E0015] 17 //~| HELP: consider dereferencing here 18 //~| HELP: add `#![feature(const_trait_impl)]` 19} 20 21const fn h(mut a: &[u8], mut b: &[u8]) -> bool { 22 while let ([l, at @ ..], [r, bt @ ..]) = (a, b) { 23 if *l == *r { 24 //~^ ERROR: cannot call non-const operator in constant functions [E0015] 25 //~| HELP: consider dereferencing here 26 //~| HELP: add `#![feature(const_trait_impl)]` 27 a = at; 28 b = bt; 29 } else { 30 return false; 31 } 32 } 33 34 a.is_empty() && b.is_empty() 35} 36 37fn main() {}