Skip to content

Commit

Permalink
add tests for safe/unsafe negative impls
Browse files Browse the repository at this point in the history
  • Loading branch information
lqd committed Nov 11, 2023
1 parent 519e4da commit 5ba1052
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/ui/decl_safety/safe_trait-negative_impl_mismatch.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Error: check_neg_trait_impl(unsafe impl ! Foo for u32 {})

Caused by:
negative impls cannot be unsafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
crate baguette {
trait Foo {}
unsafe impl !Foo for u32 {}
}
]
7 changes: 7 additions & 0 deletions tests/ui/decl_safety/unsafe_trait-negative_impl.πŸ”¬
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@check-pass
[
crate baguette {
unsafe trait Foo {}
impl !Foo for u32 {}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Error: check_neg_trait_impl(unsafe impl ! Foo for u32 {})

Caused by:
negative impls cannot be unsafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
crate baguette {
unsafe trait Foo {}
unsafe impl !Foo for u32 {}
}
]

0 comments on commit 5ba1052

Please sign in to comment.