Skip to content

Commit 2244cbe

Browse files
committed
analyze: add tests/filecheck/test_attrs.rs
1 parent 856ff5e commit 2244cbe

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

c2rust-analyze/tests/filecheck.rs

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ define_tests! {
5454
offset2,
5555
ptrptr1,
5656
statics,
57+
test_attrs,
5758
trivial,
5859
type_annotation_rewrite,
5960
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#![feature(register_tool)]
2+
#![register_tool(c2rust_analyze_test)]
3+
4+
// CHECK-LABEL: type assignment for "f":
5+
// CHECK: _0 ({{.*}}: *mut i32): *mut i32
6+
// CHECK: _1 ({{.*}}: x): *mut i32
7+
#[c2rust_analyze_test::fixed_signature]
8+
fn f(x: *mut i32) -> *mut i32 {
9+
x
10+
}
11+
12+
// CHECK-LABEL: type assignment for "g":
13+
// CHECK: _0 ({{.*}}: *mut i32): &i32
14+
// CHECK: _1 ({{.*}}: x): &i32
15+
#[c2rust_analyze_test::skip_rewrite]
16+
fn g(x: *mut i32) -> *mut i32 {
17+
x
18+
}
19+
20+
// CHECK: analysis of DefId({{.*}} ~ test_attrs[{{.*}}]::h) failed: [unknown]: explicit fail_analysis for testing
21+
#[c2rust_analyze_test::fail_analysis]
22+
fn h(x: *mut i32) -> *mut i32 {
23+
x
24+
}

0 commit comments

Comments
 (0)