about summary refs log tree commit diff
path: root/src/libsyntax/ext/format.rs
AgeCommit message (Collapse)AuthorLines
2015-01-21rollup merge of #21457: alexcrichton/issue-21436Alex Crichton-2/+2
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-2/+2
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-17libsyntax: rename functions from uint to usizePaul Collier-6/+6
2015-01-17libsyntax: uint types to usizePaul Collier-4/+4
2015-01-10core: rm unused lifetime.Huon Wilson-6/+2
2015-01-07use slicing sugarJorge Aparicio-21/+21
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-1/+1
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-06core: split into fmt::Show and fmt::StringSean McArthur-1/+1
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-13/+13
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-1/+1
2014-12-30Fallout from stabilizationAaron Turon-9/+7
2014-12-27syntax: change format_args! to produce fmt::Arguments instead of calling a ↵Eduard Burtescu-62/+23
function with them.
2014-12-27syntax: use std::string::String unqualified in format.Eduard Burtescu-13/+12
2014-12-27syntax: turn the match-call generated by format_args inside-out.Eduard Burtescu-39/+41
2014-12-27syntax: format: put static arrays in their own blocks to avoid needing a ↵Eduard Burtescu-40/+39
wrapper block.
2014-12-27syntax: format: remove unused method_statics field.Eduard Burtescu-15/+4
2014-12-21Fallout of std::str stabilizationAlex Crichton-14/+13
2014-12-20add {:?} fmt syntaxSean McArthur-0/+1
2014-12-12Add support for equality constraints on associated typesNick Cameron-0/+1
2014-12-08core: make the public fmt API completely safe.Eduard Burtescu-25/+8
2014-11-26rollup merge of #19298: nikomatsakis/unboxed-closure-parse-the-plusAlex Crichton-1/+1
Implements RFC 438. Fixes #19092. This is a [breaking-change]: change types like `&Foo+Send` or `&'a mut Foo+'a` to `&(Foo+Send)` and `&'a mut (Foo+'a)`, respectively. r? @brson
2014-11-26Rote changes due to the fact that ast paths no longer carry this extraneous ↵Niko Matsakis-1/+1
bounds.
2014-11-25Fallout from stabilizationAaron Turon-1/+1
2014-11-18std: Stabilize std::fmtAlex Crichton-20/+2
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc]. There are a number of breaking changes as a part of this commit which will need to be handled to migrated old code: * A number of formatting traits have been removed: String, Bool, Char, Unsigned, Signed, and Float. It is recommended to instead use Show wherever possible or to use adaptor structs to implement other methods of formatting. * The format specifier for Boolean has changed from `t` to `b`. * The enum `FormatError` has been renamed to `Error` as well as becoming a unit struct instead of an enum. The `WriteError` variant no longer exists. * The `format_args_method!` macro has been removed with no replacement. Alter code to use the `format_args!` macro instead. * The public fields of a `Formatter` have become read-only with no replacement. Use a new formatting string to alter the formatting flags in combination with the `write!` macro. The fields can be accessed through accessor methods on the `Formatter` structure. Other than these breaking changes, the contents of std::fmt should now also all contain stability markers. Most of them are still #[unstable] or #[experimental] [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md [breaking-change] Closes #18904
2014-11-17Fallout from deprecationAaron Turon-3/+3
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+4
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17Fix fallout from coercion removalNick Cameron-6/+5
2014-11-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-1/+1
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-06Fallout from collection conventionsAlexis Beingessner-4/+4
2014-11-02syntax: Use UFCS instead of `secret_*` fns in expansion of `format_args!`Jorge Aparicio-18/+19
2014-10-31DSTify HashJorge Aparicio-3/+3
- The signature of the `*_equiv` methods of `HashMap` and similar structures have changed, and now require one less level of indirection. Change your code from: ``` hashmap.find_equiv(&"Hello"); hashmap.find_equiv(&&[0u8, 1, 2]); ``` to: ``` hashmap.find_equiv("Hello"); hashmap.find_equiv(&[0u8, 1, 2]); ``` - The generic parameter `T` of the `Hasher::hash<T>` method have become `Sized?`. Downstream code must add `Sized?` to that method in their implementations. For example: ``` impl Hasher<FnvState> for FnvHasher { fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } } ``` must be changed to: ``` impl Hasher<FnvState> for FnvHasher { fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } // ^^^^^^ } ``` [breaking-change]
2014-10-30collections: Enable IndexMut for some collectionsAlex Crichton-2/+2
This commit enables implementations of IndexMut for a number of collections, including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same time this deprecates the `get_mut` methods on vectors in favor of using the indexing notation. cc #18424
2014-10-28Convert some token functions into methodsBrendan Zabarauskas-2/+1
2014-10-28Use PascalCase for token variantsBrendan Zabarauskas-9/+9
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-9/+9
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-16libsyntax: Don't accept :? as a format specifier.Luqman Aden-1/+0
2014-09-24Remove unused enum variantsJakub Wieczorek-8/+1
2014-09-19Add enum variants to the type namespaceNick Cameron-16/+17
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-16Fallout from renamingAaron Turon-4/+4
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-116/+116
2014-09-09Optimize for the most common cases of `format!`Piotr Czarnecki-49/+73
Format specs are ignored and not stored in case they're all default. Restore default formatting parameters during iteration. Pass `None` instead of empty slices of format specs to take advantage of non-nullable pointer optimization. Generate a call to one of two functions of `fmt::Argument`.
2014-09-09Decouple string and argument piecesPiotr Czarnecki-30/+54
2014-09-04auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, ↵bors-1/+1
r=alexcrichton I corrected spelling and capitalization errors in comments and strings.
2014-09-04Center alignment for fmtwickerwaka-0/+3
Use '^' to specify center alignment in format strings. fmt!( "[{:^5s}]", "Hi" ) -> "[ Hi ]" fmt!( "[{:^5s}]", "H" ) -> "[ H ]" fmt!( "[{:^5d}]", 1i ) -> "[ 1 ]" fmt!( "[{:^5d}]", -1i ) -> "[ -1 ]" fmt!( "[{:^6d}]", 1i ) -> "[ 1 ]" fmt!( "[{:^6d}]", -1i ) -> "[ -1 ]" If the padding is odd then the padding on the right will be one character longer than the padding on the left. Tuples squashed
2014-09-03Fix spelling errors and capitalization.Joseph Crail-1/+1
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-5/+6
2014-08-24Adjust the error messages to match the pattern "expected foo, found bar"Jonas Hietala-1/+1
Closes #8492
2014-08-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-1/+1
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change]
2014-07-22auto merge of #15871 : dotdash/rust/unnamed_fmtstr, r=pcwaltonbors-1/+6
2014-07-21Allow merging of statics generated by format!()Björn Steinbrink-1/+6