summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-06-22 17:35:33 +0200
committerGitHub <noreply@github.com>2025-06-22 17:35:33 +0200
commitcab65efa2e0598903b72530b8d2cfa7bb818b6cb (patch)
tree158e4b0f241690ad6901aa695df3c53c6441a668 /compiler
parent371426334b976e5f889c477584e9d293ab1120c6 (diff)
parent6d040856df069e0345cc34047c4d21c66021cca9 (diff)
downloadrust-cab65efa2e0598903b72530b8d2cfa7bb818b6cb.tar.gz
rust-cab65efa2e0598903b72530b8d2cfa7bb818b6cb.zip
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
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/context.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs
index 414f2a1846b..297b8ef7e76 100644
--- a/compiler/rustc_lint/src/context.rs
+++ b/compiler/rustc_lint/src/context.rs
@@ -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)