Skip to content

Commit 2d8ede2

Browse files
fix: use LocalDefId instead of HirId in trait res
use LocalDefId instead of HirId in trait resolution to simplify the obligation clause resolution Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 298a782 commit 2d8ede2

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

clippy_lints/src/future_not_send.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
7878
let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
7979
let span = decl.output.span();
8080
let infcx = cx.tcx.infer_ctxt().build();
81-
let cause = traits::ObligationCause::misc(span, hir_id);
81+
let def_id = cx.tcx.hir().local_def_id(hir_id);
82+
let cause = traits::ObligationCause::misc(span, def_id);
8283
let send_errors = traits::fully_solve_bound(&infcx, cause, cx.param_env, ret_ty, send_trait);
8384
if !send_errors.is_empty() {
8485
span_lint_and_then(

clippy_lints/src/methods/unnecessary_to_owned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
371371
&& let output_ty = return_ty(cx, item.hir_id())
372372
&& let local_def_id = cx.tcx.hir().local_def_id(item.hir_id())
373373
&& Inherited::build(cx.tcx, local_def_id).enter(|inherited| {
374-
let fn_ctxt = FnCtxt::new(inherited, cx.param_env, item.hir_id());
374+
let fn_ctxt = FnCtxt::new(inherited, cx.param_env, local_def_id);
375375
fn_ctxt.can_coerce(ty, output_ty)
376376
}) {
377377
if has_lifetime(output_ty) && has_lifetime(ty) {

clippy_lints/src/transmute/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn check_cast<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, from_ty: Ty<'tcx>
4646
let local_def_id = hir_id.owner.def_id;
4747

4848
Inherited::build(cx.tcx, local_def_id).enter(|inherited| {
49-
let fn_ctxt = FnCtxt::new(inherited, cx.param_env, hir_id);
49+
let fn_ctxt = FnCtxt::new(inherited, cx.param_env, local_def_id);
5050

5151
// If we already have errors, we can't be sure we can pointer cast.
5252
assert!(

0 commit comments

Comments
 (0)