diff options
| author | oli <github35764891676564198441@oli-obk.de> | 2020-12-30 02:04:52 +0000 |
|---|---|---|
| committer | oli <github35764891676564198441@oli-obk.de> | 2021-01-23 16:51:23 +0000 |
| commit | 0491e74dd9d6e860f8944a5ddaf03bfda8b16892 (patch) | |
| tree | 5b5230475f576edc6baf5d2f9cd676e5b39ed830 /src | |
| parent | b8727e2d604e37a1510afaa9bd8777fecdcb5da4 (diff) | |
| download | rust-0491e74dd9d6e860f8944a5ddaf03bfda8b16892.tar.gz rust-0491e74dd9d6e860f8944a5ddaf03bfda8b16892.zip | |
Make sure that const prop does not produce unsilenceable lints after inlining
Diffstat (limited to 'src')
| -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 00000000000..656ff02dc67 --- /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=2 + +#![deny(warnings)] + +fn main() { + #[allow(arithmetic_overflow)] + let _ = add(u8::MAX, 1); +} + +#[inline(always)] +fn add(x: u8, y: u8) -> u8 { + x + y +} |
