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
|
@ -18,7 +18,8 @@ use crate::ty::{self, AdtKind, Ty, TyCtxt};
|
|||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{Applicability, Diagnostic};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_span::def_id::{LocalDefId, CRATE_DEF_ID};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use smallvec::SmallVec;
|
||||
|
@ -99,7 +100,7 @@ pub struct ObligationCause<'tcx> {
|
|||
/// (in particular, closures can add new assumptions). See the
|
||||
/// field `region_obligations` of the `FulfillmentContext` for more
|
||||
/// information.
|
||||
pub body_id: hir::HirId,
|
||||
pub body_id: LocalDefId,
|
||||
|
||||
code: InternedObligationCauseCode<'tcx>,
|
||||
}
|
||||
|
@ -120,13 +121,13 @@ impl<'tcx> ObligationCause<'tcx> {
|
|||
#[inline]
|
||||
pub fn new(
|
||||
span: Span,
|
||||
body_id: hir::HirId,
|
||||
body_id: LocalDefId,
|
||||
code: ObligationCauseCode<'tcx>,
|
||||
) -> ObligationCause<'tcx> {
|
||||
ObligationCause { span, body_id, code: code.into() }
|
||||
}
|
||||
|
||||
pub fn misc(span: Span, body_id: hir::HirId) -> ObligationCause<'tcx> {
|
||||
pub fn misc(span: Span, body_id: LocalDefId) -> ObligationCause<'tcx> {
|
||||
ObligationCause::new(span, body_id, MiscObligation)
|
||||
}
|
||||
|
||||
|
@ -137,7 +138,7 @@ impl<'tcx> ObligationCause<'tcx> {
|
|||
|
||||
#[inline(always)]
|
||||
pub fn dummy_with_span(span: Span) -> ObligationCause<'tcx> {
|
||||
ObligationCause { span, body_id: hir::CRATE_HIR_ID, code: Default::default() }
|
||||
ObligationCause { span, body_id: CRATE_DEF_ID, code: Default::default() }
|
||||
}
|
||||
|
||||
pub fn span(&self) -> Span {
|
||||
|
|
|
@ -2437,6 +2437,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
ident
|
||||
}
|
||||
|
||||
// FIXME(vincenzoapalzzo): move the HirId to a LocalDefId
|
||||
pub fn adjust_ident_and_get_scope(
|
||||
self,
|
||||
mut ident: Ident,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue