diff --git a/tests/ui/decl_safety/safe_trait-negative_impl_mismatch.stderr b/tests/ui/decl_safety/safe_trait-negative_impl_mismatch.stderr new file mode 100644 index 00000000..00127498 --- /dev/null +++ b/tests/ui/decl_safety/safe_trait-negative_impl_mismatch.stderr @@ -0,0 +1,4 @@ +Error: check_neg_trait_impl(unsafe impl ! Foo for u32 {}) + +Caused by: + negative impls cannot be unsafe diff --git "a/tests/ui/decl_safety/safe_trait-negative_impl_mismatch.\360\237\224\254" "b/tests/ui/decl_safety/safe_trait-negative_impl_mismatch.\360\237\224\254" new file mode 100644 index 00000000..cad4149a --- /dev/null +++ "b/tests/ui/decl_safety/safe_trait-negative_impl_mismatch.\360\237\224\254" @@ -0,0 +1,6 @@ +[ + crate baguette { + trait Foo {} + unsafe impl !Foo for u32 {} + } +] diff --git "a/tests/ui/decl_safety/unsafe_trait-negative_impl.\360\237\224\254" "b/tests/ui/decl_safety/unsafe_trait-negative_impl.\360\237\224\254" new file mode 100644 index 00000000..a1fdf102 --- /dev/null +++ "b/tests/ui/decl_safety/unsafe_trait-negative_impl.\360\237\224\254" @@ -0,0 +1,7 @@ +//@check-pass +[ + crate baguette { + unsafe trait Foo {} + impl !Foo for u32 {} + } +] diff --git a/tests/ui/decl_safety/unsafe_trait-negative_impl_mismatch.stderr b/tests/ui/decl_safety/unsafe_trait-negative_impl_mismatch.stderr new file mode 100644 index 00000000..00127498 --- /dev/null +++ b/tests/ui/decl_safety/unsafe_trait-negative_impl_mismatch.stderr @@ -0,0 +1,4 @@ +Error: check_neg_trait_impl(unsafe impl ! Foo for u32 {}) + +Caused by: + negative impls cannot be unsafe diff --git "a/tests/ui/decl_safety/unsafe_trait-negative_impl_mismatch.\360\237\224\254" "b/tests/ui/decl_safety/unsafe_trait-negative_impl_mismatch.\360\237\224\254" new file mode 100644 index 00000000..2ba98a14 --- /dev/null +++ "b/tests/ui/decl_safety/unsafe_trait-negative_impl_mismatch.\360\237\224\254" @@ -0,0 +1,6 @@ +[ + crate baguette { + unsafe trait Foo {} + unsafe impl !Foo for u32 {} + } +]