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 https://github.com/rust-lang/rust-clippy/pull/15043 fixed
This commit is contained in:
Guillaume Gomez
2025-06-22 17:35:33 +02:00
committed by GitHub

View File

@@ -711,6 +711,15 @@ impl<'tcx> LateContext<'tcx> {
/// Gets the absolute path of `def_id` as a vector of `Symbol`.
///
/// Note that this is kinda expensive because it has to
/// travel the tree and pretty-print. Use sparingly.
///
/// If you're trying to match for an item given by its path, use a
/// diagnostic item. If you're only interested in given sections, use more
/// specific functions, such as [`TyCtxt::crate_name`]
///
/// FIXME: It would be great if this could be optimized.
///
/// # Examples
///
/// ```rust,ignore (no context or def id available)