about summary refs log tree commit diff
path: root/src/libsyntax/ext/ifmt.rs
AgeCommit message (Collapse)AuthorLines
2013-09-15Reduce the amount of complexity in format!Alex Crichton-818/+0
This renames the syntax-extension file to format from ifmt, and it also reduces the amount of complexity inside by defining all other macros in terms of format_args!
2013-09-12Implement a format_args!() macroAlex Crichton-61/+106
The purpose of this macro is to further reduce the number of allocations which occur when dealing with formatting strings. This macro will perform all of the static analysis necessary to validate that a format string is safe, and then it will wrap up the "format string" into an opaque struct which can then be passed around. Two safe functions are added (write/format) which take this opaque argument structure, unwrap it, and then call the unsafe version of write/format (in an unsafe block). Other than these two functions, it is not intended for anyone to ever look inside this opaque struct. The macro looks a bit odd, but mostly because of rvalue lifetimes this is the only way for it to be safe that I know of. Example use-cases of this are: * third-party libraries can use the default formatting syntax without any forced allocations * the fail!() macro can avoid allocating the format string * the logging macros can avoid allocation any strings
2013-09-11Flag unsafe blocks from format! as compiler-generatedAlex Crichton-1/+1
2013-09-10Delay assignment of node ids until after expansion. Ensures that each AST nodeNiko Matsakis-3/+3
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two representative tests. Fixes #7971 Fixes #6304 Fixes #8367 Fixes #8754 Fixes #8852 Fixes #2543 Fixes #7654
2013-09-04stop treating char as an integer typeDaniel Micay-2/+1
Closes #7609
2013-09-03auto merge of #8945 : alexcrichton/rust/ifmt-dont-move, r=thestingerbors-2/+6
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-16/+16
2013-09-02Don't have format! move out of local variablesAlex Crichton-2/+6
2013-09-02Renamed syntax::ast::ident -> IdentMarvin Löbel-1/+1
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-9/+9
2013-08-24Settle on the format/write/print family of namesAlex Crichton-7/+13
2013-08-24Implement a wrapper macro around fprintf -- ifmtfAlex Crichton-21/+47
2013-08-16Delegate `{}` to Default instead of PolyAlex Crichton-23/+20
By using a separate trait this is overridable on a per-type basis and makes room for the possibility of even more arguments passed in for the future.
2013-08-13Add `f` formats to `ifmt!`Alex Crichton-5/+6
Currently the work just the same as the old `extfmt` versions
2013-08-12Correct the padding on integer types for formattingAlex Crichton-5/+13
2013-08-12Define integer formats for all widthsAlex Crichton-0/+1
Closes #1653
2013-08-12Implement formatting arguments for strings and integersAlex Crichton-5/+7
Closes #1651
2013-08-11auto merge of #8421 : alexcrichton/rust/unnamed-addr, r=thestingerbors-2/+11
This can be applied to statics and it will indicate that LLVM will attempt to merge the constant in .data with other statics. I have preliminarily applied this to all of the statics generated by the new `ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a separate file with 1000 calls to `fmt!` to compare the sizes, and the results were: ``` fmt 310k ifmt (before) 529k ifmt (after) 202k ``` This now means that ifmt! is both faster and smaller than fmt!, yay!
2013-08-10syntax and rustc: fix some warningsErick Tryzelaar-1/+1
2013-08-10std: Iterator.chain_ -> .chainErick Tryzelaar-1/+1
2013-08-10std: Rename Iterator.transform -> .mapErick Tryzelaar-7/+7
cc #5898
2013-08-10Mass rename of .consume{,_iter}() to .move_iter()Erick Tryzelaar-2/+2
cc #7887
2013-08-09Implement an `address_insignificant` attributeAlex Crichton-3/+12
This can be applied to statics and it will indicate that LLVM will attempt to merge the constant in .data with other statics. I have preliminarily applied this to all of the statics generated by the new `ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a separate file with 1000 calls to `fmt!` to compare the sizes, and the results were: fmt 310k ifmt (before) 529k ifmt (after) 202k This now means that ifmt! is both faster and smaller than fmt!, yay!
2013-08-07Add initial support for a new formatting syntaxAlex Crichton-0/+720
The new macro is available under the name ifmt! (only an intermediate name)