about summary refs log tree commit diff
path: root/src/libsyntax/ext/bytes.rs
AgeCommit message (Collapse)AuthorLines
2015-01-07std: Stablize the macros moduleAlex Crichton-117/+0
This commit performs a pass over the `std::macros` module, applying stability attributes where necessary. In particular, this audits macros for patterns such as: * Standard use of forward-to-format-args via `$($arg:tt)*` (or `+`) * Prevent macro-defined identifiers from leaking into expression arguments as hygiene is not perfectly implemented. * Wherever possible, `$crate` is used now. Specifically, the following actions were taken: * The `std::macros` module itself is no longer public. * The `panic!` macro is stable * The `assert!` macro is stable * The `assert_eq!` macro is stable * The `debug_assert!` macro is stable * The `debug_assert_eq!` macro is stable * The `unreachable!` macro is stable after removing the extra forms to bring the definition in line with the `unimplemented!` macro. * The `try!` macro is stable * The `vec!` macro is stable [breaking-change]
2015-01-02std: Stabilize the prelude moduleAlex Crichton-1/+0
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
2014-12-25Remove Ascii, AsciiCast, OwnedAsciiCast, AsciiStr, IntoBytes, IntoString.Simon Sapin-0/+1
As a replacement, add is_ascii() to AsciiExt, and implement AsciiExt for u8 and char. [breaking-change]
2014-11-02Convert some notes to help messagesP1start-2/+2
Closes #18126.
2014-10-09syntax: Tweak the return value of bytes!()Alex Crichton-14/+9
Instead of returning &'static [u8], an invocation of `bytes!()` now returns `&'static [u8, ..N]` where `N` is the length of the byte vector. This should functionally be the same, but there are some cases where an explicit cast may be needed, so this is a: [breaking-change]
2014-09-22manual -> reference & formattingSteve Klabnik-1/+1
'reference' sounds better than 'manual' to me here, and rust.html is certainly wrong. I also wrapped everything to 80 cols.
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-1/+1
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-2/+4
2014-08-05Fixes missing overflow lint for i64 #14269Falco Hirschenberger-5/+6
The `type_overflow` lint, doesn't catch the overflow for `i64` because the overflow happens earlier in the parse phase when the `u64` as biggest possible int gets casted to `i64` , without checking the for overflows. We can't lint in the parse phase, so a refactoring of the `LitInt` type was necessary. The types `LitInt`, `LitUint` and `LitIntUnsuffixed` where merged to one type `LitInt` which stores it's value as `u64`. An additional parameter was added which indicate the signedness of the type and the sign of the value.
2014-06-18Revert bytes!() docstring change, and fix a typo.Simon Sapin-1/+1
2014-06-18Deprecate the bytes!() macro.Simon Sapin-0/+8
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-13librustc: Fix the issue with labels shadowing variable names by makingPatrick Walton-1/+13
the leading quote part of the identifier for the purposes of hygiene. This adopts @jbclements' solution to #14539. I'm not sure if this is a breaking change or not. Closes #12512. [breaking-change]
2014-05-18Make bytes!() return 'staticKevin Ballard-6/+27
Change `bytes!()` to return { static BYTES: &'static [u8] = &[...]; BYTES } This gives it the `'static` lifetime, whereas before it had an rvalue lifetime. Until recently this would have prevented assigning `bytes!()` to a static, as in static FOO: &'static [u8] = bytes!(1,2,3); but #14183 fixed it so blocks are now allowed in constant expressions (with restrictions). Fixes #11641.
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-1/+3
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-02syntax: store char literals/tokens as `char`s rather than u32s.Huon Wilson-3/+1
Clearly storing them as `char` is semantically nicer, but this also fixes a bug whereby `quote_expr!(cx, 'a')` wasn't working, because the code created by quotation was not matching the actual AST definitions.
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-3/+3
There's now one unified way to return things from a macro, instead of being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr` variants of the `MacResult` enum. This does simplify the logic handling the expansions, but the biggest value of this is it makes macros in (for example) type position easier to implement, as there's this single thing to modify. By my measurements (using `-Z time-passes` on libstd and librustc etc.), this appears to have little-to-no impact on expansion speed. There are presumably larger costs than the small number of extra allocations and virtual calls this adds (notably, all `macro_rules!`-defined macros have not changed in behaviour, since they had to use the `AnyMacro` trait anyway).
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-0/+1
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-1/+1
2014-02-18Avoid returning original macro if expansion fails.Douglas Young-1/+1
Closes #11692. Instead of returning the original expression, a dummy expression (with identical span) is returned. This prevents infinite loops of failed expansions as well as odd double error messages in certain situations.
2014-02-08Fixed error starting with uppercasemr.Shu-6/+6
Error messages cleaned in librustc/middle Error messages cleaned in libsyntax Error messages cleaned in libsyntax more agressively Error messages cleaned in librustc more aggressively Fixed affected tests Fixed other failing tests Last failing tests fixed
2014-02-02libsyntax: De-`@str` literal strings in the ASTPatrick Walton-2/+2
2014-01-18syntax::ext: replace span_fatal with span_err in many places.Huon Wilson-1/+4
This means that compilation continues for longer, and so we can see more errors per compile. This is mildly more user-friendly because it stops users having to run rustc n times to see n macro errors: just run it once to see all of them.
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-5/+5
2013-12-29Start passing around &mut ExtCtxtSteven Fackler-1/+1
2013-12-28Stop using @ExtCtxtSteven Fackler-1/+1
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-1/+1
2013-10-08add new enum ast::StrStyle as field to ast::lit_strBenjamin Herr-1/+1
For the benefit of the pretty printer we want to keep track of how string literals in the ast were originally represented in the source code. This commit changes parser functions so they don't extract strings from the token stream without at least also returning what style of string literal it was. This is stored in the resulting ast node for string literals, obviously, for the package id in `extern mod = r"package id"` view items, for the inline asm in `asm!()` invocations. For `asm!()`'s other arguments or for `extern "Rust" fn()` items, I just the style of string, because it seemed disproportionally cumbersome to thread that information through the string processing that happens with those string literals, given the limited advantage raw string literals would provide in these positions. The other syntax extensions don't seem to store passed string literals in the ast, so they also discard the style of strings they parse.
2013-09-16Limit spans in bytes!() error messages to the argument in questionKevin Ballard-10/+10
This constrains the span to the appropriate argument, so you know which one caused the problem. Instead of foo.rs:2:4: 2:21 error: Too large integer literal in bytes! foo.rs:2 bytes!(1, 256, 2) ^~~~~~~~~~~~~~~~~ it will say foo.rs:2:14 2:17 error: Too large integer literal in bytes! foo.rs:2 bytes!(1, 256, 2) ^~~
2013-09-04stop treating char as an integer typeDaniel Micay-2/+4
Closes #7609
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-1/+1
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-2/+2
2013-08-03remove obsolete `foreach` keywordDaniel Micay-2/+2
this has been replaced by `for`
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-2/+2
2013-07-30Added str::char_offset_iter() and str::rev_char_offset_iter()Marvin Löbel-1/+1
Renamed bytes_iter to byte_iter to match other iterators Refactored str Iterators to use DoubleEnded Iterators and typedefs instead of wrapper structs Reordered the Iterator section Whitespace fixup Moved clunky `each_split_within` function to the one place in the tree where it's actually needed Replaced all block doccomments in str with line doccomments
2013-07-24Disallow non-comma-delimited arguments to fmt! and bytes!Birunthan Mohanathas-1/+1
Closes #4982.
2013-06-23vec: remove BaseIter implementationDaniel Micay-1/+1
I removed the `static-method-test.rs` test because it was heavily based on `BaseIter` and there are plenty of other more complex uses of static methods anyway.
2013-06-14add IteratorUtil to the preludeDaniel Micay-1/+0
2013-06-09std: replace the str::each* fns/methods with byte iteratorsHuon Wilson-1/+2
2013-05-22syntax/ext: convert all AstBuilder methods to a uniform syntax.Huon Wilson-5/+5
2013-05-22syntax/ext: migrate build.rs functions to AstBuilder methods.Huon Wilson-6/+6
2013-05-22syntax/ext: modernise ext_ctxt to be CamelCase and use new.Huon Wilson-1/+1
2013-05-18Made bytes!() accept a list of string, integer or char literalsMarvin Löbel-5/+50
2013-05-16Implement bytes! syntax extensionSangeun Kim-0/+28