Commit Graph

48 Commits

Author SHA1 Message Date
Alex Crichton 3d8ca595a1 rustdoc: Don't try to inline the crate root
Fixes other test cases found in #16274
2014-09-23 15:19:30 -07:00
Alex Crichton d2b30f7d38 rustdoc: Prevent infinite recursion when inlining
Cyclic pub-use chains triggered infinite recursion, and this commit adds a hash
set to guard against cyclic recursion. This will cause one of the reexports to
render as a `pub use` instead of inlining the documentation.

Closes #16274
2014-09-23 15:13:56 -07:00
Eduard Burtescu 9295454ff5 rustdoc: fix fallout from using ptr::P. 2014-09-14 04:20:34 +03:00
Eduard Burtescu 8bfbcddf53 rustdoc: fix fallout from the addition of a 'tcx lifetime on tcx. 2014-09-08 15:28:25 +03:00
Niko Matsakis 1b487a8906 Implement generalized object and type parameter bounds (Fixes #16462) 2014-08-27 21:46:52 -04:00
Patrick Walton 604af3f6c0 librustc: Implement simple `where` clauses.
These `where` clauses are accepted everywhere generics are currently
accepted and desugar during type collection to the type parameter bounds
we have today.

A new keyword, `where`, has been added. Therefore, this is a breaking
change. Change uses of `where` to other identifiers.

[breaking-change]
2014-08-14 14:14:26 -07:00
Patrick Walton 9907fa4acc librustc: Stop assuming that implementations and traits only contain
methods.

This paves the way to associated items by introducing an extra level of
abstraction ("impl-or-trait item") between traits/implementations and
methods. This new abstraction is encoded in the metadata and used
throughout the compiler where appropriate.

There are no functional changes; this is purely a refactoring.
2014-08-14 11:40:22 -07:00
P1start 32f5898bea Implement Index for HashMap
This also deprecates HashMap::get. Use indexing instead.
2014-08-12 15:33:05 +12:00
Alex Crichton 8d7eb0598a rustdoc: Correctly handle local renamings
Previously a `pub use` would not rename the destination in rustdoc, it would
always use the destination ident instead of the renamed ident.
2014-07-25 10:24:29 -07:00
John Clements 1607064cfe repair macro docs
In f1ad425199, I changed the handling
of macros, to prevent macro invocations from occurring in fully expanded
source. Instead, I added a side table. It contained only the
spans of the macros, because this was the only information required
in order to make macro export work.

However, librustdoc was also affected by this change, since it
extracts macro information in a similar way. As a result of the earlier
change, exported macros were no longer documented.

In order to repair this, I've adjusted the side table to contain whole
items, rather than just the spans.
2014-07-21 09:54:07 -07:00
Jakub Wieczorek 4b9bc2e8f2 Implement new mod import sugar
Implements RFC #168.
2014-07-20 12:40:08 +02:00
Aaron Turon 256df5e3df rustdoc: incorporate stability index throughout
This commit hooks rustdoc into the stability index infrastructure in two
ways:

1. It looks up stability levels via the index, rather than by manual
attributes.

2. It adds stability level information throughout rustdoc output, rather
than just at the top header. In particular, a stability color (with
mouseover text) appears next to essentially every item that appears
in rustdoc's HTML output.

Along the way, the stability index code has been lightly refactored.
2014-06-30 22:36:24 -07:00
Alex Crichton ade807c6dc rustc: Obsolete the `@` syntax entirely
This removes all remnants of `@` pointers from rustc. Additionally, this removes
the `GC` structure from the prelude as it seems odd exporting an experimental
type in the prelude by default.

Closes #14193
[breaking-change]
2014-06-14 10:45:37 -07:00
Alex Crichton 54c2a1e1ce rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
Niko Matsakis 0f03b5608c Move Def out of syntax crate, where it does not belong 2014-06-06 19:51:23 -04:00
Alex Crichton 52955dd661 rustdoc: Allow forcing inlining of `pub use`
Rustdoc currently doesn't inline documentation of a `pub use` if the target is
publicly reachable. This changes rustdoc to allow a #[doc(inline)] attribute to
force inlining the documentation, regardless of whether the targe is public or
not.

Closes #13045
2014-05-03 02:09:30 -07:00
bors a1ad41b93d auto merge of #13791 : lifthrasiir/rust/mod-inner-span, r=huonw
This PR is primarily motivated by (and fixes) #12926.

We currently only have a span for the individual item itself and not for the referred contents. This normally does not cause a problem since both are located in the same file; it *is* possible that the contained statement or item is located in the other file (the syntax extension can do that), but even in that case the syntax extension should be located in the same file as the item. The module item (i.e. `mod foo;`) is the only exception here, and thus warrants a special treatment.

Rustdoc would now distinguish `mod foo;` from `mod foo {...}` by checking if the span for the module item and module contents is in different files. If it's the case, we'd prefer module contents over module item. There are alternative strategies, but as noted above we will have some corner cases if we don't record the contents span explicitly.
2014-04-28 05:21:46 -07:00
Kang Seonghoon c8a29c4c59 rustdoc: External module item links to the module contents. Fixes #12926.
the basic strategy is to distinguish `mod foo;` from `mod foo {...}`
by checking if the span for the module item and module contents is
in different files. if it's the case, we prefer module contents.

it is technically possible to fix #12926 without changing the AST,
probably by checking the individual items' span. this is not without
a problem though, since it is possible that some items inside
`mod foo {...}` may have originated from other file (e.g. `include!`).
therefore it is better to record both spans explicitly.
2014-04-27 19:54:31 +09:00
Kang Seonghoon b03547bac1 syntax: ViewItemUse no longer contains multiple view paths.
it reflected the obsolete syntax `use a, b, c;` and did not make
past the parser (though it was a non-fatal error so we can continue).
this legacy affected many portions of rustc and rustdoc as well,
so this commit cleans them up altogether.
2014-04-26 22:33:45 +09:00
Nick Cameron f78add10cd Support unsized types with the `type` keyword 2014-04-23 12:30:58 +12:00
Kasey Carrothers 0bf4e900d4 Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and updated associated variable and function names. 2014-04-10 15:22:00 -07:00
Alex Crichton 57e0908af3 syntax: Remove AbiSet, use one Abi
This change removes the AbiSet from the AST, converting all usage to have just
one Abi value. The current scheme selects a relevant ABI given a list of ABIs
based on the target architecture and how relevant each ABI is to that
architecture.

Instead of this mildly complicated scheme, only one ABI will be allowed in abi
strings, and pseudo-abis will be created for special cases as necessary. For
example the "system" abi exists for stdcall on win32 and C on win64.

Closes #10049
2014-04-03 13:43:45 -07:00
Alex Crichton eb08e8fec2 rustdoc: Switch field privacy as necessary 2014-03-31 15:47:36 -07:00
Alex Crichton 6a7fd8cfa5 rustdoc: Fix fallout of removing get() 2014-03-22 08:48:20 -07:00
Patrick Walton af79a5aa7d test: Make manual changes to deal with the fallout from removal of
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
2014-03-21 23:37:21 +11:00
Alex Crichton da3625161d Removing imports of std::vec_ng::Vec
It's now in the prelude.
2014-03-20 09:30:14 -07:00
Daniel Micay 14f656d1a7 rename std::vec_ng -> std::vec
Closes #12771
2014-03-20 04:25:32 -04:00
Eduard Burtescu 4fae06824c De-@ Session usage. 2014-03-17 09:53:06 +02:00
Liigo Zhuang 2271860af1 rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and clean::ExternMod to clean::ExternCrate 2014-03-07 15:57:45 +08:00
Patrick Walton 0c6622aa0f librustdoc: Fix errors arising from the automated `~[T]` conversion 2014-03-01 22:40:53 -08:00
Florian Hahn 5d825def29 Mark top level module as a crate in rustdoc, closes #12507 2014-02-26 14:00:00 +01:00
Alex Crichton 867988c1dc rustdoc: Show macros in documentation
Any macro tagged with #[macro_export] will be showed in the documentation for
that module. This also documents all the existing macros inside of std::macros.

Closes #3163
cc #5605
Closes #9954
2014-02-19 01:10:31 -08:00
Eduard Burtescu a02b10a062 Refactored ast_map and friends, mainly to have Paths without storing them. 2014-02-14 08:43:29 +02:00
Flavio Percoco 968633b60a Replace `crate` usage with `krate`
This patch replaces all `crate` usage with `krate` before introducing the
new keyword. This ensures that after introducing the keyword, there
won't be any compilation errors.

krate might not be the most expressive substitution for crate but it's a
very close abbreviation for it. `module` was already used in several
places already.
2014-02-13 20:52:07 +01:00
Huon Wilson 68517a2cca syntax: convert ast_map to use a SmallIntMap.
NodeIds are sequential integers starting at zero, so we can achieve some
memory savings by just storing the items all in a line in a vector.

The occupancy for typical crates seems to be 75-80%, so we're already
more efficient than a HashMap (maximum occupancy 75%), not even counting
the extra book-keeping that HashMap does.
2014-01-19 12:56:26 +11:00
Eduard Burtescu 72ee4a57b7 Updated librustdoc and librustpkg to use the proper UpperCase names from libsyntax. 2014-01-09 22:25:28 +02:00
Eduard Burtescu 6b221768cf libsyntax: Renamed types, traits and enum variants to CamelCase. 2014-01-09 22:25:28 +02:00
Alex Crichton 3425901d93 Inline reexports in rustdoc
If a reexport comes from a non-public module, then the documentation for the
reexport will be inlined into the module that exports it, but if the reexport is
targeted at a public type (like the prelude), then it is not inlined but rather
hyperlinked.
2014-01-07 18:46:16 -08:00
Patrick Walton c38456a92f librustdoc: De-`@mut` `librustdoc` 2014-01-03 14:02:00 -08:00
Alex Crichton 6c9c045064 rustdoc: Add the ability to test code in comments
This adds support for the `--test` flag to rustdoc which will parse a crate,
extract all code examples in doc comments, and then run each test in the
extra::test driver.
2013-12-23 09:10:36 -08:00
bors df41115213 auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton 2013-12-01 05:42:06 -08:00
Philipp Brüschweiler 47ce981903 ast: Remove one `@` and fix the fallout 2013-12-01 11:24:58 +01:00
Eduard Burtescu a9c4b18b18 Box Block, fn_decl, variant and Ty in the AST, as they were inflating critical enum sizes. 2013-12-01 00:00:39 +02:00
Alex Crichton daf5f5a4d1 Drop the '2' suffix from logging macros
Who doesn't like a massive renaming?
2013-10-22 08:09:56 -07:00
Alex Crichton a7f19f36be rustdoc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
Alex Crichton ca697d3705 rustdoc: Generate documentation for foreign items
This slurps up everything inside of an 'extern' block into the enclosing module
in order to document them. The documentation must be on the items themselves,
and they'll show up next to everything else on the module index pages.

Closes #5953
2013-09-26 11:57:25 -07:00
Alex Crichton acab4a8c8e rustdoc: Emit purity to function dox for traits
Closes #3804
2013-09-25 14:27:42 -07:00
Alex Crichton 7b24efd6f3 rustdoc: Out with the old, in with the new
Removes old rustdoc, moves rustdoc_ng into its place instead (plus drops the _ng
suffix). Also shreds all reference to rustdoc_ng from the Makefile rules.
2013-09-22 09:51:15 -07:00