about summary refs log tree commit diff
path: root/src/libsyntax/ext/base.rs
AgeCommit message (Collapse)AuthorLines
2013-08-10Merge branch 'enum-method-privacy' of ↵Erick Tryzelaar-10/+10
https://github.com/michaelwoerister/rust into rollup Conflicts: src/libsyntax/opt_vec.rs
2013-08-09auto merge of #8362 : sfackler/rust/env, r=alexcrichtonbors-6/+8
env! aborts compilation of the specified environment variable is not defined and takes an optional second argument containing a custom error message. option_env! creates an Option<&'static str> containing the value of the environment variable. There are no run-pass tests that check the behavior when the environment variable is defined since the test framework doesn't support setting environment variables at compile time as opposed to runtime. However, both env! and option_env! are used inside of rustc itself, which should act as a sufficient test. Fixes #2248.
2013-08-08env! syntax extension changesSteven Fackler-6/+8
env! aborts compilation of the specified environment variable is not defined and takes an optional second argument containing a custom error message. option_env! creates an Option<&'static str> containing the value of the environment variable. There are no run-pass tests that check the behavior when the environment variable is defined since the test framework doesn't support setting environment variables at compile time as opposed to runtime. However, both env! and option_env! are used inside of rustc itself, which should act as a sufficient test. Close #2248
2013-08-08auto merge of #8245 : alexcrichton/rust/fmt2, r=graydonbors-0/+2
This is a reopening of #8182, although this removes any abuse of the compiler internals. Now it's just a pure syntax extension (hard coded what the attribute names are).
2013-08-07Add initial support for a new formatting syntaxAlex Crichton-0/+2
The new macro is available under the name ifmt! (only an intermediate name)
2013-08-07core: option.map_consume -> option.map_moveErick Tryzelaar-1/+1
2013-08-07Enable privacy check for enum methods.Michael Woerister-10/+10
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-8/+8
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-02auto merge of #8188 : huonw/rust/cfg-macro, r=pcwaltonbors-0/+2
Example: if cfg!(test) { calculation_to_run_only_when_testing(); } Closes #8130.
2013-08-01Remove the pipes compilerBrian Anderson-4/+2
The pipes compiler produced data types that encoded efficient and safe bounded message passing protocols between two endpoints. It was also capable of producing unbounded protocols. It was useful research but was arguably done before its proper time. I am removing it for the following reasons: * In practice we used it only for producing the `oneshot` and `stream` unbounded protocols and all communication in Rust use those. * The interface between the proto! macro and the standard library has a large surface area and was difficult to maintain through language and library changes. * It is now written in an old dialect of Rust and generates code which would likely be considered non-idiomatic. * Both the compiler and the runtime are difficult to understand, and likewise the relationship between the generated code and the library is hard to understand. Debugging is difficult. * The new scheduler implements `stream` and `oneshot` by hand in a way that will be significantly easier to maintain. This shouldn't be taken as an indication that 'channel protocols' for Rust are not worth pursuing again in the future.
2013-08-01syntax: implement cfg!() which evaluates to true/false where #[cfg] would ↵Huon Wilson-0/+2
keep/remove. Example: if cfg!(test) { calculation_to_run_only_when_testing(); }
2013-07-29New naming convention for ast::{node_id, local_crate, crate_node_id, ↵Michael Woerister-1/+1
blk_check_mode, ty_field, ty_method}
2013-07-24Disallow non-comma-delimited arguments to fmt! and bytes!Birunthan Mohanathas-4/+5
Closes #4982.
2013-07-22Ast spanned<T> refactoring, renaming: crate, local, blk, crate_num, crate_cfg.Michael Woerister-3/+3
`crate => Crate` `local => Local` `blk => Block` `crate_num => CrateNum` `crate_cfg => CrateConfig` Also, Crate and Local are not wrapped in spanned<T> anymore.
2013-07-20auto merge of #7902 : huonw/rust/attr++, r=cmr,pcwaltonbors-1/+1
This does a number of things, but especially dramatically reduce the number of allocations performed for operations involving attributes/ meta items: - Converts ast::meta_item & ast::attribute and other associated enums to CamelCase. - Converts several standalone functions in syntax::attr into methods, defined on two traits AttrMetaMethods & AttributeMethods. The former is common to both MetaItem and Attribute since the latter is a thin wrapper around the former. - Deletes functions that are unnecessary due to iterators. - Converts other standalone functions to use iterators and the generic AttrMetaMethods rather than allocating a lot of new vectors (e.g. the old code would have to allocate a new vector to use functions that operated on &[meta_item] on &[attribute].) - Moves the core algorithm of the #[cfg] matching to syntax::attr, similar to find_inline_attr and find_linkage_metas. This doesn't have much of an effect on the speed of #[cfg] stripping, despite hugely reducing the number of allocations performed; presumably most of the time is spent in the ast folder rather than doing attribute checks. Also fixes the Eq instance of MetaItem_ to correctly ignore spans, so that `rustc --cfg 'foo(bar)'` now works.
2013-07-20syntax: modernise attribute handling in syntax::attr.Huon Wilson-1/+1
This does a number of things, but especially dramatically reduce the number of allocations performed for operations involving attributes/ meta items: - Converts ast::meta_item & ast::attribute and other associated enums to CamelCase. - Converts several standalone functions in syntax::attr into methods, defined on two traits AttrMetaMethods & AttributeMethods. The former is common to both MetaItem and Attribute since the latter is a thin wrapper around the former. - Deletes functions that are unnecessary due to iterators. - Converts other standalone functions to use iterators and the generic AttrMetaMethods rather than allocating a lot of new vectors (e.g. the old code would have to allocate a new vector to use functions that operated on &[meta_item] on &[attribute].) - Moves the core algorithm of the #[cfg] matching to syntax::attr, similar to find_inline_attr and find_linkage_metas. This doesn't have much of an effect on the speed of #[cfg] stripping, despite hugely reducing the number of allocations performed; presumably most of the time is spent in the ast folder rather than doing attribute checks. Also fixes the Eq instance of MetaItem_ to correctly ignore spaces, so that `rustc --cfg 'foo(bar)'` now works.
2013-07-18librustc: Forbid `&` pointers (other than `&'static`) inside `@` boxes.Patrick Walton-2/+1
This makes custom borrowing implementations for custom smart pointers sound.
2013-07-17librustc: Remove all uses of the `Copy` bound.Patrick Walton-1/+1
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-2/+2
2013-07-17librustc: Add a lint mode for unnecessary `copy` and remove a bunch of them.Patrick Walton-1/+1
2013-07-12Remove the global 'vec::to_owned' functionAlex Crichton-2/+1
2013-07-07De-managed ast::PathJames Miller-1/+1
2013-07-05Do not rely on newtype enum dereferenceSeo Sanghyeon-10/+7
2013-06-29'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep ↵Ben Blum-1/+1
for making them noncopyable.
2013-06-25great renaming propagation: syntaxCorey Richardson-5/+3
2013-06-13Revert "std: convert {vec,str}::to_owned to methods."Brian Anderson-1/+2
This fixes the strange random crashes in compile-fail tests. This reverts commit 96cd61ad034cc9e88ab6a7845c3480dbc1ea62f3. Conflicts: src/librustc/driver/driver.rs src/libstd/str.rs src/libsyntax/ext/quote.rs
2013-06-13Use @str instead of @~str in libsyntax and librustc. Fixes #5048.Huon Wilson-21/+21
This almost removes the StringRef wrapper, since all strings are Equiv-alent now. Removes a lot of `/* bad */ copy *`'s, and converts several things to be &'static str (the lint table and the intrinsics table). There are many instances of .to_managed(), unfortunately.
2013-06-12std: unify the str -> [u8] functions as 3 methods: .as_bytes() and ↵Huon Wilson-1/+0
.as_bytes_with_null[_consume](). The first acts on &str and is not nul-terminated, the last two act on strings that are always null terminated (&'static str, ~str and @str).
2013-06-12std: convert {vec,str}::to_owned to methods.Huon Wilson-1/+1
2013-06-05add hygiene support functionsJohn Clements-0/+10
2013-06-05remove unused get_ident_interner'sJohn Clements-1/+1
2013-06-05token_to_ident takes argument by referenceJohn Clements-1/+1
2013-06-05interner just uses uints, not idents with syntax contextJohn Clements-3/+3
2013-06-05just use TLS internerJohn Clements-3/+3
2013-06-05change to newer macro escape mechanism, using uints in more placesJohn Clements-42/+83
2013-06-01Remove all uses of `pub impl`. rs=stylePatrick Walton-25/+26
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-0/+1
2013-05-22libextra: Rename the actual metadata names of libcore to libstd and libstd ↵Patrick Walton-0/+2
to libextra
2013-05-22syntax/ext: modernise ext_ctxt to be CamelCase and use new.Huon Wilson-21/+20
2013-05-22syntax/ext: Remove the trait-object indirection of the ext_ctxt object.Huon Wilson-106/+82
2013-05-20Remove all unnecessary allocations (as flagged by lint)Alex Crichton-2/+2
2013-05-16Implement bytes! syntax extensionSangeun Kim-0/+2
2013-05-15auto merge of #6500 : kud1ing/rust/cleanup, r=bstriebors-9/+0
Fixes #6445
2013-05-15remove deriving_eq, deriving_iter_bytes, deriving_clone (deprecated in 0.6)Lenny222-9/+0
2013-05-15Rename vec::len(var) to var.len()Youngmin Yoo-1/+1
2013-05-14Use static string with fail!() and remove fail!(fmt!())Björn Steinbrink-2/+2
fail!() used to require owned strings but can handle static strings now. Also, it can pass its arguments to fmt!() on its own, no need for the caller to call fmt!() itself.
2013-05-11auto merge of #6389 : sonwow/rust/issue-3356, r=bstriebors-1/+1
Fix for #3356
2013-05-10renamed vec::from_slice to vec::to_ownedYoungsoo Son-1/+1
2013-05-09Use a specialized string interner to reduce the need for owned stringsBjörn Steinbrink-3/+3
&str can be turned into @~str on demand, using to_owned(), so for strings, we can create a specialized interner that accepts &str for intern() and find() but stores and returns @~str.
2013-05-05Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freezeNiko Matsakis-11/+1
Conflicts: src/libcore/core.rc src/libcore/hashmap.rs src/libcore/num/f32.rs src/libcore/num/f64.rs src/libcore/num/float.rs src/libcore/num/int-template.rs src/libcore/num/num.rs src/libcore/num/strconv.rs src/libcore/num/uint-template.rs src/libcore/ops.rs src/libcore/os.rs src/libcore/prelude.rs src/libcore/rt/mod.rs src/libcore/unstable/lang.rs src/librustc/driver/session.rs src/librustc/middle/astencode.rs src/librustc/middle/borrowck/check_loans.rs src/librustc/middle/borrowck/gather_loans.rs src/librustc/middle/borrowck/loan.rs src/librustc/middle/borrowck/preserve.rs src/librustc/middle/liveness.rs src/librustc/middle/mem_categorization.rs src/librustc/middle/region.rs src/librustc/middle/trans/base.rs src/librustc/middle/trans/inline.rs src/librustc/middle/trans/reachable.rs src/librustc/middle/typeck/check/_match.rs src/librustc/middle/typeck/check/regionck.rs src/librustc/util/ppaux.rs src/libstd/arena.rs src/libstd/ebml.rs src/libstd/json.rs src/libstd/serialize.rs src/libstd/std.rc src/libsyntax/ast_map.rs src/libsyntax/parse/parser.rs src/test/compile-fail/borrowck-uniq-via-box.rs src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs src/test/run-pass/borrowck-nested-calls.rs