Skip to content

Commit

Permalink
Rollup merge of #101765 - GuillaumeGomez:tyctxt-visibility-doc, r=jyn514
Browse files Browse the repository at this point in the history
Add documentation for TyCtxt::visibility

We encountered this issue while working on #98450.

cc ``@lqd``
r? ``@cjgillot``
  • Loading branch information
matthiaskrgr authored Sep 13, 2022
2 parents 2f6874d + de184a6 commit 68dc639
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 68dc639

Please sign in to comment.