about summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
AgeCommit message (Collapse)AuthorLines
2015-01-21fix falloutLiigo Zhuang-1/+1
2015-01-21rustdoc: eliminates raw markdown code (links, headers, etc.) from tooltips ↵Liigo Zhuang-1/+16
of sidebar
2015-01-21rustdoc: add tooltips to sidebarLiigo Zhuang-10/+20
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-4/+4
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes #21436
2015-01-21Display negative trait implementations correctly in rustdocDiggory Blake-0/+4
Added doc test
2015-01-19remove unnecessary parentheses from range notationJorge Aparicio-6/+6
2015-01-18Fix typedef/module name conflicts in the compilerAlex Crichton-1/+1
2015-01-07Register new snapshotsAlex Crichton-32/+0
2015-01-06rollup merge of #20653: alexcrichton/entry-unstableAlex Crichton-3/+3
There's been some debate over the precise form that these APIs should take, and they've undergone some changes recently, so these APIs are going to be left unstable for now to be fleshed out during the next release cycle.
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-4/+36
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-07falloutNick Cameron-7/+7
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-4/+36
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-06[breaking change] Revert Entry behaviour to take keys by value.Dylan Ede-3/+3
2015-01-05rollup merge of #20092: barosl/rustdoc-line-number-clickableAlex Crichton-2/+2
While talking on IRC, someone wanted to post a link to the Rust source code, but while the lines of the rendered source code do have anchors (`<span id="[line number]">`), there is no convenient way to make links as they are not clickable. This PR makes them clickable. Also, a minor fix of the FAQ is included.
2015-01-04[breaking change] Update entry API as part of RFC 509.Ben Foppa-13/+7
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-4/+4
2015-01-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-1/+1
2015-01-02rollup merge of #20410: japaric/assoc-typesAlex Crichton-11/+21
Conflicts: src/liballoc/lib.rs src/libcollections/lib.rs src/libcollections/slice.rs src/libcore/ops.rs src/libcore/prelude.rs src/libcore/ptr.rs src/librustc/middle/traits/project.rs src/libstd/c_str.rs src/libstd/io/mem.rs src/libstd/io/mod.rs src/libstd/lib.rs src/libstd/path/posix.rs src/libstd/path/windows.rs src/libstd/prelude.rs src/libstd/rt/exclusive.rs src/libsyntax/lib.rs src/test/compile-fail/issue-18566.rs src/test/run-pass/deref-mut-on-ref.rs src/test/run-pass/deref-on-ref.rs src/test/run-pass/dst-deref-mut.rs src/test/run-pass/dst-deref.rs src/test/run-pass/fixup-deref-mut.rs src/test/run-pass/issue-13264.rs src/test/run-pass/overloaded-autoderef-indexing.rs
2015-01-02rollup merge of #20377: alexcrichton/issue-20352Alex Crichton-7/+8
2015-01-02rustdoc: fix rendering of associated typesCorey Richardson-11/+21
2015-01-02std: Stabilize the prelude moduleAlex Crichton-0/+1
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2015-01-01std: Enforce Unicode in fmt::WriterAlex Crichton-7/+8
This commit is an implementation of [RFC 526][rfc] which is a change to alter the definition of the old `fmt::FormatWriter`. The new trait, renamed to `Writer`, now only exposes one method `write_str` in order to guarantee that all implementations of the formatting traits can only produce valid Unicode. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md One of the primary improvements of this patch is the performance of the `.to_string()` method by avoiding an almost-always redundant UTF-8 check. This is a breaking change due to the renaming of the trait as well as the loss of the `write` method, but migration paths should be relatively easy: * All usage of `write` should move to `write_str`. If truly binary data was being written in an implementation of `Show`, then it will need to use a different trait or an altogether different code path. * All usage of `write!` should continue to work as-is with no modifications. * All usage of `Show` where implementations just delegate to another should continue to work as-is. [breaking-change] Closes #20352
2014-12-30Fallout from stabilizationAaron Turon-3/+5
2014-12-27Make the line numbers of the source code clickableBarosl Lee-2/+2
2014-12-26Changes to RustDocNick Cameron-3/+0
2014-12-23Rename include_bin! to include_bytes!Chris Wong-12/+12
According to [RFC 344][], methods that return `&[u8]` should have names ending in `bytes`. Though `include_bin!` is a macro not a method, it seems reasonable to follow the convention anyway. We keep the old name around for now, but trigger a deprecation warning when it is used. [RFC 344]: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md [breaking-change]
2014-12-21Fallout of std::str stabilizationAlex Crichton-3/+5
2014-12-21Remove a ton of public reexportsCorey Farwell-1/+1
Remove most of the public reexports mentioned in #19253 These are all leftovers from the enum namespacing transition In particular: * src/libstd/num/strconv.rs * ExponentFormat * SignificantDigits * SignFormat * src/libstd/path/windows.rs * PathPrefix * src/libstd/sys/windows/timer.rs * Req * src/libcollections/str.rs * MaybeOwned * src/libstd/collections/hash/map.rs * Entry * src/libstd/collections/hash/table.rs * BucketState * src/libstd/dynamic_lib.rs * Rtld * src/libstd/io/net/ip.rs * IpAddr * src/libstd/os.rs * MemoryMapKind * MapOption * MapError * src/libstd/sys/common/net.rs * SocketStatus * InAddr * src/libstd/sys/unix/timer.rs * Req [breaking-change]
2014-12-19librustdoc: use `#[deriving(Copy)]`Jorge Aparicio-2/+1
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-2/+2
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-14Parse `unsafe trait` but do not do anything with it beyond parsing and ↵Niko Matsakis-1/+2
integrating into rustdoc etc.
2014-12-14Rename FnStyle trait to Unsafety.Niko Matsakis-8/+8
2014-12-13librustdoc: use tuple indexingJorge Aparicio-1/+1
2014-12-13librustdoc: use unboxed closuresJorge Aparicio-4/+9
2014-12-11Register new snapshotsAlex Crichton-1/+1
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-1/+7
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-06librustdoc: remove unnecessary `as_mut_slice` callsJorge Aparicio-1/+1
2014-12-06librustdoc: remove unnecessary `as_slice()` callsJorge Aparicio-11/+11
2014-12-04rustdoc: Avoid rendering foreign items to the sidebar.Kang Seonghoon-0/+4
Otherwise the generated documentation is 30% larger. The sidebar renders an entry for each item to all items, so large modules have O(n^2) items rendered in the sidebars. Not a correct solution, but at least it works.
2014-12-04rustdoc: Removed Foreign{Function,Static} item types.Kang Seonghoon-8/+4
They are just (unsafe) functions and static items to most users and even compilers! The metadata doesn't distinguish them, so Rustdoc ended up producing broken links (generated `ffi.*.html`, links to `fn.*.html`). It would be best to avoid this pitfall at all.
2014-12-04rustdoc: Refactored various uses of ItemType.Kang Seonghoon-74/+72
In particular, ItemType variants are no longer reexported. Since we already do namespace them via `item_type` mod, it's fine.
2014-12-04rustdoc: Fixed a missing rendering of ForeignStaticItems.Kang Seonghoon-1/+2
2014-12-01auto merge of #19405 : jfager/rust/de-match-pyramid, r=bstriebors-104/+90
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-12-01rustdoc: Use relative paths in source renders.Kang Seonghoon-5/+14
Before: doc/src/collections/home/lifthrasiir/git/rust/src/libcollections/vec.rs.html After: doc/src/collections/vec.rs.html If the source code is in the parent dirs relative to the crate root, `..` is replaced with `up` as expected. Any other error like non-UTF-8 paths or drive-relative paths falls back to the absolute path. There might be a way to improve on false negatives, but this alone should be enough for fixing #18370.
2014-11-29Replace some verbose match statements with their `if let` equivalent.jfager-104/+90
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-11-24rustdoc: Render Sized? on traits and genericsTom Jakubowski-0/+6
Both `trait Foo for Sized?` and `<Sized? T>` are handled correctly. Fix #18515
2014-11-24rustdoc: Render associated types on traits and implsTom Jakubowski-27/+65
2014-11-23std: Add a new top-level thread_local moduleAlex Crichton-16/+29
This commit removes the `std::local_data` module in favor of a new `std::thread_local` module providing thread local storage. The module provides two variants of TLS: one which owns its contents and one which is based on scoped references. Each implementation has pros and cons listed in the documentation. Both flavors have accessors through a function called `with` which yield a reference to a closure provided. Both flavors also panic if a reference cannot be yielded and provide a function to test whether an access would panic or not. This is an implementation of [RFC 461][rfc] and full details can be found in that RFC. This is a breaking change due to the removal of the `std::local_data` module. All users can migrate to the new thread local system like so: thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None))) The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as an implementation detail which must now be explicitly stated by users. [rfc]: https://github.com/rust-lang/rfcs/pull/461 [breaking-change]
2014-11-23rollup merge of #19234: P1start/rustdoc-miscJakub Bukaj-62/+42
This PR: - makes rustdoc colour trait methods like other functions in search results; - makes rustdoc display `extern crate` statements with the new `as` syntax instead of the old `=` syntax; - changes rustdoc to list constants and statics in a way that is more similar to functions and modules and show their full definition and documentation on their own page, fixing #19046: ![Constant listing](https://i.imgur.com/L4ZTOCN.png) ![Constant page](https://i.imgur.com/RcjZfCv.png)
2014-11-23Change how rustdoc shows constants and statics to be more similar to other itemsP1start-57/+35
Fixes #19046.