about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-14 06:29:23 +0000
committerbors <bors@rust-lang.org>2023-09-14 06:29:23 +0000
commite17235105cd48cd4e19e8b4fd8e9701e5a7a0f6f (patch)
tree4e24e40f015953d5fc73c7397f7c9dd15f05bf7a /tests
parent23949593103d03a82c7ebc2e84434ce6c6edc561 (diff)
parent01d7bf09f380236f6eb059d33971d7bf0d755531 (diff)
downloadrust-e17235105cd48cd4e19e8b4fd8e9701e5a7a0f6f.tar.gz
rust-e17235105cd48cd4e19e8b4fd8e9701e5a7a0f6f.zip
Auto merge of #115825 - cjgillot:expr-field-lint, r=compiler-errors
Visit ExprField for lint levels.

Fixes https://github.com/rust-lang/rust/issues/115823
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/expr-field.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/lint/expr-field.rs b/tests/ui/lint/expr-field.rs
new file mode 100644
index 00000000000..638fbf521c4
--- /dev/null
+++ b/tests/ui/lint/expr-field.rs
@@ -0,0 +1,15 @@
+// check-pass
+
+pub struct A {
+    pub x: u32,
+}
+
+#[deny(unused_comparisons)]
+pub fn foo(y: u32) -> A {
+    A {
+        #[allow(unused_comparisons)]
+        x: if y < 0 { 1 } else { 2 },
+    }
+}
+
+fn main() {}