diff options
| author | Joshua Nelson <github@jyn.dev> | 2022-12-22 12:57:47 -0600 |
|---|---|---|
| committer | Joshua Nelson <github@jyn.dev> | 2022-12-22 13:12:15 -0600 |
| commit | e4330295d9bcb8ab302000eae60cd8b9a71f2d7a (patch) | |
| tree | 2354120da7c1dfd4d9e84bf969bfee42b4d6c125 /compiler/rustc_middle/src | |
| parent | 2d76a9df5d040e8dfcb23e01fc3847c628d833e4 (diff) | |
| download | rust-e4330295d9bcb8ab302000eae60cd8b9a71f2d7a.tar.gz rust-e4330295d9bcb8ab302000eae60cd8b9a71f2d7a.zip | |
Give a more helpful error for "trimmed_def_paths construted"
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index a1d53506707..c49e75d68ad 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2883,13 +2883,19 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N /// `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. /// /// The implementation uses similar import discovery logic to that of 'use' suggestions. +/// +/// See also [`DelayDm`](rustc_error_messages::DelayDm) and [`with_no_trimmed_paths`]. fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> FxHashMap<DefId, Symbol> { let mut map: FxHashMap<DefId, Symbol> = FxHashMap::default(); if let TrimmedDefPaths::GoodPath = tcx.sess.opts.trimmed_def_paths { + // Trimming paths is expensive and not optimized, since we expect it to only be used for error reporting. + // // For good paths causing this bug, the `rustc_middle::ty::print::with_no_trimmed_paths` // wrapper can be used to suppress this query, in exchange for full paths being formatted. - tcx.sess.delay_good_path_bug("trimmed_def_paths constructed"); + tcx.sess.delay_good_path_bug( + "trimmed_def_paths constructed but no error emitted; use `DelayDm` for lints or `with_no_trimmed_paths` for debugging", + ); } let unique_symbols_rev: &mut FxHashMap<(Namespace, Symbol), Option<DefId>> = |
