diff options
Diffstat (limited to 'src/test/ui/const_prop/inline_spans_lint_attribute.rs')
-rw-r--r-- | src/test/ui/const_prop/inline_spans_lint_attribute.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/const_prop/inline_spans_lint_attribute.rs b/src/test/ui/const_prop/inline_spans_lint_attribute.rs new file mode 100644 index 000000000..1db53d771 --- /dev/null +++ b/src/test/ui/const_prop/inline_spans_lint_attribute.rs @@ -0,0 +1,15 @@ +// Must be build-pass, because check-pass will not run const prop and thus not emit the lint anyway. +// build-pass +// compile-flags: -Zmir-opt-level=3 + +#![deny(warnings)] + +fn main() { + #[allow(arithmetic_overflow)] + let _ = add(u8::MAX, 1); +} + +#[inline(always)] +fn add(x: u8, y: u8) -> u8 { + x + y +} |