mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Rollup merge of #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 #93687
This commit is contained in:
commit
996fa506a4
1 changed files with 1 additions and 1 deletions
|
@ -199,7 +199,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
|
|||
let sugg = |diag: &mut DiagnosticBuilder<'_>| {
|
||||
if let ty::Adt(def, ..) = ty.kind() {
|
||||
if let Some(span) = cx.tcx.hir().span_if_local(def.did) {
|
||||
if can_type_implement_copy(cx.tcx, cx.param_env, ty).is_ok() {
|
||||
if can_type_implement_copy(cx.tcx, cx.param_env, ty, traits::ObligationCause::dummy_with_span(span)).is_ok() {
|
||||
diag.span_help(span, "consider marking this type as `Copy`");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue