forked from google/zerocopy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] add
transmute!
UI tests (google#456)
These tests are split into distinct files, so that changes to `transmute!` can be more easily carefully and incrementally reviewed.
- Loading branch information
1 parent
fd33ad0
commit 682ecbe
Showing
36 changed files
with
293 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-dst-not-frombytes.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-dst-not-frombytes.rs:14:41 | ||
| | ||
14 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | ||
| | ||
note: required by a bound in `DST_NOT_FROM_BYTES::transmute` | ||
--> tests/ui-msrv/transmute-dst-not-frombytes.rs:14:41 | ||
| | ||
14 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `DST_NOT_FROM_BYTES::transmute` | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-ptr-to-usize.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-ptr-to-usize.rs:16:30 | ||
| | ||
16 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `*const usize` | ||
| | ||
= help: the following implementations were found: | ||
<usize as AsBytes> | ||
<f32 as AsBytes> | ||
<f64 as AsBytes> | ||
<i128 as AsBytes> | ||
and $N others | ||
note: required by a bound in `POINTER_VALUE::transmute` | ||
--> tests/ui-msrv/transmute-ptr-to-usize.rs:16:30 | ||
| | ||
16 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `POINTER_VALUE::transmute` | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-size-decrease.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-msrv/transmute-size-decrease.rs:15:27 | ||
| | ||
15 | const DECREASE_SIZE: u8 = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `AU16` (16 bits) | ||
= note: target type: `u8` (8 bits) | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-size-increase.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-msrv/transmute-size-increase.rs:15:29 | ||
| | ||
15 | const INCREASE_SIZE: AU16 = transmute!(0u8); | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `u8` (8 bits) | ||
= note: target type: `AU16` (16 bits) | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-src-not-asbytes.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-src-not-asbytes.rs:14:32 | ||
| | ||
14 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>` | ||
| | ||
note: required by a bound in `SRC_NOT_AS_BYTES::transmute` | ||
--> tests/ui-msrv/transmute-src-not-asbytes.rs:14:32 | ||
| | ||
14 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `SRC_NOT_AS_BYTES::transmute` | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2022 The Fuchsia Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
include!("../../zerocopy-derive/tests/util.rs"); | ||
|
||
extern crate zerocopy; | ||
|
||
use zerocopy::transmute; | ||
|
||
fn main() {} | ||
|
||
// `transmute` requires that the destination type implements `FromBytes` | ||
const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied | ||
--> tests/ui-nightly/transmute-dst-not-frombytes.rs:14:41 | ||
| | ||
14 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | ||
| | ||
= help: the following other types implement trait `FromBytes`: | ||
() | ||
AU16 | ||
F32<O> | ||
F64<O> | ||
I128<O> | ||
I16<O> | ||
I32<O> | ||
I64<O> | ||
and $N others | ||
note: required by a bound in `DST_NOT_FROM_BYTES::transmute` | ||
--> tests/ui-nightly/transmute-dst-not-frombytes.rs:14:41 | ||
| | ||
14 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2022 The Fuchsia Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
extern crate zerocopy; | ||
|
||
use zerocopy::transmute; | ||
|
||
fn main() {} | ||
|
||
// It is unclear whether we can or should support this transmutation, especially | ||
// in a const context. This test ensures that even if such a transmutation | ||
// becomes valid due to the requisite implementations of `FromBytes` being | ||
// added, that we re-examine whether it should specifically be valid in a const | ||
// context. | ||
const POINTER_VALUE: usize = transmute!(&0usize as *const usize); |
14 changes: 7 additions & 7 deletions
14
tests/ui-stable/transmute-illegal.stderr → .../ui-nightly/transmute-ptr-to-usize.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied | ||
--> tests/ui-stable/transmute-illegal.rs:10:30 | ||
--> tests/ui-nightly/transmute-ptr-to-usize.rs:16:30 | ||
| | ||
10 | const POINTER_VALUE: usize = zerocopy::transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
16 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| the trait `AsBytes` is not implemented for `*const usize` | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `AsBytes` is implemented for `usize` | ||
note: required by a bound in `POINTER_VALUE::transmute` | ||
--> tests/ui-stable/transmute-illegal.rs:10:30 | ||
--> tests/ui-nightly/transmute-ptr-to-usize.rs:16:30 | ||
| | ||
10 | const POINTER_VALUE: usize = zerocopy::transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` | ||
= note: this error originates in the macro `zerocopy::transmute` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
16 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2022 The Fuchsia Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
include!("../../zerocopy-derive/tests/util.rs"); | ||
|
||
extern crate zerocopy; | ||
|
||
use zerocopy::transmute; | ||
|
||
fn main() {} | ||
|
||
// Although this is not a soundness requirement, we currently require that the | ||
// size of the destination type is not smaller than the size of the source type. | ||
const DECREASE_SIZE: u8 = transmute!(AU16(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-nightly/transmute-size-decrease.rs:15:27 | ||
| | ||
15 | const DECREASE_SIZE: u8 = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `AU16` (16 bits) | ||
= note: target type: `u8` (8 bits) | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2022 The Fuchsia Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
include!("../../zerocopy-derive/tests/util.rs"); | ||
|
||
extern crate zerocopy; | ||
|
||
use zerocopy::transmute; | ||
|
||
fn main() {} | ||
|
||
// Although this is not a soundness requirement, we currently require that the | ||
// size of the destination type is not larger than the size of the source type. | ||
const INCREASE_SIZE: AU16 = transmute!(0u8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-nightly/transmute-size-increase.rs:15:29 | ||
| | ||
15 | const INCREASE_SIZE: AU16 = transmute!(0u8); | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `u8` (8 bits) | ||
= note: target type: `AU16` (16 bits) | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2022 The Fuchsia Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
include!("../../zerocopy-derive/tests/util.rs"); | ||
|
||
extern crate zerocopy; | ||
|
||
use zerocopy::transmute; | ||
|
||
fn main() {} | ||
|
||
// `transmute` requires that the source type implements `AsBytes` | ||
const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied | ||
--> tests/ui-nightly/transmute-src-not-asbytes.rs:14:32 | ||
| | ||
14 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| the trait `AsBytes` is not implemented for `NotZerocopy<AU16>` | ||
| required by a bound introduced by this call | ||
| | ||
= help: the following other types implement trait `AsBytes`: | ||
() | ||
AU16 | ||
F32<O> | ||
F64<O> | ||
I128<O> | ||
I16<O> | ||
I32<O> | ||
I64<O> | ||
and $N others | ||
note: required by a bound in `SRC_NOT_AS_BYTES::transmute` | ||
--> tests/ui-nightly/transmute-src-not-asbytes.rs:14:32 | ||
| | ||
14 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-dst-not-frombytes.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied | ||
--> tests/ui-stable/transmute-dst-not-frombytes.rs:14:41 | ||
| | ||
14 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | ||
| | ||
= help: the following other types implement trait `FromBytes`: | ||
() | ||
AU16 | ||
F32<O> | ||
F64<O> | ||
I128<O> | ||
I16<O> | ||
I32<O> | ||
I64<O> | ||
and $N others | ||
note: required by a bound in `DST_NOT_FROM_BYTES::transmute` | ||
--> tests/ui-stable/transmute-dst-not-frombytes.rs:14:41 | ||
| | ||
14 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-ptr-to-usize.rs |
14 changes: 7 additions & 7 deletions
14
tests/ui-nightly/transmute-illegal.stderr → ...s/ui-stable/transmute-ptr-to-usize.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied | ||
--> tests/ui-nightly/transmute-illegal.rs:10:30 | ||
--> tests/ui-stable/transmute-ptr-to-usize.rs:16:30 | ||
| | ||
10 | const POINTER_VALUE: usize = zerocopy::transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
16 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| the trait `AsBytes` is not implemented for `*const usize` | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `AsBytes` is implemented for `usize` | ||
note: required by a bound in `POINTER_VALUE::transmute` | ||
--> tests/ui-nightly/transmute-illegal.rs:10:30 | ||
--> tests/ui-stable/transmute-ptr-to-usize.rs:16:30 | ||
| | ||
10 | const POINTER_VALUE: usize = zerocopy::transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` | ||
= note: this error originates in the macro `zerocopy::transmute` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
16 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-size-decrease.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-stable/transmute-size-decrease.rs:15:27 | ||
| | ||
15 | const DECREASE_SIZE: u8 = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `AU16` (16 bits) | ||
= note: target type: `u8` (8 bits) | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-size-increase.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-stable/transmute-size-increase.rs:15:29 | ||
| | ||
15 | const INCREASE_SIZE: AU16 = transmute!(0u8); | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `u8` (8 bits) | ||
= note: target type: `AU16` (16 bits) | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ui-nightly/transmute-src-not-asbytes.rs |
Oops, something went wrong.