diff options
| author | Oneirical <manchot@videotron.ca> | 2025-07-13 15:56:27 -0400 |
|---|---|---|
| committer | Oneirical <manchot@videotron.ca> | 2025-07-24 17:01:44 -0400 |
| commit | a924d44115b632775ef0d2e12382e285953b0c2c (patch) | |
| tree | 4cb6005288fc4a7407006094892fcf577f3f30cf /tests/ui/transmutability | |
| parent | 246733a3d978de41c5b77b8120ba8f41592df9f1 (diff) | |
| download | rust-a924d44115b632775ef0d2e12382e285953b0c2c.tar.gz rust-a924d44115b632775ef0d2e12382e285953b0c2c.zip | |
Rehome tests/ui/issues/ tests [1/?]
Diffstat (limited to 'tests/ui/transmutability')
| -rw-r--r-- | tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.rs | 13 | ||||
| -rw-r--r-- | tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.stderr | 12 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.rs b/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.rs new file mode 100644 index 00000000000..22cb379ffda --- /dev/null +++ b/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.rs @@ -0,0 +1,13 @@ +trait Trait<'a> { + type A; + type B; +} + +fn foo<'a, T: Trait<'a>>(value: T::A) { + let new: T::B = unsafe { std::mem::transmute(value) }; +//~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types +} + +fn main() { } + +// https://github.com/rust-lang/rust/issues/21174 diff --git a/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.stderr b/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.stderr new file mode 100644 index 00000000000..5c0cd91cee1 --- /dev/null +++ b/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.stderr @@ -0,0 +1,12 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-between-associated-types-with-lifetimers-21174.rs:7:30 + | +LL | let new: T::B = unsafe { std::mem::transmute(value) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `<T as Trait<'_>>::A` (this type does not have a fixed size) + = note: target type: `<T as Trait<'_>>::B` (this type does not have a fixed size) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0512`. |
