Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/object_safety/tests.rs')
| -rw-r--r-- | crates/hir-ty/src/object_safety/tests.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/hir-ty/src/object_safety/tests.rs b/crates/hir-ty/src/object_safety/tests.rs index 585313e5b9..3dc08c4619 100644 --- a/crates/hir-ty/src/object_safety/tests.rs +++ b/crates/hir-ty/src/object_safety/tests.rs @@ -361,3 +361,20 @@ pub trait Trait { [("Trait", vec![])], ); } + +#[test] +fn std_error_is_object_safe() { + check_object_safety( + r#" +//- minicore: fmt, dispatch_from_dyn +trait Erased<'a>: 'a {} + +pub struct Request<'a>(dyn Erased<'a> + 'a); + +pub trait Error: core::fmt::Debug + core::fmt::Display { + fn provide<'a>(&'a self, request: &mut Request<'a>); +} +"#, + [("Error", vec![])], + ); +} |