1
Fork 0
rust/src/test/codegen/ffi-const.rs
Matthias Schiffer a7d7f0bbe9 Add tests for #[ffi_const] and #[ffi_pure] function attributes
Based on the work of gnzlbg <gonzalobg88@gmail.com>.
2020-05-20 01:16:11 +02:00

12 lines
310 B
Rust

// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(ffi_const)]
pub fn bar() { unsafe { foo() } }
extern {
// CHECK-LABEL: declare void @foo()
// CHECK-SAME: [[ATTRS:#[0-9]+]]
// CHECK-DAG: attributes [[ATTRS]] = { {{.*}}readnone{{.*}} }
#[ffi_const] pub fn foo();
}