diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:12:43 +0000 |
commit | cf94bdc0742c13e2a0cac864c478b8626b266e1b (patch) | |
tree | 044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /compiler/rustc_lint/src/pass_by_value.rs | |
parent | Adding debian version 1.65.0+dfsg1-2. (diff) | |
download | rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_lint/src/pass_by_value.rs')
-rw-r--r-- | compiler/rustc_lint/src/pass_by_value.rs | 18 |
1 files changed, 10 insertions, 8 deletions
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<Stri let path_segment = path.segments.last().unwrap(); return Some(format!("{}{}", name, gen_args(cx, path_segment))); } - Res::SelfTy { trait_: None, alias_to: Some((did, _)) } => { + 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)); |