Skip to content

Commit f562ada

Browse files
committed
add decl safety tests
1 parent 866b4da commit f562ada

File tree

6 files changed

+34
-0
lines changed

6 files changed

+34
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@check-pass
2+
[
3+
crate baguette {
4+
safe trait Foo {}
5+
safe impl Foo for u32 {}
6+
}
7+
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Error: check_trait_impl(unsafe impl Foo for u32 { })
2+
3+
Caused by:
4+
implementing the trait `Foo` is not unsafe
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
crate baguette {
3+
trait Foo {}
4+
unsafe impl Foo for u32 {}
5+
}
6+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@check-pass
2+
[
3+
crate baguette {
4+
unsafe trait Foo {}
5+
unsafe impl Foo for u32 {}
6+
}
7+
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Error: check_trait_impl(impl Foo for u32 { })
2+
3+
Caused by:
4+
the trait `Foo` requires an `unsafe impl` declaration
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
crate baguette {
3+
unsafe trait Foo {}
4+
impl Foo for u32 {}
5+
}
6+
]

0 commit comments

Comments
Β (0)