mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-10-31 03:54:42 +00:00 
			
		
		
		
	fix: Apply adjusts to pats and exprs when doing pat analysis
This commit is contained in:
		
							parent
							
								
									8b45a73551
								
							
						
					
					
						commit
						e587367b4d
					
				
					 4 changed files with 95 additions and 49 deletions
				
			
		|  | @ -441,7 +441,7 @@ impl<'db> SourceAnalyzer<'db> { | |||
|     ) -> Option<GenericSubstitution<'db>> { | ||||
|         let body = self.store()?; | ||||
|         if let Expr::Field { expr: object_expr, name: _ } = body[field_expr] { | ||||
|             let (adt, subst) = type_of_expr_including_adjust(infer, object_expr)?.as_adt()?; | ||||
|             let (adt, subst) = infer.type_of_expr_with_adjust(object_expr)?.as_adt()?; | ||||
|             return Some(GenericSubstitution::new( | ||||
|                 adt.into(), | ||||
|                 subst.clone(), | ||||
|  | @ -1780,10 +1780,3 @@ pub(crate) fn name_hygiene(db: &dyn HirDatabase, name: InFile<&SyntaxNode>) -> H | |||
|     let ctx = span_map.span_at(name.value.text_range().start()).ctx; | ||||
|     HygieneId::new(ctx.opaque_and_semitransparent(db)) | ||||
| } | ||||
| 
 | ||||
| fn type_of_expr_including_adjust(infer: &InferenceResult, id: ExprId) -> Option<&Ty> { | ||||
|     match infer.expr_adjustment(id).and_then(|adjustments| adjustments.last()) { | ||||
|         Some(adjustment) => Some(&adjustment.target), | ||||
|         None => Some(&infer[id]), | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Shoyu Vanilla
						Shoyu Vanilla