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 <vincenzopalazzodev@gmail.com>
This commit is contained in:
parent
6b3cd03fdb
commit
7d2c1103d7
48 changed files with 265 additions and 280 deletions
|
@ -26,12 +26,11 @@ use crate::infer::{InferCtxt, TyCtxtInferExt};
|
|||
use crate::traits::error_reporting::TypeErrCtxtExt as _;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::visit::TypeVisitable;
|
||||
use rustc_middle::ty::{self, DefIdTree, ToPredicate, Ty, TyCtxt, TypeSuperVisitable};
|
||||
use rustc_middle::ty::{InternalSubsts, SubstsRef};
|
||||
use rustc_span::def_id::{DefId, CRATE_DEF_ID};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
@ -151,7 +150,7 @@ fn pred_known_to_hold_modulo_regions<'tcx>(
|
|||
// We can use a dummy node-id here because we won't pay any mind
|
||||
// to region obligations that arise (there shouldn't really be any
|
||||
// anyhow).
|
||||
cause: ObligationCause::misc(span, hir::CRATE_HIR_ID),
|
||||
cause: ObligationCause::misc(span, CRATE_DEF_ID),
|
||||
recursion_depth: 0,
|
||||
predicate: pred.to_predicate(infcx.tcx),
|
||||
};
|
||||
|
@ -166,14 +165,12 @@ fn pred_known_to_hold_modulo_regions<'tcx>(
|
|||
// that guess. While imperfect, I believe this is sound.
|
||||
|
||||
// FIXME(@lcnr): this function doesn't seem right.
|
||||
//
|
||||
// The handling of regions in this area of the code is terrible,
|
||||
// see issue #29149. We should be able to improve on this with
|
||||
// NLL.
|
||||
let errors = fully_solve_obligation(infcx, obligation);
|
||||
|
||||
// Note: we only assume something is `Copy` if we can
|
||||
// *definitively* show that it implements `Copy`. Otherwise,
|
||||
// assume it is move; linear is always ok.
|
||||
match &errors[..] {
|
||||
[] => true,
|
||||
errors => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue