Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
228d6f4
rustc: remove unnecessary extern_prelude logic from ty::item_path.
eddyb Dec 9, 2018
382d24e
rustc: start moving util::ppaux to ty::print.
eddyb Dec 4, 2018
297546e
rustc: add a 'tcx parameter to Print.
eddyb Dec 4, 2018
372b1a5
rustc: uniformize all lift expect messages to "could not lift for pri…
eddyb Dec 4, 2018
852fc6d
rustc: don't support `tcx.lift` returning `None` in ppaux.
eddyb Dec 4, 2018
c684814
rustc: don't support missing TLS TyCtxt in ty::print.
eddyb Dec 4, 2018
5f3841c
rustc: rename PrintContext to PrintCx.
eddyb Dec 7, 2018
0b3ab40
rustc: keep a TyCtxt in PrintCx and use it instead of ty::tls.
eddyb Dec 7, 2018
01fa283
rustc: remove fmt::{Debug,Display} from ty::TyKind.
eddyb Dec 7, 2018
3bad9f7
rustc: implement fmt::{Debug,Display} on Ty instead of TyS.
eddyb Dec 7, 2018
eb525b0
rustc: tie the 'tcx between Print and PrintCx in ty::print.
eddyb Dec 7, 2018
939c69c
rustc: use define_print! to implement fmt::{Display,Debug} for Kind.
eddyb Dec 7, 2018
fbbc7e9
rustc: rewrite PrintCx::parameterized to be much simpler and more gen…
eddyb Dec 8, 2018
1c2a3c5
rustc: support impl's in PrintCx::parameterized.
eddyb Dec 9, 2018
7505bb6
rustc_codegen_utils: revert some symbol_names refactors (while keepin…
eddyb Feb 3, 2019
7d211e5
rustc: rewrite ty::item_path to be more functional than mutation-orie…
eddyb Dec 9, 2018
387cacf
rustc: remove ty::item_path::RootMode by moving local logic into the …
eddyb Dec 10, 2018
329b8ca
rustc: always rely on '_ to be not printed by ty::Region itself.
eddyb Dec 10, 2018
732b71a
rustc: add a ty::RegionKind::display_outputs_anything method to avoid…
eddyb Dec 12, 2018
08d2744
rustc: move the formatter into ty::print::PrintCx.
eddyb Dec 10, 2018
2386168
rustc: explicitly pass the namespace to PrintCx::parameterized.
eddyb Dec 12, 2018
ed2be6f
rustc: move the FORCE_IMPL_FILENAME_LINE handling into LocalPathPrinter.
eddyb Dec 12, 2018
3e1cef7
rustc: pass Option<&Substs> and Namespace around in ty::item_path.
eddyb Dec 19, 2018
6ca6c1a
rustc_mir: adjust the type_length_limit diagnostic to be more useful.
eddyb Dec 19, 2018
f1af5a7
rustc: remove TyCtxt::parent_def_id in favor of TyCtxt::parent.
eddyb Dec 19, 2018
e0c75ff
rustc: rename item_path to def_path (except the module in ty).
eddyb Dec 19, 2018
9f8aaa0
rustc: move the contents of ty::item_path to ty::print.
eddyb Dec 19, 2018
b0fbca9
rustc: integrate LocalPathPrinter's behavior into FmtPrinter.
eddyb Dec 19, 2018
a15bfc6
rustc: merge PrintCx::parameterized and def_path printing.
eddyb Dec 21, 2018
aec5a48
rustc: move <...>-less impl path special-case to pretty_path_qualified.
eddyb Dec 21, 2018
39fd54a
rustc: move the `FORCE_IMPL_FILENAME_LINE` hack into `print_def_path`.
eddyb Dec 21, 2018
df6650f
rustc: move `...::<impl ...>` printing into `pretty_path_qualified`.
eddyb Dec 28, 2018
66cc029
rustc: assert `ty::print::FORCE_ABSOLUTE` isn't needed anymore.
eddyb Dec 28, 2018
36f64f1
rustc: remove `ty::print::FORCE_ABSOLUTE` altogether.
eddyb Dec 28, 2018
27ddf2c
rustc: replace node_path_str with uses of def_path_str.
eddyb Dec 28, 2018
387ea61
rustc: make ppaux' print macro use only one closure.
eddyb Jan 9, 2019
972af5e
rustc: rename ppaux' print macro to just p and make its cx input impl…
eddyb Jan 9, 2019
5616ca8
rustc: uniformize ty::print's error handling by requiring Result.
eddyb Jan 9, 2019
37e9185
rustc: split off most of ty::print::PrintCx's fields into a separate …
eddyb Jan 10, 2019
ab5d6fb
rustc: remove the closure from ppaux's p! macro (by making ? implicit).
eddyb Jan 10, 2019
7c4eece
rustc: pass ty::print::PrintCx by value.
eddyb Jan 10, 2019
cafd83d
rustc: don't keep RegionHighlightMode in a thread-local.
eddyb Jan 11, 2019
fc914aa
rustc: centralize region printing in ty::RegionKind's Print impl.
eddyb Jan 14, 2019
88d96b2
rustc: support overriding region printing in ty::print::Printer.
eddyb Jan 14, 2019
35e5123
rustc: support overriding type printing in ty::print::Printer.
eddyb Jan 14, 2019
ab26b26
rustc: introduce a ty::print::PrettyPrinter helper for printing "<...>".
eddyb Jan 14, 2019
5211e37
rustc: don't pass Namespace explicitly, but rather track it in FmtPri…
eddyb Jan 14, 2019
6d67d68
rustc_codegen_utils: print all nominal types as paths, in symbol names.
eddyb Jan 14, 2019
26f1807
rustc: move ty/print.rs to ty/print/mod.rs.
eddyb Jan 18, 2019
55871aa
rustc: split out the pretty-printing parts of ty::print into a separa…
eddyb Jan 18, 2019
800ddb3
rustc: remove fields from ty::print::PrintConfig available from tcx.
eddyb Jan 18, 2019
d0a1bf5
rustc: make util::ppaux private.
eddyb Jan 18, 2019
9c42485
rustc: disconnect all the Debug functionality from ty::print.
eddyb Jan 19, 2019
fb53bb9
rustc: move Debug impls from ppaux to ty::structural_impls.
eddyb Jan 19, 2019
030cdc9
rustc: remove obsolete hacks from ppaux, relating to normalization un…
eddyb Jan 20, 2019
1a0f3a2
rustc: streamline the Print/fmt::Display impls in ppaux and move them…
eddyb Jan 20, 2019
381fa7a
rustc: move ty::print::PrintConfig's fields to FmtPrinter.
eddyb Jan 20, 2019
72690d2
rustc: always hide defaulted generic args, even in verbose mode.
eddyb Jan 23, 2019
4deaa69
rustc: print elided regions as '_ instead of nothing, and use a separ…
eddyb Jan 23, 2019
ffa00d4
rustc: make `pretty_path_generic_args`' task as simple as possible.
eddyb Jan 24, 2019
c0c485c
rustc: don't thread existential projections through path_generic_args.
eddyb Jan 24, 2019
2a65682
rustc: remove the ability for pretty-printers to override nesting.
eddyb Jan 25, 2019
52b4f2d
rustc: remove PrintCx from ty::Print and rely on printers carrying Ty…
eddyb Jan 25, 2019
9df7c3f
rustc: let ty::print::pretty's p! macro call arbitrary methods.
eddyb Jan 25, 2019
8619ede
rustc: slice substs in ty::print instead of passing the full ones.
eddyb Jan 29, 2019
a54a41c
rustc: provide DisambiguatedDefPathData in ty::print.
eddyb Feb 3, 2019
22d6c55
rustc: print ExistentialProjection with spaces around `=`, e.g. `dyn …
eddyb Feb 3, 2019
4653ae1
we can now print on entering/leaving the topmost frame, and make sure…
RalfJung Feb 7, 2019
0ee059d
Fix rebase fallout and address some review comments.
eddyb Mar 14, 2019
dbf19c3
rustbuild: remove obsolete fulldeps behavior from src/test/pretty tes…
eddyb Mar 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rustc: slice substs in ty::print instead of passing the full ones.
  • Loading branch information
eddyb committed Mar 15, 2019
commit 8619edede1496a8d9c4131f9cb2079e71dccd5fb
2 changes: 1 addition & 1 deletion src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
if !(did1.is_local() || did2.is_local()) && did1.krate != did2.krate {
let abs_path = |def_id| {
AbsolutePathPrinter { tcx: self.tcx }
.print_def_path(def_id, None)
.print_def_path(def_id, &[])
};

// We compare strings because DefPath can be different
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
ty::tls::with(|tcx| {
let substs = tcx.lift(&substs).expect("could not lift for printing");
FmtPrinter::new(tcx, f, Namespace::ValueNS)
.print_def_path(variant_def.did, Some(substs))?;
.print_def_path(variant_def.did, substs)?;
Ok(())
})?;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl<'tcx> fmt::Display for Instance<'tcx> {
ty::tls::with(|tcx| {
let substs = tcx.lift(&self.substs).expect("could not lift for printing");
FmtPrinter::new(tcx, &mut *f, Namespace::ValueNS)
.print_def_path(self.def_id(), Some(substs))?;
.print_def_path(self.def_id(), substs)?;
Ok(())
})?;

Expand Down
96 changes: 48 additions & 48 deletions src/librustc/ty/print/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::hir::map::DefPathData;
use crate::hir::def_id::{CrateNum, DefId};
use crate::ty::{self, DefIdTree, Ty, TyCtxt};
use crate::ty::subst::{Kind, Subst, SubstsRef};
use crate::ty::subst::{Kind, Subst};

use rustc_data_structures::fx::FxHashSet;

Expand Down Expand Up @@ -29,14 +29,14 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
fn print_def_path(
self,
def_id: DefId,
substs: Option<SubstsRef<'tcx>>,
substs: &'tcx [Kind<'tcx>],
) -> Result<Self::Path, Self::Error> {
self.default_print_def_path(def_id, substs)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the setup here is meant to be analagous to TypeFoldable? That is, these print_foo methods are like the "kernel" bits of configuration that different printers can configure?

How does one extend the set of types that can be pretty-printed, then? By implementing Debug and Display for them? (And, at some point, we hit one of the types that has a method here and its Display/Debug impl creates a Printer and transitions into this code?)

That's at least how I'm imagining it. You kind of have two levels;

[ Debug or Display impl on some random type ]
    |
 invokes
    |
    v
[ Debug or Display impl for some `Printer` type, like `Ty` ]
    |
  creates a pretty printer and invokes
    |
    v
[ Printer methods ]

as one path-way.

But presumably we sometimes want to create custom pretty printers, and we sidestep the Debug/Display impls? In that case, I guess, are you limited to printing the "base types" like Ty with this custom Printer impl?

Also, when do you want this base Printer and not the more extensive PrettyPrinter?

fn print_impl_path(
self,
impl_def_id: DefId,
substs: Option<SubstsRef<'tcx>>,
substs: &'tcx [Kind<'tcx>],
self_ty: Ty<'tcx>,
trait_ref: Option<ty::TraitRef<'tcx>>,
) -> Result<Self::Path, Self::Error> {
Expand Down Expand Up @@ -90,7 +90,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
fn default_print_def_path(
self,
def_id: DefId,
substs: Option<SubstsRef<'tcx>>,
substs: &'tcx [Kind<'tcx>],
) -> Result<Self::Path, Self::Error> {
debug!("default_print_def_path: def_id={:?}, substs={:?}", def_id, substs);
let key = self.tcx().def_key(def_id);
Expand All @@ -103,69 +103,69 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
}

DefPathData::Impl => {
let generics = self.tcx().generics_of(def_id);
let mut self_ty = self.tcx().type_of(def_id);
if let Some(substs) = substs {
self_ty = self_ty.subst(self.tcx(), substs);
}

let mut impl_trait_ref = self.tcx().impl_trait_ref(def_id);
if let Some(substs) = substs {
if substs.len() >= generics.count() {
self_ty = self_ty.subst(self.tcx(), substs);
impl_trait_ref = impl_trait_ref.subst(self.tcx(), substs);
}
self.print_impl_path(def_id, substs, self_ty, impl_trait_ref)
}

_ => {
let generics = substs.map(|_| self.tcx().generics_of(def_id));
let generics_parent = generics.as_ref().and_then(|g| g.parent);
let parent_def_id = DefId { index: key.parent.unwrap(), ..def_id };
let print_parent_path = |cx: Self| {
if let Some(generics_parent_def_id) = generics_parent {
assert_eq!(parent_def_id, generics_parent_def_id);

// FIXME(eddyb) try to move this into the parent's printing
// logic, instead of doing it when printing the child.
let parent_generics = cx.tcx().generics_of(parent_def_id);
let parent_has_own_self =
parent_generics.has_self && parent_generics.parent_count == 0;
if let (Some(substs), true) = (substs, parent_has_own_self) {
let trait_ref = ty::TraitRef::new(parent_def_id, substs);
cx.path_qualified(trait_ref.self_ty(), Some(trait_ref))
} else {
cx.print_def_path(parent_def_id, substs)
}
} else {
cx.print_def_path(parent_def_id, None)
}
};
let print_path = |cx: Self| {

let mut parent_substs = substs;
let mut trait_qualify_parent = false;
if !substs.is_empty() {
let generics = self.tcx().generics_of(def_id);
parent_substs = &substs[..generics.parent_count.min(substs.len())];

match key.disambiguated_data.data {
// Skip `::{{constructor}}` on tuple/unit structs.
DefPathData::StructCtor => print_parent_path(cx),

_ => {
cx.path_append(
print_parent_path,
&key.disambiguated_data.data.as_interned_str().as_str(),
)
// Closures' own generics are only captures, don't print them.
DefPathData::ClosureExpr => {}

// If we have any generic arguments to print, we do that
// on top of the same path, but without its own generics.
_ => if !generics.params.is_empty() && substs.len() >= generics.count() {
let args = self.generic_args_to_print(generics, substs);
return self.path_generic_args(
|cx| cx.print_def_path(def_id, parent_substs),
args,
);
}
}
};

if let (Some(generics), Some(substs)) = (generics, substs) {
let args = self.generic_args_to_print(generics, substs);
self.path_generic_args(print_path, args)
} else {
print_path(self)
// FIXME(eddyb) try to move this into the parent's printing
// logic, instead of doing it when printing the child.
trait_qualify_parent =
generics.has_self &&
generics.parent == Some(parent_def_id) &&
parent_substs.len() == generics.parent_count &&
self.tcx().generics_of(parent_def_id).parent_count == 0;
}

self.path_append(
|cx: Self| if trait_qualify_parent {
let trait_ref = ty::TraitRef::new(
parent_def_id,
cx.tcx().intern_substs(parent_substs),
);
cx.path_qualified(trait_ref.self_ty(), Some(trait_ref))
} else {
cx.print_def_path(parent_def_id, parent_substs)
},
&key.disambiguated_data.data.as_interned_str().as_str(),
)
}
}
}

fn generic_args_to_print(
&self,
generics: &'tcx ty::Generics,
substs: SubstsRef<'tcx>,
substs: &'tcx [Kind<'tcx>],
) -> &'tcx [Kind<'tcx>] {
let mut own_params = generics.parent_count..generics.count();

Expand Down Expand Up @@ -193,7 +193,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
fn default_print_impl_path(
self,
impl_def_id: DefId,
_substs: Option<SubstsRef<'tcx>>,
_substs: &'tcx [Kind<'tcx>],
self_ty: Ty<'tcx>,
impl_trait_ref: Option<ty::TraitRef<'tcx>>,
) -> Result<Self::Path, Self::Error> {
Expand All @@ -220,7 +220,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
// trait-type, then fallback to a format that identifies
// the module more clearly.
self.path_append_impl(
|cx| cx.print_def_path(parent_def_id, None),
|cx| cx.print_def_path(parent_def_id, &[]),
self_ty,
impl_trait_ref,
)
Expand Down
49 changes: 20 additions & 29 deletions src/librustc/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use crate::middle::cstore::{ExternCrate, ExternCrateSource};
use crate::middle::region;
use crate::ty::{self, DefIdTree, ParamConst, Ty, TyCtxt, TypeFoldable};
use crate::ty::subst::{Kind, Subst, SubstsRef, UnpackedKind};
use crate::ty::subst::{Kind, Subst, UnpackedKind};
use crate::mir::interpret::ConstValue;
use syntax::symbol::{keywords, Symbol};

Expand Down Expand Up @@ -178,7 +178,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
fn print_value_path(
self,
def_id: DefId,
substs: Option<SubstsRef<'tcx>>,
substs: &'tcx [Kind<'tcx>],
) -> Result<Self::Path, Self::Error> {
self.print_def_path(def_id, substs)
}
Expand Down Expand Up @@ -264,7 +264,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
}) => {
debug!("try_print_visible_def_path: def_id={:?}", def_id);
return Ok((if !span.is_dummy() {
self.print_def_path(def_id, None)?
self.print_def_path(def_id, &[])?
} else {
self.path_crate(cnum)?
}, true));
Expand Down Expand Up @@ -469,8 +469,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
}
ty::FnDef(def_id, substs) => {
let sig = self.tcx().fn_sig(def_id).subst(self.tcx(), substs);
p!(print(sig),
write(" {{"), print_value_path(def_id, Some(substs)), write("}}"));
p!(print(sig), write(" {{"), print_value_path(def_id, substs), write("}}"));
}
ty::FnPtr(ref bare_fn) => {
p!(print(bare_fn))
Expand All @@ -492,7 +491,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
}
}
ty::Adt(def, substs) => {
p!(print_def_path(def.did, Some(substs)));
p!(print_def_path(def.did, substs));
}
ty::Dynamic(data, r) => {
let print_r = self.region_should_not_be_omitted(r);
Expand All @@ -505,7 +504,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
}
}
ty::Foreign(def_id) => {
p!(print_def_path(def_id, None));
p!(print_def_path(def_id, &[]));
}
ty::Projection(ref data) => p!(print(data)),
ty::UnnormalizedProjection(ref data) => {
Expand Down Expand Up @@ -691,7 +690,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
let mut first = true;

if let Some(principal) = predicates.principal() {
p!(print_def_path(principal.def_id, None));
p!(print_def_path(principal.def_id, &[]));

let mut resugared = false;

Expand Down Expand Up @@ -774,7 +773,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
}
first = false;

p!(print_def_path(def_id, None));
p!(print_def_path(def_id, &[]));
}

Ok(self)
Expand Down Expand Up @@ -879,7 +878,7 @@ impl TyCtxt<'_, '_, '_> {
debug!("def_path_str: def_id={:?}, ns={:?}", def_id, ns);
let mut s = String::new();
let _ = FmtPrinter::new(self, &mut s, ns)
.print_def_path(def_id, None);
.print_def_path(def_id, &[]);
s
}
}
Expand All @@ -905,21 +904,13 @@ impl<F: fmt::Write> Printer<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F> {
fn print_def_path(
mut self,
def_id: DefId,
substs: Option<SubstsRef<'tcx>>,
substs: &'tcx [Kind<'tcx>],
) -> Result<Self::Path, Self::Error> {
define_scoped_cx!(self);

// FIXME(eddyb) avoid querying `tcx.generics_of` and `tcx.def_key`
// both here and in `default_print_def_path`.
let generics = substs.map(|_| self.tcx.generics_of(def_id));
if generics.as_ref().and_then(|g| g.parent).is_none() {
if substs.is_empty() {
match self.try_print_visible_def_path(def_id)? {
(cx, true) => return if let (Some(generics), Some(substs)) = (generics, substs) {
let args = cx.generic_args_to_print(generics, substs);
cx.path_generic_args(Ok, args)
} else {
Ok(cx)
},
(cx, true) => return Ok(cx),
(cx, false) => self = cx,
}
}
Expand All @@ -942,7 +933,7 @@ impl<F: fmt::Write> Printer<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F> {
let parent_def_id = DefId { index: key.parent.unwrap(), ..def_id };
let span = self.tcx.def_span(def_id);
return self.path_append(
|cx| cx.print_def_path(parent_def_id, None),
|cx| cx.print_def_path(parent_def_id, &[]),
&format!("<impl at {:?}>", span),
);
}
Expand Down Expand Up @@ -1073,7 +1064,7 @@ impl<F: fmt::Write> PrettyPrinter<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F>
fn print_value_path(
mut self,
def_id: DefId,
substs: Option<SubstsRef<'tcx>>,
substs: &'tcx [Kind<'tcx>],
) -> Result<Self::Path, Self::Error> {
let was_in_value = std::mem::replace(&mut self.in_value, true);
self = self.print_def_path(def_id, substs)?;
Expand Down Expand Up @@ -1476,7 +1467,7 @@ define_print_and_forward_display! {
ty::ExistentialPredicate::Trait(x) => p!(print(x)),
ty::ExistentialPredicate::Projection(x) => p!(print(x)),
ty::ExistentialPredicate::AutoTrait(def_id) => {
p!(print_def_path(def_id, None));
p!(print_def_path(def_id, &[]));
}
}
}
Expand Down Expand Up @@ -1509,7 +1500,7 @@ define_print_and_forward_display! {
}

ty::TraitRef<'tcx> {
p!(print_def_path(self.def_id, Some(self.substs)));
p!(print_def_path(self.def_id, self.substs));
}

ConstValue<'tcx> {
Expand Down Expand Up @@ -1553,7 +1544,7 @@ define_print_and_forward_display! {
}

ty::ProjectionTy<'tcx> {
p!(print_def_path(self.item_def_id, Some(self.substs)));
p!(print_def_path(self.item_def_id, self.substs));
}

ty::ClosureKind {
Expand All @@ -1574,17 +1565,17 @@ define_print_and_forward_display! {
ty::Predicate::WellFormed(ty) => p!(print(ty), write(" well-formed")),
ty::Predicate::ObjectSafe(trait_def_id) => {
p!(write("the trait `"),
print_def_path(trait_def_id, None),
print_def_path(trait_def_id, &[]),
write("` is object-safe"))
}
ty::Predicate::ClosureKind(closure_def_id, _closure_substs, kind) => {
p!(write("the closure `"),
print_value_path(closure_def_id, None),
print_value_path(closure_def_id, &[]),
write("` implements the trait `{}`", kind))
}
ty::Predicate::ConstEvaluatable(def_id, substs) => {
p!(write("the constant `"),
print_value_path(def_id, Some(substs)),
print_value_path(def_id, substs),
write("` can be evaluated"))
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl fmt::Debug for ty::TraitDef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
FmtPrinter::new(tcx, f, Namespace::TypeNS)
.print_def_path(self.def_id, None)?;
.print_def_path(self.def_id, &[])?;
Ok(())
})
}
Expand All @@ -46,7 +46,7 @@ impl fmt::Debug for ty::AdtDef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
FmtPrinter::new(tcx, f, Namespace::TypeNS)
.print_def_path(self.did, None)?;
.print_def_path(self.did, &[])?;
Ok(())
})
}
Expand Down
Loading