Clarify types of `ctx.attr.<attr_name>` objects.

PiperOrigin-RevId: 179053724
diff --git a/site/docs/skylark/rules.md b/site/docs/skylark/rules.md
index 7b87852..ced17c6 100644
--- a/site/docs/skylark/rules.md
+++ b/site/docs/skylark/rules.md
@@ -74,8 +74,11 @@
 
 Labels listed in `attr` will be inputs to the rule.
 
-To access an attribute in a rule's implementation, use
-`ctx.attr.<attribute_name>`. The name and the package of a rule are available
+To access an attribute in a rule's implementation, use `ctx.attr.<attribute_name>`.
+This field will have the type given in the rule's `attrs` dictionary corresponding to
+`<attribute_name>`.
+
+The name and the package of a rule are available
 with `ctx.label.name` and `ctx.label.package`.
 
 See [an example](cookbook.md#attr) of using `attr` in a rule.
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
index c80c7c1..20bb7b8 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
@@ -137,7 +137,9 @@
           + "<pre class=language-python>list(ctx.attr.&lt;ATTR&gt;.files)[0]</pre>";
   public static final String ATTR_DOC =
       "A struct to access the values of the attributes. The values are provided by "
-          + "the user (if not, a default value is used).";
+          + "the user (if not, a default value is used). The attributes of the struct and the "
+          + "types of their values correspond to the keys and values of the <code>attrs</code> "
+          + "dict provided to the <code>rule</code> function.";
   public static final String SPLIT_ATTR_DOC =
       "A struct to access the values of attributes with split configurations. If the attribute is "
           + "a label list, the value of split_attr is a dict of the keys of the split (as strings) "