Skip to content

Commit cab65ef

Browse files
Rollup merge of #142593 - blyxyas:improve-docs-itty-bitty-change, r=compiler-errors
Add a warning to LateContext::get_def_path Preventing anyone from doing the same error as rust-lang/rust-clippy#15043 fixed
2 parents 3714263 + 6d04085 commit cab65ef

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/rustc_lint/src/context.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,15 @@ impl<'tcx> LateContext<'tcx> {
711711

712712
/// Gets the absolute path of `def_id` as a vector of `Symbol`.
713713
///
714+
/// Note that this is kinda expensive because it has to
715+
/// travel the tree and pretty-print. Use sparingly.
716+
///
717+
/// If you're trying to match for an item given by its path, use a
718+
/// diagnostic item. If you're only interested in given sections, use more
719+
/// specific functions, such as [`TyCtxt::crate_name`]
720+
///
721+
/// FIXME: It would be great if this could be optimized.
722+
///
714723
/// # Examples
715724
///
716725
/// ```rust,ignore (no context or def id available)

0 commit comments

Comments
 (0)