mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-10-31 12:04:43 +00:00 
			
		
		
		
	Merge pull request #19413 from ShoyuVanilla/issue-19399
fix: Properly calculate the layouts of tuple ptrs whose last fields are DST
This commit is contained in:
		
						commit
						dab1329f35
					
				
					 2 changed files with 19 additions and 0 deletions
				
			
		|  | @ -388,6 +388,15 @@ fn struct_tail_erasing_lifetimes(db: &dyn HirDatabase, pointee: Ty) -> Ty { | ||||||
|                 None => pointee, |                 None => pointee, | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         TyKind::Tuple(_, subst) => { | ||||||
|  |             if let Some(last_field_ty) = | ||||||
|  |                 subst.iter(Interner).last().and_then(|arg| arg.ty(Interner)) | ||||||
|  |             { | ||||||
|  |                 struct_tail_erasing_lifetimes(db, last_field_ty.clone()) | ||||||
|  |             } else { | ||||||
|  |                 pointee | ||||||
|  |             } | ||||||
|  |         } | ||||||
|         _ => pointee, |         _ => pointee, | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -468,6 +468,16 @@ fn tuple() { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | #[test] | ||||||
|  | fn tuple_ptr_with_dst_tail() { | ||||||
|  |     size_and_align!( | ||||||
|  |         struct Goal(*const ([u8],)); | ||||||
|  |     ); | ||||||
|  |     size_and_align!( | ||||||
|  |         struct Goal(*const (u128, [u8])); | ||||||
|  |     ); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| #[test] | #[test] | ||||||
| fn non_zero_and_non_null() { | fn non_zero_and_non_null() { | ||||||
|     size_and_align! { |     size_and_align! { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Wirth
						Lukas Wirth