Skip to content

Commit 996fa50

Browse files
authored
Rollup merge of rust-lang#93714 - compiler-errors:can-type-impl-copy-error-span, r=jackh726
better ObligationCause for normalization errors in `can_type_implement_copy` Some logic is needed so we can point to the field when given totally nonsense types like `struct Foo(<u32 as Iterator>::Item);` Fixes rust-lang#93687
2 parents a30eba2 + 676943a commit 996fa50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
199199
let sugg = |diag: &mut DiagnosticBuilder<'_>| {
200200
if let ty::Adt(def, ..) = ty.kind() {
201201
if let Some(span) = cx.tcx.hir().span_if_local(def.did) {
202-
if can_type_implement_copy(cx.tcx, cx.param_env, ty).is_ok() {
202+
if can_type_implement_copy(cx.tcx, cx.param_env, ty, traits::ObligationCause::dummy_with_span(span)).is_ok() {
203203
diag.span_help(span, "consider marking this type as `Copy`");
204204
}
205205
}

0 commit comments

Comments
 (0)