about summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
AgeCommit message (Collapse)AuthorLines
2014-08-01Fix misspelled comments.Joseph Crail-1/+1
2014-07-29auto merge of #15989 : pcwalton/rust/borrowck-pattern-guards, r=pnkfelixbors-10/+12
the CFG for match statements. There were two bugs in issue #14684. One was simply that the borrow check didn't know about the correct CFG for match statements: the pattern must be a predecessor of the guard. This disallows the bad behavior if there are bindings in the pattern. But it isn't enough to prevent the memory safety problem, because of wildcards; thus, this patch introduces a more restrictive rule, which disallows assignments and mutable borrows inside guards outright. I discussed this with Niko and we decided this was the best plan of action. This breaks code that performs mutable borrows in pattern guards. Most commonly, the code looks like this: impl Foo { fn f(&mut self, ...) {} fn g(&mut self, ...) { match bar { Baz if self.f(...) => { ... } _ => { ... } } } } Change this code to not use a guard. For example: impl Foo { fn f(&mut self, ...) {} fn g(&mut self, ...) { match bar { Baz => { if self.f(...) { ... } else { ... } } _ => { ... } } } } Sometimes this can result in code duplication, but often it illustrates a hidden memory safety problem. Closes #14684. [breaking-change] r? @pnkfelix
2014-07-26rustdoc: Keep hidden struct fields out of searchTom Jakubowski-1/+5
Previously, private and `#[doc(hidden)]` struct fields appeared in the search index despite being hidden from the struct's documentation. Fix #15490
2014-07-25librustc: Disallow mutation and assignment in pattern guards, and modifyPatrick Walton-10/+12
the CFG for match statements. There were two bugs in issue #14684. One was simply that the borrow check didn't know about the correct CFG for match statements: the pattern must be a predecessor of the guard. This disallows the bad behavior if there are bindings in the pattern. But it isn't enough to prevent the memory safety problem, because of wildcards; thus, this patch introduces a more restrictive rule, which disallows assignments and mutable borrows inside guards outright. I discussed this with Niko and we decided this was the best plan of action. This breaks code that performs mutable borrows in pattern guards. Most commonly, the code looks like this: impl Foo { fn f(&mut self, ...) {} fn g(&mut self, ...) { match bar { Baz if self.f(...) => { ... } _ => { ... } } } } Change this code to not use a guard. For example: impl Foo { fn f(&mut self, ...) {} fn g(&mut self, ...) { match bar { Baz => { if self.f(...) { ... } else { ... } } _ => { ... } } } } Sometimes this can result in code duplication, but often it illustrates a hidden memory safety problem. Closes #14684. [breaking-change]
2014-07-17deprecate Vec::getNick Cameron-1/+1
2014-07-15Fix errorsAdolfo Ochagavía-2/+2
2014-07-15Deprecate `str::from_utf8_owned`Adolfo Ochagavía-1/+1
Use `String::from_utf8` instead [breaking-change]
2014-07-12auto merge of #15602 : adrientetar/rust/name-fix, r=huonwbors-2/+2
Not sure how I did miss that in the first place... r? @alexcrichton
2014-07-11webfonts: name fixAdrien Tétar-2/+2
2014-07-10rustdoc: Add stability dashboardAaron Turon-5/+51
This commit adds a crate-level dashboard summarizing the stability levels of all items for all submodules of the crate. The information is also written as a json file, intended for consumption by pages like http://huonw.github.io/isrustfastyet/ Closes #13541
2014-07-09auto merge of #15530 : adrientetar/rust/proper-fonts, r=alexcrichtonbors-4/+8
- Treat WOFF as binary files so that git does not perform newline normalization. - Replace corrupt Heuristica files with Source Serif Pro — italics are [almost in production](https://github.com/adobe/source-serif-pro/issues/2) so I left Heuristica Italic which makes a good pair with SSP. Overall, Source Serif Pro is I think a better fit for rustdoc (cc @TheHydroImpulse). This ought to fix #15527. - Store Source Code Pro locally in order to make offline docs freestanding. Fixes #14778. Preview: http://adrientetar.legtux.org/cached/rust-docs/core.html r? @alexcrichton
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-1/+1
[breaking-change]
2014-07-08webfonts: serve Source Code Pro locallyAdrien Tétar-0/+4
So that we have freestanding docs.
2014-07-08webfonts: proper fixAdrien Tétar-4/+4
2014-06-30rustdoc: incorporate stability index throughoutAaron Turon-63/+60
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-30Allow external html in rustdoc for crates.zzmp-2/+6
Updated documentation to reflect md->html. Modularized external file loading.
2014-06-26Remove unnecessary to_string callsPiotr Jawniak-2/+1
This commit removes superfluous to_string calls from various places
2014-06-18Deprecate the bytes!() macro.Simon Sapin-2/+2
Replace its usage with byte string literals, except in `bytes!()` tests. Also add a new snapshot, to be able to use the new b"foo" syntax. The src/etc/2014-06-rewrite-bytes-macros.py script automatically rewrites `bytes!()` invocations into byte string literals. Pass it filenames as arguments to generate a diff that you can inspect, or `--apply` followed by filenames to apply the changes in place. Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-13rustdoc: Larger click areas for sidebar itemsValentin Tsatskin-1/+1
* Change links to display:block for click larger targets * Remove linebreaks due to extra space * Adjust margins so that element spacing stays the same * Sidebar item hover background colour chosen from <pre> styling
2014-06-11std: Remove i18n/l10n from format!Alex Crichton-32/+28
* The select/plural methods from format strings are removed * The # character no longer needs to be escaped * The \-based escapes have been removed * '{{' is now an escape for '{' * '}}' is now an escape for '}' Closes #14810 [breaking-change]
2014-06-11sync: Move underneath libstdAlex Crichton-1/+1
This commit is the final step in the libstd facade, #13851. The purpose of this commit is to move libsync underneath the standard library, behind the facade. This will allow core primitives like channels, queues, and atomics to all live in the same location. There were a few notable changes and a few breaking changes as part of this movement: * The `Vec` and `String` types are reexported at the top level of libcollections * The `unreachable!()` macro was copied to libcore * The `std::rt::thread` module was moved to librustrt, but it is still reexported at the same location. * The `std::comm` module was moved to libsync * The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`. It is now a private module with types/functions being reexported under `sync::comm`. This is a breaking change for any existing users of duplex streams. * All concurrent queues/deques were moved directly under libsync. They are also all marked with #![experimental] for now if they are public. * The `task_pool` and `future` modules no longer live in libsync, but rather live under `std::sync`. They will forever live at this location, but they may move to libsync if the `std::task` module moves as well. [breaking-change]
2014-06-06rustdoc: Submit examples to play.rust-lang.orgAlex Crichton-2/+13
This grows a new option inside of rustdoc to add the ability to submit examples to an external website. If the `--markdown-playground-url` command line option or crate doc attribute `html_playground_url` is present, then examples will have a button on hover to submit the code to the playground specified. This commit enables submission of example code to play.rust-lang.org. The code submitted is that which is tested by rustdoc, not necessarily the exact code shown in the example. Closes #14654
2014-06-06Rename Iterator::len to countAaron Turon-1/+1
This commit carries out the request from issue #14678: > The method `Iterator::len()` is surprising, as all the other uses of > `len()` do not consume the value. `len()` would make more sense to be > called `count()`, but that would collide with the current > `Iterator::count(|T| -> bool) -> unit` method. That method, however, is > a bit redundant, and can be easily replaced with > `iter.filter(|x| x < 5).count()`. > After this change, we could then define the `len()` method > on `iter::ExactSize`. Closes #14678. [breaking-change]
2014-06-06rustdoc: Inline static documentation across cratesAlex Crichton-2/+3
2014-06-05Fallout from the libcollections movementAlex Crichton-1/+1
2014-06-03rustdoc: Put primitives in respective modulesAlex Crichton-14/+21
The logical location for the documentation of a primitive is in the module that declared it was a module for that primitive.
2014-06-02rustdoc: Deduplicate lists of implementorsAlex Crichton-0/+7
Inlining caused implementors to show up multiple times. cc #14584
2014-05-31rustdoc: Fix cross-crate links to reexported itemsAlex Crichton-19/+64
Cross crate links can target items which are not rendered in the documentation. If the item is reexported at a higher level, the destination of the link (a concatenation of the fully qualified name) may actually lead to nowhere. This fixes this problem by altering rustdoc to emit pages which redirect to the local copy of the reexported structure. cc #14515 Closes #14137
2014-05-31doc: Fix a number of broken linksAlex Crichton-4/+9
cc #14515
2014-05-31rustdoc: Create anchor pages for primitive typesAlex Crichton-32/+101
This commit adds support in rustdoc to recognize the `#[doc(primitive = "foo")]` attribute. This attribute indicates that the current module is the "owner" of the primitive type `foo`. For rustdoc, this means that the doc-comment for the module is the doc-comment for the primitive type, plus a signal to all downstream crates that hyperlinks for primitive types will be directed at the crate containing the `#[doc]` directive. Additionally, rustdoc will favor crates closest to the one being documented which "implements the primitive type". For example, documentation of libcore links to libcore for primitive types, but documentation for libstd and beyond all links to libstd for primitive types. This change involves no compiler modifications, it is purely a rustdoc change. The landing pages for the primitive types primarily serve to show a list of implemented traits for the primitive type itself. The primitive types documented includes both strings and slices in a semi-ad-hoc way, but in a way that should provide at least somewhat meaningful documentation. Closes #14474
2014-05-31rustdoc: Show all implementors of traitsAlex Crichton-55/+37
When inlining documentation across crates, primitive implementors of traits were not shown. This commit tweaks the infrastructure to treat primitive and Path-like impls the same way, displaying all implementors everywhere. cc #14462
2014-05-31rustdoc: Freeze the cache ASAPAlex Crichton-6/+9
The cache is going to be used earlier in the HTML generation process, which means that it needs to get into TLS as soon as possible.
2014-05-31rustdoc: Refactor structure of html::runAlex Crichton-166/+179
Instead of one giant function, this breaks it up into several smaller functions which have explicit dependencies among one another. There are no code changes as a result of this commit.
2014-05-28std: Remove format_strbuf!()Alex Crichton-5/+5
This was only ever a transitionary macro.
2014-05-28rustdoc: cross-crate source links are one level lower.Huon Wilson-2/+2
Previously this was adding one-too-many `..`s to the path for the `gotosrc=...` links for local crates. Also, the `root_path` already ends in `/`s so a trailing / shouldn't be added after the root (some servers treat `...//...` different to `.../...` including the one running doc.rust-lang.org).
2014-05-27rustdoc: Only link to local inlined foreign itemsAlex Crichton-0/+6
This commit alters rustdoc to keep a hash set of known inlined items which is a whitelist for generating URLs to. Closes #14438
2014-05-27std: Rename strbuf operations to stringRicho Healey-19/+19
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-3/+3
2014-05-25rustdoc: Move inlining to its own moduleAlex Crichton-5/+34
2014-05-25rustdoc: Get [src] links working for inlined doxAlex Crichton-20/+51
These links work by hyperlinking back to the actual documentation page with a query parameter which will be recognized and then auto-click the appropriate [src] link.
2014-05-25rustdoc: Link to local reexportations of itemsAlex Crichton-0/+1
Within the documentation for a crate, all hyperlinks to reexported items don't go across crates, but rather to the items in the crate itself. This will allow references to Option in the standard library to link to the standard library's Option, instead of libcore's. This does mean that other crate's links for Option will still link to libcore's Option.
2014-05-25rustdoc: Start inlining structs across cratesAlex Crichton-6/+4
2014-05-25rustdoc: Inline documentation of `pub use`Alex Crichton-35/+27
This commit teaches rustdoc to inline the documentation for the destination of a `pub use` statement across crate boundaries. This is intended for the standard library's facade to show the fact that the facade is just an implementation detail rather than the api of the standard library itself. This starts out by inlining traits and functions, but more items will come soon. The current drawback of this system is that hyperlinks across crates sill go to the original item's definition rather than the reexported location.
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-27/+27
[breaking-change]
2014-05-24Port more stuff to mark used attributesSteven Fackler-2/+2
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-2/+2
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-4/+7
2014-05-22rustdoc: Fill in external trait methodsAlex Crichton-66/+65
This commit alters rustdoc to crawl the metadata of upstream libraries in order to fill in default methods for traits implemented in downstream crates. This, for example, documents the `insert` function on hash maps. This is a fairly lossy extraction from the metadata. Documentation and attributes are lost, but they aren't used anyway. Unfortunately, argument names are also lost because they are not present in the metadata. Source links are also lost because the spans are not serialized. While not perfect, it appears that presenting this documentation through rustdoc is much better than nothing, so I wanted to land this to allow iteration on it later on.
2014-05-21rustdoc: Show types for traits across cratesAlex Crichton-22/+91
Right now, when you look in the "Implementors" section for traits, you only see implementors within that crate. This commit modifies that section to include implementors from neighboring crates as well. For example, the Container trait currently says that it is only implemented by strings and slices, but it is in fact implemented by nearly all containers. Implementation-wise, this change generates an "implementors cache" similarly to the search index where each crate will append implementors to the files. When the page for a trait is loaded, it will load its specific cache file, rendering links for all upstream types which implement the trait.
2014-05-15Updates with core::fmt changesAlex Crichton-61/+60
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.