Closed
Description
bool
is not sufficient to keep track if we're in a constant item:
const A: u8 = {
const B: () = ();
let x = [0u8; 20_000_000];
x[0]
};
This will still lint the array assigned to x
. But if one comments out const B
, it won't lint, because of the fix added in #13485
To fix this, turn the bool
into a counter, increment it when entering an item and decrementing it when exiting it.
The current impl also won't prevent the lint from triggering in const fn
s. But I'm not sure if this is intended intended.
Originally posted by @flip1995 in #13485 (comment)
This issue has been assigned to @GnomedDev via this comment.