about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rustdoc/attr_pass.rs4
-rw-r--r--src/rustdoc/desc_to_brief_pass.rs2
-rw-r--r--src/rustdoc/extract.rs14
-rw-r--r--src/rustdoc/markdown_pass.rs30
-rw-r--r--src/rustdoc/sectionalize_pass.rs2
-rw-r--r--src/rustdoc/sort_item_type_pass.rs4
-rw-r--r--src/rustdoc/text_pass.rs12
-rw-r--r--src/rustdoc/tystr_pass.rs8
8 files changed, 39 insertions, 37 deletions
diff --git a/src/rustdoc/attr_pass.rs b/src/rustdoc/attr_pass.rs
index 85c12995316..ba737a725bf 100644
--- a/src/rustdoc/attr_pass.rs
+++ b/src/rustdoc/attr_pass.rs
@@ -271,14 +271,14 @@ fn fold_impl(
 #[test]
 fn should_extract_impl_docs() {
     let doc = test::mk_doc(
-        ~"#[doc = \"whatever\"] impl i for int { fn a() { } }");
+        ~"#[doc = \"whatever\"] impl int { fn a() { } }");
     assert doc.cratemod().impls()[0].desc() == some(~"whatever");
 }
 
 #[test]
 fn should_extract_impl_method_docs() {
     let doc = test::mk_doc(
-        ~"impl i for int {\
+        ~"impl int {\
          #[doc = \"desc\"]\
          fn f(a: bool) -> bool { }\
          }");
diff --git a/src/rustdoc/desc_to_brief_pass.rs b/src/rustdoc/desc_to_brief_pass.rs
index 661eb3f879e..c8ec7e7f40c 100644
--- a/src/rustdoc/desc_to_brief_pass.rs
+++ b/src/rustdoc/desc_to_brief_pass.rs
@@ -77,7 +77,7 @@ fn should_promote_trait_method_desc() {
 #[test]
 fn should_promote_impl_method_desc() {
     let doc = test::mk_doc(
-        ~"impl i for int { #[doc = \"desc\"] fn a() { } }");
+        ~"impl int { #[doc = \"desc\"] fn a() { } }");
     assert doc.cratemod().impls()[0].methods[0].brief == some(~"desc");
 }
 
diff --git a/src/rustdoc/extract.rs b/src/rustdoc/extract.rs
index a94256460a2..9fd4cea4bfd 100644
--- a/src/rustdoc/extract.rs
+++ b/src/rustdoc/extract.rs
@@ -249,20 +249,8 @@ fn impldoc_from_impl(
 }
 
 #[test]
-fn should_extract_impls_with_names() {
-    let doc = test::mk_doc(~"impl i for int { fn a() { } }");
-    assert doc.cratemod().impls()[0].name() == ~"i";
-}
-
-#[test]
-fn should_extract_impls_without_names() {
-    let doc = test::mk_doc(~"impl of i for int { fn a() { } }");
-    assert doc.cratemod().impls()[0].name() == ~"i";
-}
-
-#[test]
 fn should_extract_impl_methods() {
-    let doc = test::mk_doc(~"impl i for int { fn f() { } }");
+    let doc = test::mk_doc(~"impl int { fn f() { } }");
     assert doc.cratemod().impls()[0].methods[0].name == ~"f";
 }
 
diff --git a/src/rustdoc/markdown_pass.rs b/src/rustdoc/markdown_pass.rs
index 6ddd8f29b65..4ac2646f1a0 100644
--- a/src/rustdoc/markdown_pass.rs
+++ b/src/rustdoc/markdown_pass.rs
@@ -241,7 +241,21 @@ fn header_name(doc: doc::itemtag) -> ~str {
 }
 
 fn header_text(doc: doc::itemtag) -> ~str {
-    header_text_(header_kind(doc), header_name(doc))
+    match doc {
+      doc::impltag(impldoc) => {
+        let header_kind = header_kind(doc);
+        let desc = if impldoc.trait_types.is_empty() {
+            fmt!{"for `%s`", impldoc.self_ty.get()}
+        } else {
+            fmt!{"of `%s` for `%s`", impldoc.trait_types[0],
+                 impldoc.self_ty.get()}
+        };
+        fmt!{"%s %s", header_kind, desc}
+      }
+      _ => {
+        header_text_(header_kind(doc), header_name(doc))
+      }
+    }
 }
 
 fn header_text_(kind: ~str, name: ~str) -> ~str {
@@ -697,34 +711,34 @@ fn write_impl(ctxt: ctxt, doc: doc::impldoc) {
 
 #[test]
 fn should_write_impl_header() {
-    let markdown = test::render(~"impl i for int { fn a() { } }");
-    assert str::contains(markdown, ~"## Implementation `i for int`");
+    let markdown = test::render(~"impl int { fn a() { } }");
+    assert str::contains(markdown, ~"## Implementation for `int`");
 }
 
 #[test]
 fn should_write_impl_header_with_trait() {
-    let markdown = test::render(~"impl i of j for int { fn a() { } }");
-    assert str::contains(markdown, ~"## Implementation `i of j for int`");
+    let markdown = test::render(~"impl int: j { fn a() { } }");
+    assert str::contains(markdown, ~"## Implementation of `j` for `int`");
 }
 
 #[test]
 fn should_write_impl_desc() {
     let markdown = test::render(
-        ~"#[doc = \"desc\"] impl i for int { fn a() { } }");
+        ~"#[doc = \"desc\"] impl int { fn a() { } }");
     assert str::contains(markdown, ~"desc");
 }
 
 #[test]
 fn should_write_impl_method_header() {
     let markdown = test::render(
-        ~"impl i for int { fn a() { } }");
+        ~"impl int { fn a() { } }");
     assert str::contains(markdown, ~"### Method `a`");
 }
 
 #[test]
 fn should_write_impl_method_signature() {
     let markdown = test::render(
-        ~"impl i for int { fn a() { } }");
+        ~"impl int { fn a() { } }");
     assert str::contains(markdown, ~"\n    fn a()");
 }
 
diff --git a/src/rustdoc/sectionalize_pass.rs b/src/rustdoc/sectionalize_pass.rs
index 0ff86ecbcbe..1bc155f5d9e 100644
--- a/src/rustdoc/sectionalize_pass.rs
+++ b/src/rustdoc/sectionalize_pass.rs
@@ -217,7 +217,7 @@ fn should_sectionalize_trait_methods() {
 #[test]
 fn should_sectionalize_impl_methods() {
     let doc = test::mk_doc(
-        ~"impl i for bool {
+        ~"impl bool {
          #[doc = \"\
          # Header\n\
          Body\"]\
diff --git a/src/rustdoc/sort_item_type_pass.rs b/src/rustdoc/sort_item_type_pass.rs
index 1d619f0a8f1..1ea88f01dbb 100644
--- a/src/rustdoc/sort_item_type_pass.rs
+++ b/src/rustdoc/sort_item_type_pass.rs
@@ -34,7 +34,7 @@ fn test() {
          fn ifn() { } \
          enum ienum { ivar } \
          trait itrait { fn a(); } \
-         impl iimpl for int { fn a() { } } \
+         impl int { fn a() { } } \
          type itype = int;";
     do astsrv::from_str(source) |srv| {
         let doc = extract::from_srv(srv, ~"");
@@ -43,7 +43,7 @@ fn test() {
         assert doc.cratemod().items[1].name() == ~"itype";
         assert doc.cratemod().items[2].name() == ~"ienum";
         assert doc.cratemod().items[3].name() == ~"itrait";
-        assert doc.cratemod().items[4].name() == ~"iimpl";
+        assert doc.cratemod().items[4].name() == ~"__extensions__";
         assert doc.cratemod().items[5].name() == ~"ifn";
         assert doc.cratemod().items[6].name() == ~"imod";
         assert doc.cratemod().items[7].name() == ~"inmod";
diff --git a/src/rustdoc/text_pass.rs b/src/rustdoc/text_pass.rs
index 886e76808fe..e9a90455968 100644
--- a/src/rustdoc/text_pass.rs
+++ b/src/rustdoc/text_pass.rs
@@ -145,28 +145,28 @@ fn should_execute_op_on_trait_method_desc() {
 #[test]
 fn should_execute_op_on_impl_brief() {
     let doc = test::mk_doc(
-        ~"#[doc = \" a \"] impl i for int { fn a() { } }");
+        ~"#[doc = \" a \"] impl int { fn a() { } }");
     assert doc.cratemod().impls()[0].brief() == some(~"a");
 }
 
 #[test]
 fn should_execute_op_on_impl_desc() {
     let doc = test::mk_doc(
-        ~"#[doc = \" a \"] impl i for int { fn a() { } }");
+        ~"#[doc = \" a \"] impl int { fn a() { } }");
     assert doc.cratemod().impls()[0].desc() == some(~"a");
 }
 
 #[test]
 fn should_execute_op_on_impl_method_brief() {
     let doc = test::mk_doc(
-        ~"impl i for int { #[doc = \" a \"] fn a() { } }");
+        ~"impl int { #[doc = \" a \"] fn a() { } }");
     assert doc.cratemod().impls()[0].methods[0].brief == some(~"a");
 }
 
 #[test]
 fn should_execute_op_on_impl_method_desc() {
     let doc = test::mk_doc(
-        ~"impl i for int { #[doc = \" a \"] fn a() { } }");
+        ~"impl int { #[doc = \" a \"] fn a() { } }");
     assert doc.cratemod().impls()[0].methods[0].desc == some(~"a");
 }
 
@@ -230,7 +230,7 @@ fn should_execute_on_trait_method_section_bodies() {
 #[test]
 fn should_execute_on_impl_method_section_headers() {
     let doc = test::mk_doc(
-        ~"impl i for bool {
+        ~"impl bool {
          #[doc = \"\
          # Header   \n\
          Body\"]\
@@ -242,7 +242,7 @@ fn should_execute_on_impl_method_section_headers() {
 #[test]
 fn should_execute_on_impl_method_section_bodies() {
     let doc = test::mk_doc(
-        ~"impl i for bool {
+        ~"impl bool {
          #[doc = \"\
          # Header\n\
          Body    \"]\
diff --git a/src/rustdoc/tystr_pass.rs b/src/rustdoc/tystr_pass.rs
index 83e95bcea48..6c89f0dc769 100644
--- a/src/rustdoc/tystr_pass.rs
+++ b/src/rustdoc/tystr_pass.rs
@@ -254,25 +254,25 @@ fn fold_impl(
 
 #[test]
 fn should_add_impl_trait_types() {
-    let doc = test::mk_doc(~"impl i of j for int { fn a<T>() { } }");
+    let doc = test::mk_doc(~"impl int: j { fn a<T>() { } }");
     assert doc.cratemod().impls()[0].trait_types[0] == ~"j";
 }
 
 #[test]
 fn should_not_add_impl_trait_types_if_none() {
-    let doc = test::mk_doc(~"impl i for int { fn a() { } }");
+    let doc = test::mk_doc(~"impl int { fn a() { } }");
     assert vec::len(doc.cratemod().impls()[0].trait_types) == 0;
 }
 
 #[test]
 fn should_add_impl_self_ty() {
-    let doc = test::mk_doc(~"impl i for int { fn a() { } }");
+    let doc = test::mk_doc(~"impl int { fn a() { } }");
     assert doc.cratemod().impls()[0].self_ty == some(~"int");
 }
 
 #[test]
 fn should_add_impl_method_sigs() {
-    let doc = test::mk_doc(~"impl i for int { fn a<T>() -> int { fail } }");
+    let doc = test::mk_doc(~"impl int { fn a<T>() -> int { fail } }");
     assert doc.cratemod().impls()[0].methods[0].sig
         == some(~"fn a<T>() -> int");
 }