Skip to content

Commit 68dc639

Browse files
authored
Rollup merge of #101765 - GuillaumeGomez:tyctxt-visibility-doc, r=jyn514
Add documentation for TyCtxt::visibility We encountered this issue while working on #98450. cc ``@lqd`` r? ``@cjgillot``
2 parents 2f6874d + de184a6 commit 68dc639

File tree

1 file changed

+10
-0
lines changed
  • compiler/rustc_middle/src/query

1 file changed

+10
-0
lines changed

compiler/rustc_middle/src/query/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,16 @@ rustc_queries! {
16111611
desc { "looking up late bound vars" }
16121612
}
16131613

1614+
/// Computes the visibility of the provided `def_id`.
1615+
///
1616+
/// If the item from the `def_id` doesn't have a visibility, it will panic. For example
1617+
/// a generic type parameter will panic if you call this method on it:
1618+
///
1619+
/// ```
1620+
/// pub trait Foo<T: Debug> {}
1621+
/// ```
1622+
///
1623+
/// In here, if you call `visibility` on `T`, it'll panic.
16141624
query visibility(def_id: DefId) -> ty::Visibility<DefId> {
16151625
desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
16161626
separate_provide_extern

0 commit comments

Comments
 (0)