-
Notifications
You must be signed in to change notification settings - Fork 160
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 #675 from Veykril/veykril/push-xsrukmlqwrlm
Introduce `RefUnwindSafe` `StorageHandle`
- Loading branch information
Showing
4 changed files
with
135 additions
and
70 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,50 @@ | ||
//! Test that auto trait impls exist as expected. | ||
use std::panic::UnwindSafe; | ||
|
||
use salsa::Database; | ||
use test_log::test; | ||
|
||
#[salsa::input] | ||
struct MyInput { | ||
field: String, | ||
} | ||
|
||
#[salsa::tracked] | ||
struct MyTracked<'db> { | ||
field: MyInterned<'db>, | ||
} | ||
|
||
#[salsa::interned] | ||
struct MyInterned<'db> { | ||
field: String, | ||
} | ||
|
||
#[salsa::tracked] | ||
fn test(db: &dyn Database, input: MyInput) { | ||
let input = is_send(is_sync(input)); | ||
let interned = is_send(is_sync(MyInterned::new(db, input.field(db).clone()))); | ||
let _tracked_struct = is_send(is_sync(MyTracked::new(db, interned))); | ||
} | ||
|
||
fn is_send<T: Send>(t: T) -> T { | ||
t | ||
} | ||
|
||
fn is_sync<T: Send>(t: T) -> T { | ||
t | ||
} | ||
|
||
fn is_unwind_safe<T: UnwindSafe>(t: T) -> T { | ||
t | ||
} | ||
|
||
#[test] | ||
fn execute() { | ||
let db = is_send(salsa::DatabaseImpl::new()); | ||
let _handle = is_send(is_sync(is_unwind_safe( | ||
db.storage().clone().into_zalsa_handle(), | ||
))); | ||
let input = MyInput::new(&db, "Hello".to_string()); | ||
test(&db, input); | ||
} |
This file was deleted.
Oops, something went wrong.