about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJana Dönszelmann <jana@donsz.nl>2025-10-01 16:11:21 +0200
committerJana Dönszelmann <jana@donsz.nl>2025-10-01 16:11:59 +0200
commit96fb1b3b559ccc8ed051c95fa5385f9ba4030a01 (patch)
treea12498d082c0dd8167fd3669a38057c1bf07fb48
parent422f6bb7420e1f1fe1cd920ed0c6b22f5042ae35 (diff)
downloadrust-96fb1b3b559ccc8ed051c95fa5385f9ba4030a01.tar.gz
rust-96fb1b3b559ccc8ed051c95fa5385f9ba4030a01.zip
include outer_inclusive_binder of pattern types
-rw-r--r--compiler/rustc_type_ir/src/flags.rs1
-rw-r--r--tests/ui/type/pattern_types/transmute.next.stderr21
2 files changed, 22 insertions, 0 deletions
diff --git a/compiler/rustc_type_ir/src/flags.rs b/compiler/rustc_type_ir/src/flags.rs
index 24704c5bb53..ea3903d401e 100644
--- a/compiler/rustc_type_ir/src/flags.rs
+++ b/compiler/rustc_type_ir/src/flags.rs
@@ -347,6 +347,7 @@ impl<I: Interner> FlagComputation<I> {
 
     fn add_ty_pat(&mut self, pat: <I as Interner>::Pat) {
         self.add_flags(pat.flags());
+        self.add_exclusive_binder(pat.outer_exclusive_binder());
     }
 
     fn add_predicate(&mut self, binder: ty::Binder<I, ty::PredicateKind<I>>) {
diff --git a/tests/ui/type/pattern_types/transmute.next.stderr b/tests/ui/type/pattern_types/transmute.next.stderr
new file mode 100644
index 00000000000..edec542e5e1
--- /dev/null
+++ b/tests/ui/type/pattern_types/transmute.next.stderr
@@ -0,0 +1,21 @@
+error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
+  --> $DIR/transmute.rs:23:14
+   |
+LL |     unsafe { std::mem::transmute(x) }
+   |              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: source type: `Option<(u32) is S..=E>` (size can vary because of u32)
+   = note: target type: `u32` (32 bits)
+
+error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
+  --> $DIR/transmute.rs:31:14
+   |
+LL |     unsafe { std::mem::transmute(x) }
+   |              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: source type: `Option<(u32) is S..=E>` (size can vary because of u32)
+   = note: target type: `Option<u32>` (64 bits)
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0512`.