about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-08-09 09:59:50 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-08-23 06:30:43 -0700
commit511e7626aebe7a8a41c3be1c6fbd16c92e8f9386 (patch)
treeaea0830fc0eb00431d95c5b41550ee1e99e99da2 /src/libsyntax
parent8185ede1fad8312244e418b3c082f87386c40145 (diff)
downloadrust-511e7626aebe7a8a41c3be1c6fbd16c92e8f9386.tar.gz
rust-511e7626aebe7a8a41c3be1c6fbd16c92e8f9386.zip
Infer variance of types with respect to the region parameter.
A similar approach could be used for type parameters.

Fixes #2282.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_map.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 2cc8cb23f2e..9c90a422c53 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -299,7 +299,20 @@ fn node_id_to_str(map: map, id: node_id, itr: ident_interner) -> ~str {
         fmt!{"unknown node (id=%d)", id}
       }
       some(node_item(item, path)) => {
-        fmt!{"item %s (id=%?)", path_ident_to_str(*path, item.ident, itr), id}
+        let path_str = path_ident_to_str(*path, item.ident, itr);
+        let item_str = match item.node {
+          item_const(*) => ~"const",
+          item_fn(*) => ~"fn",
+          item_mod(*) => ~"mod",
+          item_foreign_mod(*) => ~"foreign mod",
+          item_ty(*) => ~"ty",
+          item_enum(*) => ~"enum",
+          item_class(*) => ~"class",
+          item_trait(*) => ~"trait",
+          item_impl(*) => ~"impl",
+          item_mac(*) => ~"macro"
+        };
+        fmt!("%s %s (id=%?)", item_str, path_str, id)
       }
       some(node_foreign_item(item, abi, path)) => {
         fmt!{"foreign item %s with abi %? (id=%?)",