From 94a0819fe3a0d679c3042a77bfe6a2afc505daea Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:28 +0200 Subject: Adding upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_lint/src/pass_by_value.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'compiler/rustc_lint/src/pass_by_value.rs') diff --git a/compiler/rustc_lint/src/pass_by_value.rs b/compiler/rustc_lint/src/pass_by_value.rs index af5e5faf1..01bface71 100644 --- a/compiler/rustc_lint/src/pass_by_value.rs +++ b/compiler/rustc_lint/src/pass_by_value.rs @@ -29,18 +29,20 @@ impl<'tcx> LateLintPass<'tcx> for PassByValue { } } if let Some(t) = path_for_pass_by_value(cx, &inner_ty) { - cx.struct_span_lint(PASS_BY_VALUE, ty.span, |lint| { - lint.build(fluent::lint::pass_by_value) - .set_arg("ty", t.clone()) - .span_suggestion( + cx.struct_span_lint( + PASS_BY_VALUE, + ty.span, + fluent::lint_pass_by_value, + |lint| { + lint.set_arg("ty", t.clone()).span_suggestion( ty.span, - fluent::lint::suggestion, + fluent::suggestion, t, // Changing type of function argument Applicability::MaybeIncorrect, ) - .emit(); - }) + }, + ) } } _ => {} @@ -56,7 +58,7 @@ fn path_for_pass_by_value(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> Option { + Res::SelfTyAlias { alias_to: did, is_trait_impl: false, .. } => { if let ty::Adt(adt, substs) = cx.tcx.type_of(did).kind() { if cx.tcx.has_attr(adt.did(), sym::rustc_pass_by_value) { return Some(cx.tcx.def_path_str_with_substs(adt.did(), substs)); -- cgit v1.2.3