Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from dtolnay/currentcrate
Enforce ref_cast_custom used from same crate as corresponding RefCastCustom
- Loading branch information
Showing
9 changed files
with
100 additions
and
6 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
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,12 @@ | ||
[package] | ||
name = "ref-cast-test-suite" | ||
authors = ["David Tolnay <dtolnay@gmail.com>"] | ||
version = "0.0.0" | ||
edition = "2018" | ||
publish = false | ||
|
||
[lib] | ||
path = "lib.rs" | ||
|
||
[dependencies] | ||
ref-cast = "1" |
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,5 @@ | ||
use ref_cast::RefCastCustom; | ||
|
||
#[derive(RefCastCustom)] | ||
#[repr(transparent)] | ||
pub struct Struct(str); |
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,10 @@ | ||
use ref_cast::ref_cast_custom; | ||
use ref_cast_test_suite::Struct; | ||
|
||
#[ref_cast_custom] | ||
fn ref_cast(s: &str) -> &Struct; | ||
|
||
#[ref_cast_custom] | ||
fn ref_cast_mut(s: &mut str) -> &mut Struct; | ||
|
||
fn main() {} |
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,11 @@ | ||
error[E0639]: cannot create non-exhaustive struct using struct expression | ||
--> tests/ui/cross-crate.rs:5:32 | ||
| | ||
5 | fn ref_cast(s: &str) -> &Struct; | ||
| ^ | ||
|
||
error[E0639]: cannot create non-exhaustive struct using struct expression | ||
--> tests/ui/cross-crate.rs:8:44 | ||
| | ||
8 | fn ref_cast_mut(s: &mut str) -> &mut Struct; | ||
| ^ |
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