Skip to content

Commit 596e5c7

Browse files
committed
Auto merge of rust-lang#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: rust-lang#16407
2 parents f090205 + 8f05e7c commit 596e5c7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use hir::InFile;
33
use ide_db::base_db::FileRange;
44
use syntax::{
55
ast::{self, HasArgList},
6-
AstNode, SyntaxNodePtr,
6+
AstNode, AstPtr,
77
};
88

9-
use crate::{adjusted_display_range, Diagnostic, DiagnosticCode, DiagnosticsContext};
9+
use crate::{adjusted_display_range_new, Diagnostic, DiagnosticCode, DiagnosticsContext};
1010

1111
// Diagnostic: mismatched-tuple-struct-pat-arg-count
1212
//
@@ -24,7 +24,7 @@ pub(crate) fn mismatched_tuple_struct_pat_arg_count(
2424
Diagnostic::new(
2525
DiagnosticCode::RustcHardError("E0023"),
2626
message,
27-
invalid_args_range(ctx, d.expr_or_pat.map(Into::into), d.expected, d.found),
27+
invalid_args_range(ctx, d.expr_or_pat, d.expected, d.found),
2828
)
2929
}
3030

@@ -40,17 +40,17 @@ pub(crate) fn mismatched_arg_count(
4040
Diagnostic::new(
4141
DiagnosticCode::RustcHardError("E0107"),
4242
message,
43-
invalid_args_range(ctx, d.call_expr.map(Into::into), d.expected, d.found),
43+
invalid_args_range(ctx, d.call_expr.map(AstPtr::wrap_left), d.expected, d.found),
4444
)
4545
}
4646

4747
fn invalid_args_range(
4848
ctx: &DiagnosticsContext<'_>,
49-
source: InFile<SyntaxNodePtr>,
49+
source: InFile<AstPtr<Either<ast::Expr, ast::Pat>>>,
5050
expected: usize,
5151
found: usize,
5252
) -> FileRange {
53-
adjusted_display_range::<Either<ast::Expr, ast::TupleStructPat>>(ctx, source, &|expr| {
53+
adjusted_display_range_new(ctx, source, &|expr| {
5454
let (text_range, r_paren_token, expected_arg) = match expr {
5555
Either::Left(ast::Expr::CallExpr(call)) => {
5656
let arg_list = call.arg_list()?;
@@ -68,7 +68,7 @@ fn invalid_args_range(
6868
arg_list.args().nth(expected).map(|it| it.syntax().text_range()),
6969
)
7070
}
71-
Either::Right(pat) => {
71+
Either::Right(ast::Pat::TupleStructPat(pat)) => {
7272
let r_paren = pat.r_paren_token()?;
7373
let l_paren = pat.l_paren_token()?;
7474
(

0 commit comments

Comments
 (0)