mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	Collect all unreachable fields in a single struct literal struct and emit a single error, instead of one error per private field.
```
error[E0451]: fields `beta` and `gamma` of struct `Alpha` are private
  --> $DIR/visibility.rs:18:13
   |
LL |     let _x = Alpha {
   |              ----- in this type
LL |         beta: 0,
   |         ^^^^^^^ private field
LL |         ..
   |         ^^ field `gamma` is private
```
		
	
			
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
privacy_field_is_private =
 | 
						|
    {$len ->
 | 
						|
        [1] field
 | 
						|
        *[other] fields
 | 
						|
    } {$field_names} of {$variant_descr} `{$def_path_str}` {$len ->
 | 
						|
        [1] is
 | 
						|
        *[other] are
 | 
						|
    } private
 | 
						|
    .label = in this type
 | 
						|
privacy_field_is_private_is_update_syntax_label = {$rest_len ->
 | 
						|
        [1] field
 | 
						|
        *[other] fields
 | 
						|
    } {$rest_field_names} {$rest_len ->
 | 
						|
        [1] is
 | 
						|
        *[other] are
 | 
						|
    } private
 | 
						|
privacy_field_is_private_label = private field
 | 
						|
 | 
						|
privacy_from_private_dep_in_public_interface =
 | 
						|
    {$kind} `{$descr}` from private dependency '{$krate}' in public interface
 | 
						|
 | 
						|
privacy_in_public_interface = {$vis_descr} {$kind} `{$descr}` in public interface
 | 
						|
    .label = can't leak {$vis_descr} {$kind}
 | 
						|
    .visibility_label = `{$descr}` declared as {$vis_descr}
 | 
						|
 | 
						|
privacy_item_is_private = {$kind} `{$descr}` is private
 | 
						|
    .label = private {$kind}
 | 
						|
 | 
						|
privacy_private_interface_or_bounds_lint = {$ty_kind} `{$ty_descr}` is more private than the item `{$item_descr}`
 | 
						|
    .item_label = {$item_kind} `{$item_descr}` is reachable at visibility `{$item_vis_descr}`
 | 
						|
    .ty_note = but {$ty_kind} `{$ty_descr}` is only usable at visibility `{$ty_vis_descr}`
 | 
						|
 | 
						|
privacy_report_effective_visibility = {$descr}
 | 
						|
 | 
						|
privacy_unnameable_types_lint = {$kind} `{$descr}` is reachable but cannot be named
 | 
						|
    .label = reachable at visibility `{$reachable_vis}`, but can only be named at visibility `{$reexported_vis}`
 | 
						|
 | 
						|
privacy_unnamed_item_is_private = {$kind} is private
 | 
						|
    .label = private {$kind}
 |