]> git.lizzy.rs Git - rust.git/blob - tests/ui/statics/static-function-pointer-xc.rs
Rollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnr
[rust.git] / tests / ui / statics / static-function-pointer-xc.rs
1 // run-pass
2 // aux-build:static-function-pointer-aux.rs
3
4 extern crate static_function_pointer_aux as aux;
5
6 fn f(x: isize) -> isize { x }
7
8 pub fn main() {
9     assert_eq!(aux::F(42), -42);
10     unsafe {
11         assert_eq!(aux::MutF(42), -42);
12         aux::MutF = f;
13         assert_eq!(aux::MutF(42), 42);
14         aux::MutF = aux::f;
15         assert_eq!(aux::MutF(42), -42);
16     }
17 }