diff options
| author | bors <bors@rust-lang.org> | 2024-01-26 18:53:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-26 18:53:03 +0000 |
| commit | 596e5c77cf5b2b660b3ac2ce732fa0596c246d9b (patch) | |
| tree | 43c4ea98911eaefae8fd8adbf965b1550c4d1520 | |
| parent | f09020567e2acd5bf9e0a489361161099defbab3 (diff) | |
| parent | 8f05e7ce558ff83c1a42ebe8e85b2f65a84413d2 (diff) | |
| download | rust-596e5c77cf5b2b660b3ac2ce732fa0596c246d9b.tar.gz rust-596e5c77cf5b2b660b3ac2ce732fa0596c246d9b.zip | |
Auto merge of #16431 - Ar4ys:fix-E0107-error-range-in-proc-macro, r=Veykril
Replaced adjusted_display_range with adjusted_display_range_new in mismatched_arg_count For detailed description - see related issue. Fixes: #16407
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs b/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs index 5e950ecb0d1..e75d8973728 100644 --- a/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs +++ b/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs @@ -3,10 +3,10 @@ use hir::InFile; use ide_db::base_db::FileRange; use syntax::{ ast::{self, HasArgList}, - AstNode, SyntaxNodePtr, + AstNode, AstPtr, }; -use crate::{adjusted_display_range, Diagnostic, DiagnosticCode, DiagnosticsContext}; +use crate::{adjusted_display_range_new, Diagnostic, DiagnosticCode, DiagnosticsContext}; // Diagnostic: mismatched-tuple-struct-pat-arg-count // @@ -24,7 +24,7 @@ pub(crate) fn mismatched_tuple_struct_pat_arg_count( Diagnostic::new( DiagnosticCode::RustcHardError("E0023"), message, - invalid_args_range(ctx, d.expr_or_pat.map(Into::into), d.expected, d.found), + invalid_args_range(ctx, d.expr_or_pat, d.expected, d.found), ) } @@ -40,17 +40,17 @@ pub(crate) fn mismatched_arg_count( Diagnostic::new( DiagnosticCode::RustcHardError("E0107"), message, - invalid_args_range(ctx, d.call_expr.map(Into::into), d.expected, d.found), + invalid_args_range(ctx, d.call_expr.map(AstPtr::wrap_left), d.expected, d.found), ) } fn invalid_args_range( ctx: &DiagnosticsContext<'_>, - source: InFile<SyntaxNodePtr>, + source: InFile<AstPtr<Either<ast::Expr, ast::Pat>>>, expected: usize, found: usize, ) -> FileRange { - adjusted_display_range::<Either<ast::Expr, ast::TupleStructPat>>(ctx, source, &|expr| { + adjusted_display_range_new(ctx, source, &|expr| { let (text_range, r_paren_token, expected_arg) = match expr { Either::Left(ast::Expr::CallExpr(call)) => { let arg_list = call.arg_list()?; @@ -68,7 +68,7 @@ fn invalid_args_range( arg_list.args().nth(expected).map(|it| it.syntax().text_range()), ) } - Either::Right(pat) => { + Either::Right(ast::Pat::TupleStructPat(pat)) => { let r_paren = pat.r_paren_token()?; let l_paren = pat.l_paren_token()?; ( |
