about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2023-12-24 22:49:07 +0100
committerNadrieril <nadrieril+git@gmail.com>2023-12-26 09:45:54 +0100
commitd5b2d88a1aa4c0832c54415a78b7c8905926d6f7 (patch)
tree60ab51b7028eaf5008185ce246b2835d241f11cb /tests
parentf6456285ddca7db0ffc663d02d9ecaf22d1f0d82 (diff)
downloadrust-d5b2d88a1aa4c0832c54415a78b7c8905926d6f7.tar.gz
rust-d5b2d88a1aa4c0832c54415a78b7c8905926d6f7.zip
Don't drop a hir node after lowering
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.rs10
-rw-r--r--tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.stderr27
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.rs b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.rs
new file mode 100644
index 00000000000..2490909b6a5
--- /dev/null
+++ b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.rs
@@ -0,0 +1,10 @@
+fn main() {}
+
+fn attr_in_guard() {
+    match None::<u32> {
+        Some(!) //~ ERROR `!` patterns are experimental
+            if #[deny(unused_mut)] //~ ERROR attributes on expressions are experimental
+            false //~ ERROR a guard on a never pattern will never be run
+    }
+    match false {}
+}
diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.stderr
new file mode 100644
index 00000000000..335e6c6db5f
--- /dev/null
+++ b/tests/ui/rfcs/rfc-0000-never_patterns/ICE-119271-never-arm-attr-in-guard.stderr
@@ -0,0 +1,27 @@
+error[E0658]: attributes on expressions are experimental
+  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:6:16
+   |
+LL |             if #[deny(unused_mut)]
+   |                ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
+   = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
+
+error[E0658]: `!` patterns are experimental
+  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:5:14
+   |
+LL |         Some(!)
+   |              ^
+   |
+   = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
+   = help: add `#![feature(never_patterns)]` to the crate attributes to enable
+
+error: a guard on a never pattern will never be run
+  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:7:13
+   |
+LL |             false
+   |             ^^^^^ help: remove this guard
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.