mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 13:04:42 +00:00 
			
		
		
		
	 f472cc8cd4
			
		
	
	
		f472cc8cd4
		
			
		
	
	
	
	
		
			
			the `no_mangle`, `link_section` and `export_name` attributes are exceptions, and can still be used without an unsafe in earlier editions
		
			
				
	
	
		
			16 lines
		
	
	
		
			340 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			340 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ compile-flags: -C no-prepopulate-passes
 | |
| #![crate_type = "lib"]
 | |
| #![feature(ffi_const)]
 | |
| 
 | |
| pub fn bar() {
 | |
|     unsafe { foo() }
 | |
| }
 | |
| 
 | |
| extern "C" {
 | |
|     // CHECK-LABEL: declare{{.*}}void @foo()
 | |
|     // CHECK-SAME: [[ATTRS:#[0-9]+]]
 | |
|     // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}memory(none){{.*}} }
 | |
|     #[unsafe(ffi_const)]
 | |
|     pub fn foo();
 | |
| }
 |