mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Debug log all the things
This commit is contained in:
parent
692f638036
commit
95f296db63
@ -509,11 +509,10 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(skip(tcx), level = "debug")]
|
||||||
fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
||||||
use rustc_hir::{Expr, ImplItem, Item, TraitItem};
|
use rustc_hir::{Expr, ImplItem, Item, TraitItem};
|
||||||
|
|
||||||
debug!("find_opaque_ty_constraints({:?})", def_id);
|
|
||||||
|
|
||||||
struct ConstraintLocator<'tcx> {
|
struct ConstraintLocator<'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
@ -522,13 +521,11 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ConstraintLocator<'_> {
|
impl ConstraintLocator<'_> {
|
||||||
|
#[instrument(skip(self), level = "debug")]
|
||||||
fn check(&mut self, def_id: LocalDefId) {
|
fn check(&mut self, def_id: LocalDefId) {
|
||||||
// Don't try to check items that cannot possibly constrain the type.
|
// Don't try to check items that cannot possibly constrain the type.
|
||||||
if !self.tcx.has_typeck_results(def_id) {
|
if !self.tcx.has_typeck_results(def_id) {
|
||||||
debug!(
|
debug!("no constraint: no typeck results");
|
||||||
"find_opaque_ty_constraints: no constraint for `{:?}` at `{:?}`: no typeck results",
|
|
||||||
self.def_id, def_id,
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Calling `mir_borrowck` can lead to cycle errors through
|
// Calling `mir_borrowck` can lead to cycle errors through
|
||||||
@ -540,10 +537,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
|||||||
.get_by(|(key, _)| key.def_id == self.def_id)
|
.get_by(|(key, _)| key.def_id == self.def_id)
|
||||||
.is_none()
|
.is_none()
|
||||||
{
|
{
|
||||||
debug!(
|
debug!("no constraints in typeck results");
|
||||||
"find_opaque_ty_constraints: no constraint for `{:?}` at `{:?}`",
|
|
||||||
self.def_id, def_id,
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Use borrowck to get the type with unerased regions.
|
// Use borrowck to get the type with unerased regions.
|
||||||
@ -603,7 +597,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
|||||||
|
|
||||||
if let Some((prev_span, prev_ty)) = self.found {
|
if let Some((prev_span, prev_ty)) = self.found {
|
||||||
if *concrete_type != prev_ty {
|
if *concrete_type != prev_ty {
|
||||||
debug!("find_opaque_ty_constraints: span={:?}", span);
|
debug!(?span);
|
||||||
// Found different concrete types for the opaque type.
|
// Found different concrete types for the opaque type.
|
||||||
let mut err = self.tcx.sess.struct_span_err(
|
let mut err = self.tcx.sess.struct_span_err(
|
||||||
span,
|
span,
|
||||||
|
Loading…
Reference in New Issue
Block a user