diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-09-13 17:27:56 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-09-13 17:27:56 +0200 |
| commit | de184a63a64127516468fea9cf5f662974e5bcf6 (patch) | |
| tree | 0c59ded3593eb61a96e4417d26974564ab2db523 /compiler/rustc_middle | |
| parent | c81575657c9591d07c12778fe74c326e5ac76558 (diff) | |
| download | rust-de184a63a64127516468fea9cf5f662974e5bcf6.tar.gz rust-de184a63a64127516468fea9cf5f662974e5bcf6.zip | |
Add documentation for TyCtxt::visibility
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 10 |
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 f72e7389fc6..e7e039d80de 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 |
