Skip to content

Commit cb00bc0

Browse files
committed
Hide _use_mk_alias_ty_instead in <AliasTy as Debug>::fmt
1 parent 159ba8a commit cb00bc0

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

compiler/rustc_middle/src/ty/structural_impls.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::mir::{Field, ProjectionKind};
77
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeSuperFoldable};
88
use crate::ty::print::{with_no_trimmed_paths, FmtPrinter, Printer};
99
use crate::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor};
10-
use crate::ty::{self, InferConst, Lift, Term, TermKind, Ty, TyCtxt};
10+
use crate::ty::{self, AliasTy, InferConst, Lift, Term, TermKind, Ty, TyCtxt};
1111
use rustc_data_structures::functor::IdFunctor;
1212
use rustc_hir::def::Namespace;
1313
use rustc_index::vec::{Idx, IndexVec};
@@ -180,6 +180,15 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
180180
}
181181
}
182182

183+
impl<'tcx> fmt::Debug for AliasTy<'tcx> {
184+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
185+
f.debug_struct("AliasTy")
186+
.field("substs", &self.substs)
187+
.field("def_id", &self.def_id)
188+
.finish()
189+
}
190+
}
191+
183192
///////////////////////////////////////////////////////////////////////////
184193
// Atomic structs
185194
//

compiler/rustc_middle/src/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ impl<'tcx> FallibleTypeFolder<'tcx> for SkipBindersAt<'tcx> {
12261226
/// For a projection, this would be `<Ty as Trait<...>>::N`.
12271227
///
12281228
/// For an opaque type, there is no explicit syntax.
1229-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
1229+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
12301230
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
12311231
pub struct AliasTy<'tcx> {
12321232
/// The parameters of the associated or opaque item.

tests/ui/chalkify/bugs/async.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ LL | async fn foo(x: u32) -> u32 {
3737
= help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:23:29: 25:2]`
3838
= note: [async fn body@$DIR/async.rs:23:29: 25:2] must be a future or must implement `IntoFuture` to be awaited
3939

40-
error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:23:29: 25:2]], def_id: ...), _use_mk_alias_ty_instead: () }, Term::Ty(u32)), []), depth=0)`
40+
error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:23:29: 25:2]], def_id: ...) }, Term::Ty(u32)), []), depth=0)`
4141
--> $DIR/async.rs:23:25
4242
|
4343
LL | async fn foo(x: u32) -> u32 {

0 commit comments

Comments
 (0)