summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
AgeCommit message (Collapse)AuthorLines
2015-01-07rollup merge of #20721: japaric/snapAlex Crichton-2/+2
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustc/lint/builtin.rs src/librustc/session/config.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/context.rs src/librustc_trans/trans/type_.rs src/librustc_typeck/check/_match.rs src/librustdoc/html/format.rs src/libsyntax/std_inject.rs src/libsyntax/util/interner.rs src/test/compile-fail/mut-pattern-mismatched.rs
2015-01-07rollup merge of #20725: tomjakubowski/rustdoc-miscAlex Crichton-2/+18
Conflicts: src/librustdoc/html/format.rs
2015-01-07rollup merge of #20722: alexcrichton/audit-showAlex Crichton-3/+18
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustdoc/html/format.rs
2015-01-07rustdoc: Render associated type bindingsTom Jakubowski-2/+25
e.g. `Foo<Output=A>` This does not work cross-crate unfortunately. Part of #20646
2015-01-07std: Tweak String implementationsAlex Crichton-3/+18
This commit performs a pass over the implementations of the new `String` trait in the formatting module. Some implementations were removed as a conservative move pending an upcoming convention about `String` implementations, and some were added in order to retain consistency across the libraries. Specifically: * All "smart pointers" implement `String` now, adding missing implementations for `Arc` and `Rc`. * The `Vec<T>` and `[T]` types no longer implement `String`. * The `*const T` and `*mut T` type no longer implement `String`. * The `()` type no longer implements `String`. * The `Path` type's `Show` implementation does not surround itself with `Path {}` (a minor tweak). All implementations of `String` in this PR were also marked `#[stable]` to indicate that the types will continue to implement the `String` trait regardless of what it looks like.
2015-01-07use slicing sugarJorge Aparicio-2/+2
2015-01-07register new snapshotsJorge Aparicio-193/+0
2015-01-07Register new snapshotsAlex Crichton-193/+0
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-4/+197
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-3/+3
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-4/+197
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-07Replace full slice notation with index callsNick Cameron-2/+2
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-4/+4
2015-01-01std: Enforce Unicode in fmt::WriterAlex Crichton-29/+29
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-1/+1
2014-12-30Remove the def-id from type parameters. Having this def-id was bad for ↵Niko Matsakis-3/+2
several reasons: 1. Produced more unique types than is necessary. This increases memory consumption. 2. Linking the type parameter to its definition *seems* like a good idea, but it encourages reliance on the bounds listing. 3. It made pretty-printing harder and in particular was causing bad error messages when errors occurred before the `TypeParameterDef` entries were fully stored.
2014-12-29rollup merge of #20269: dirk/indent-whereAlex Crichton-1/+2
* Add <span class=‘where’> around clause * CSS rule to format the span (for issue #20176)
2014-12-27Indent where clause in rustdocDirk Gadsden-1/+2
* Add <span class=‘where’> around clause * CSS rule to format the span (for #20176)
2014-12-26Changes to RustDocNick Cameron-6/+10
2014-12-25auto merge of #20180 : jroesch/rust/clean-where-predicate, r=alexcrichtonbors-2/+20
Add support for all variants of ast::WherePredicate in clean/mod.rs. Fixes #20048, but will need modification when EqualityPredicates are fully implemented in #20041.
2014-12-24rustdoc: Use unboxed closure sugarTom Jakubowski-39/+58
This unfortunately leaves sugaring Fn/FnMut/FnOnce on cross-crate re-exports for future work. cc #19909
2014-12-24rustdoc: render higher-rank trait boundsTom Jakubowski-9/+25
Fix #19915
2014-12-24rustdoc: render `for<>` on old closure lifetimesTom Jakubowski-2/+2
2014-12-24Address code review nitsJared Roesch-3/+3
2014-12-23Support all variants of WherePredicateJared Roesch-2/+20
Adds support for all variants of ast::WherePredicate in clean/mod.rs. Fixes #20048, but will need modification when EqualityPredicates are fully implemented in #20041.
2014-12-21Fallout of std::str stabilizationAlex Crichton-5/+5
2014-12-20Add parser support for generalized where clausesJared Roesch-1/+1
Implement support in the parser for generalized where clauses, as well as the conversion of ast::WherePredicates to ty::Predicate in `collect.rs`.
2014-12-19librustdoc: use `#[deriving(Copy)]`Jorge Aparicio-5/+4
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-1/+1
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-14Rename FnStyle trait to Unsafety.Niko Matsakis-11/+11
2014-12-14Patch rustdoc to include missing types, make the match exhaustiveNiko Matsakis-0/+10
to prevent such oversights in the future.
2014-12-13librustdoc: use tuple indexingJorge Aparicio-1/+1
2014-12-13librustdoc: use unboxed closuresJorge Aparicio-4/+8
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-0/+5
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_slice()` callsJorge Aparicio-3/+3
2014-12-04rustdoc: Refactored various uses of ItemType.Kang Seonghoon-2/+1
In particular, ItemType variants are no longer reexported. Since we already do namespace them via `item_type` mod, it's fine.
2014-11-26rollup merge of #19272: tomjakubowski/rustdoc-sizedAlex Crichton-0/+3
Both `trait Foo for Sized?` and `<Sized? T>` are handled correctly. Fix #18515
2014-11-25Fallout from stabilizationAaron Turon-1/+1
2014-11-24rustdoc: Render Sized? on traits and genericsTom Jakubowski-0/+3
Both `trait Foo for Sized?` and `<Sized? T>` are handled correctly. Fix #18515
2014-11-24rustdoc: render ast::QPathTom Jakubowski-0/+3
Fix #18594
2014-11-24rustdoc: Render associated types on traits and implsTom Jakubowski-2/+1
2014-11-23std: Add a new top-level thread_local moduleAlex Crichton-14/+12
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-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-20/+14
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-06rollup merge of #18630 : nikomatsakis/purge-the-barsAlex Crichton-5/+1
2014-11-06Fallout from collection conventionsAlexis Beingessner-2/+2
2014-11-06Remove the unboxed closure `|:|` notation from types and trait references ↵Niko Matsakis-5/+1
completely.
2014-10-29Rename fail! to panic!Steve Klabnik-1/+1
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-3/+5
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-08librustdoc/html: recognize slices not to nest A tags.NODA, Kai-1/+19
1. A slice of parametrized type, say BorrowedRef { ... Vector(Generic(T)) }, is rendered as "<a href='primitive.slice.html'>&amp;[T]</a>" 2. A slice of other types, say BorrowedRef { ... Vector(int) }, is rendered as "<a href='primitive.slice.html'>&amp;[</a> <a href='primitive.int.html'>int</a> <a href='primitive.slice.html'>]</a>" 3. Other cases, say BorrowedRef { ... int }, are rendered as same as before: "&<a href='primitive.int.html'>int</a>" Relevant W3C specs: - http://www.w3.org/TR/html401/struct/links.html#h-12.2.2 12.2.2 Nested links are illegal - http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element states A tag must not enclose any "interactive contents" which include A tags themselves.
2014-10-07Use slice syntax instead of slice_to, etc.Nick Cameron-3/+3