-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This macro is like the existing `transmute!`, but it transmutes immutable references rather than values. Issue #159
- Loading branch information
Showing
81 changed files
with
2,286 additions
and
4 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
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-ref-alignment-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-ref-alignment-increase.rs:15:35 | ||
| | ||
15 | const INCREASE_ALIGNMENT: &AU16 = transmute_ref!(&[0u8; 2]); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `MaxAlignsOf<[u8; 2], AU16>` (16 bits) | ||
= note: target type: `AlignOf<[u8; 2]>` (8 bits) | ||
= note: this error originates in the macro `transmute_ref` (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-ref-dst-mutable.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,29 @@ | ||
error[E0308]: mismatched types | ||
--> tests/ui-msrv/transmute-ref-dst-mutable.rs:14:22 | ||
| | ||
14 | let _: &mut u8 = transmute_ref!(&0u8); | ||
| ^^^^^^^^^^^^^^^^^^^^ types differ in mutability | ||
| | ||
= note: expected mutable reference `&mut u8` | ||
found reference `&_` | ||
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0308]: mismatched types | ||
--> tests/ui-msrv/transmute-ref-dst-mutable.rs:14:22 | ||
| | ||
14 | let _: &mut u8 = transmute_ref!(&0u8); | ||
| ^^^^^^^^^^^^^^^^^^^^ types differ in mutability | ||
| | ||
= note: expected mutable reference `&mut u8` | ||
found reference `&_` | ||
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0308]: mismatched types | ||
--> tests/ui-msrv/transmute-ref-dst-mutable.rs:14:22 | ||
| | ||
14 | let _: &mut u8 = transmute_ref!(&0u8); | ||
| ^^^^^^^^^^^^^^^^^^^^ types differ in mutability | ||
| | ||
= note: expected mutable reference `&mut u8` | ||
found reference `&_` | ||
= note: this error originates in the macro `transmute_ref` (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-ref-dst-not-a-reference.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,29 @@ | ||
error[E0308]: mismatched types | ||
--> tests/ui-msrv/transmute-ref-dst-not-a-reference.rs:13:36 | ||
| | ||
13 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); | ||
| ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | ||
| | ||
= note: expected type `usize` | ||
found reference `&_` | ||
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0308]: mismatched types | ||
--> tests/ui-msrv/transmute-ref-dst-not-a-reference.rs:13:36 | ||
| | ||
13 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); | ||
| ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | ||
| | ||
= note: expected type `usize` | ||
found reference `&_` | ||
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0308]: mismatched types | ||
--> tests/ui-msrv/transmute-ref-dst-not-a-reference.rs:13:36 | ||
| | ||
13 | const DST_NOT_A_REFERENCE: usize = transmute_ref!(&0u8); | ||
| ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference | ||
| | ||
= note: expected type `usize` | ||
found reference `&_` | ||
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) |
Oops, something went wrong.