mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			531 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			531 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ aux-build:struct_field_privacy.rs
 | |
| 
 | |
| extern crate struct_field_privacy as xc;
 | |
| 
 | |
| use xc::B;
 | |
| 
 | |
| struct A {
 | |
|     pub a: u32,
 | |
|     b: u32,
 | |
| }
 | |
| 
 | |
| fn main () {
 | |
|     // external crate struct
 | |
|     let k = B {
 | |
|         aa: 20,
 | |
|         //~^ ERROR struct `B` has no field named `aa`
 | |
|         bb: 20,
 | |
|         //~^ ERROR struct `B` has no field named `bb`
 | |
|     };
 | |
|     // local crate struct
 | |
|     let l = A {
 | |
|         aa: 20,
 | |
|         //~^ ERROR struct `A` has no field named `aa`
 | |
|         bb: 20,
 | |
|         //~^ ERROR struct `A` has no field named `bb`
 | |
|     };
 | |
| }
 | 
