Skip to content

Commit 6d04085

Browse files
committed
Add a warning to LateContext::get_def_path
1 parent 8da6239 commit 6d04085

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
@@ -710,6 +710,15 @@ impl<'tcx> LateContext<'tcx> {
710710

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

0 commit comments

Comments
 (0)