Skip to content

Commit

Permalink
Fix query cycle when tracing explicit_item_bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Oct 30, 2020
1 parent ffe5288 commit 1f5c655
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/print/pretty.rs
Expand Up @@ -65,7 +65,7 @@ thread_local! {
/// Avoids running any queries during any prints that occur
/// during the closure. This may alter the appearance of some
/// types (e.g. forcing verbose printing for opaque types).
/// This method is used during some queries (e.g. `predicates_of`
/// This method is used during some queries (e.g. `explicit_item_bounds`
/// for opaque types), to ensure that any debug printing that
/// occurs during the query computation does not end up recursively
/// calling the same query.
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_typeck/src/collect/item_bounds.rs
Expand Up @@ -61,23 +61,23 @@ fn opaque_type_bounds<'tcx>(
bounds: &'tcx [hir::GenericBound<'tcx>],
span: Span,
) -> &'tcx [(ty::Predicate<'tcx>, Span)] {
let item_ty =
tcx.mk_opaque(opaque_def_id, InternalSubsts::identity_for_item(tcx, opaque_def_id));
ty::print::with_no_queries(|| {
let item_ty =
tcx.mk_opaque(opaque_def_id, InternalSubsts::identity_for_item(tcx, opaque_def_id));

let bounds = ty::print::with_no_queries(|| {
AstConv::compute_bounds(
let bounds = AstConv::compute_bounds(
&ItemCtxt::new(tcx, opaque_def_id),
item_ty,
bounds,
SizedByDefault::Yes,
span,
)
});
.predicates(tcx, item_ty);

let bounds = bounds.predicates(tcx, item_ty);
debug!("opaque_type_bounds({}) = {:?}", tcx.def_path_str(opaque_def_id), bounds);
debug!("opaque_type_bounds({}) = {:?}", tcx.def_path_str(opaque_def_id), bounds);

tcx.arena.alloc_slice(&bounds)
tcx.arena.alloc_slice(&bounds)
})
}

pub(super) fn explicit_item_bounds(
Expand Down

0 comments on commit 1f5c655

Please sign in to comment.