about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-13 21:05:21 +0000
committerbors <bors@rust-lang.org>2022-09-13 21:05:21 +0000
commit17cbdfd07178349d0a3cecb8e7dde8f915666ced (patch)
treec873d712775ce17d869b73d02f2eecc649519c78 /compiler/rustc_middle
parentc84083b08e2db69fcf270c4045837fa02663a3bf (diff)
parentf04eee11578b31b0618e854873c21ce5c453f52c (diff)
downloadrust-17cbdfd07178349d0a3cecb8e7dde8f915666ced.tar.gz
rust-17cbdfd07178349d0a3cecb8e7dde8f915666ced.zip
Auto merge of #101777 - matthiaskrgr:rollup-x2dyaa2, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #101266 (translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Final)
 - #101737 (rustdoc: remove no-op CSS `.search-results .result-name > span`)
 - #101752 (Improve Attribute doc methods)
 - #101754 (Fix doc of log function)
 - #101759 (:arrow_up: rust-analyzer)
 - #101765 (Add documentation for TyCtxt::visibility)
 - #101770 (Rustdoc-Json: Don't loose subitems of foreign traits.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index aaceec98b1a..0fe22a26cd5 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -1611,6 +1611,16 @@ rustc_queries! {
         desc { "looking up late bound vars" }
     }
 
+    /// Computes the visibility of the provided `def_id`.
+    ///
+    /// If the item from the `def_id` doesn't have a visibility, it will panic. For example
+    /// a generic type parameter will panic if you call this method on it:
+    ///
+    /// ```
+    /// pub trait Foo<T: Debug> {}
+    /// ```
+    ///
+    /// In here, if you call `visibility` on `T`, it'll panic.
     query visibility(def_id: DefId) -> ty::Visibility<DefId> {
         desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
         separate_provide_extern