about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2020-07-02 21:45:28 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2020-10-06 11:19:31 +0100
commit8787090964e33cd633671025d9acf20dfeaf8765 (patch)
treecc0105e7b07ba2da7a859962ec29e48b7e16f08d /compiler/rustc_middle/src/query
parent21eccbb587d7e9cff6fc6ebbd2a8844e8993fee4 (diff)
downloadrust-8787090964e33cd633671025d9acf20dfeaf8765.tar.gz
rust-8787090964e33cd633671025d9acf20dfeaf8765.zip
Address review comments
Diffstat (limited to 'compiler/rustc_middle/src/query')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs24
1 files changed, 20 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 8b94818d8e6..808a0793a94 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -159,9 +159,8 @@ rustc_queries! {
         /// Returns the list of bounds that can be used for
         /// `SelectionCandidate::ProjectionCandidate` and
         /// `ProjectionTyCandidate::TraitDef`.
-        /// Specifically this is the bounds (equivalent to) those
-        /// written on the trait's type definition, or those
-        /// after the `impl` keyword
+        /// Specifically this is the bounds written on the trait's type
+        /// definition, or those after the `impl` keyword
         ///
         /// type X: Bound + 'lt
         ///         ^^^^^^^^^^^
@@ -169,11 +168,28 @@ rustc_queries! {
         ///      ^^^^^^^^^^^^^^^
         ///
         /// `key` is the `DefId` of the associated type or opaque type.
+        ///
+        /// Bounds from the parent (e.g. with nested impl trait) are not included.
         query explicit_item_bounds(key: DefId) -> &'tcx [(ty::Predicate<'tcx>, Span)] {
             desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
         }
 
-        /// Elaborated the predicates from `explicit_item_bounds`.
+        /// Elaborated version of the predicates from `explicit_item_bounds`.
+        ///
+        /// Example for
+        ///
+        /// trait MyTrait {
+        ///     type MyAType: Eq + ?Sized`
+        /// }
+        ///
+        /// `explicit_item_bounds` returns `[<Self as MyTrait>::MyAType: Eq]`,
+        /// and `item_bounds` returns
+        /// [
+        ///     <Self as Trait>::MyAType: Eq,
+        ///     <Self as Trait>::MyAType: PartialEq<<Self as Trait>::MyAType>
+        /// ]
+        ///
+        /// Bounds from the parent (e.g. with nested impl trait) are not included.
         query item_bounds(key: DefId) -> &'tcx ty::List<ty::Predicate<'tcx>> {
             desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
         }