about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2014-04-22add support for quadruple precision floating pointDaniel Micay-1/+2
This currently requires linking against a library like libquadmath (or libgcc), because compiler-rt barely has any support for this and most hardware does not yet have 128-bit precision floating point. For this reason, it's currently hidden behind a feature gate. When compiler-rt is updated to trunk, some tests can be added for constant evaluation since there will be support for the comparison operators. Closes #13381
2014-04-23Support unsized types with the `type` keywordNick Cameron-11/+23
2014-04-23Add a span to ast::TyParamNick Cameron-3/+6
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-39/+39
2014-04-18Update the rest of the compiler with ~[T] changesAlex Crichton-3/+2
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-161/+232
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-04-13rustc: Don't link in syntax extensionsAlex Crichton-5/+2
This bug was introduced in #13384 by accident, and this commit continues the work of #13384 by finishing support for loading a syntax extension crate without registering it with the local cstore. Closes #13495
2014-04-10auto merge of #13440 : huonw/rust/strbuf, r=alexcrichtonbors-9/+14
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and port all code over to use it. Rebased & tests-fixed version of https://github.com/mozilla/rust/pull/13269
2014-04-10Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and ↵Kasey Carrothers-2/+2
updated associated variable and function names.
2014-04-10std,syntax: make std::fmt::parse use `Vec`s.Huon Wilson-4/+4
2014-04-10libstd: Implement `StrBuf`, a new string buffer type like `Vec`, andPatrick Walton-9/+14
port all code over to use it.
2014-04-08Test fixes from rollupAlex Crichton-8/+0
Closes #13394 (sync: remove unsafe and add Send+Share to Deref (enabled by autoderef vtables)) Closes #13389 (Made libflate functions return Options instead of outright failing) Closes #13388 (doc: Document flavorful variations of paths) Closes #13387 (Register new snapshots) Closes #13386 (std: Add more docs for ptr mod) Closes #13384 (Tweak crate loading to load less metadata) Closes #13382 (fix ~ZeroSizeType rvalues) Closes #13378 (Update tidy script, replace XXX with FIXME) Closes #13377 (std: User a smaller stdin buffer on windows) Closes #13369 (Fix spelling errors in comments.) Closes #13314 (Made 'make install' include libs for additional targets) Closes #13278 (std: make vec!() macro handle a trailing comma) Closes #13276 (Add test for #11881)
2014-04-08rustc: Never register syntax crates in CStoreAlex Crichton-7/+6
When linking, all crates in the local CStore are used to link the final product. With #[phase(syntax)], crates want to be omitted from this linkage phase, and this was achieved by dumping the entire CStore after loading crates. This causes crates like the standard library to get loaded twice. This loading process is a fairly expensive operation when dealing with decompressing metadata. This commit alters the loading process to never register syntax crates in CStore. Instead, only phase(link) crates ever make their way into the map of crates. The CrateLoader trait was altered to return everything in one method instead of having separate methods for finding information.
2014-04-08Register new snapshotsAlex Crichton-3/+3
2014-04-06De-~[] Reader and WriterSteven Fackler-2/+2
There's a little more allocation here and there now since from_utf8_owned can't be used with Vec.
2014-04-04syntax: remove obsolete mutability from ExprVec and ExprRepeat.Eduard Burtescu-1/+1
2014-04-03syntax: Remove AbiSet, use one AbiAlex Crichton-2/+2
This change removes the AbiSet from the AST, converting all usage to have just one Abi value. The current scheme selects a relevant ABI given a list of ABIs based on the target architecture and how relevant each ABI is to that architecture. Instead of this mildly complicated scheme, only one ABI will be allowed in abi strings, and pseudo-abis will be created for special cases as necessary. For example the "system" abi exists for stdcall on win32 and C on win64. Closes #10049
2014-03-31syntax: Switch field privacy as necessaryAlex Crichton-58/+60
2014-03-31vec: convert `append` and `append_one` to methodsDaniel Micay-3/+1
These were only free functions on `~[T]` because taking self by-value used to be broken.
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-47/+51
2014-03-28auto merge of #13170 : eddyb/rust/syntax-cleanup, r=alexcrichtonbors-212/+185
Removes all Cell's/RefCell's from lexer::Reader implementations and a couple @.
2014-03-28syntax: Accept meta matchers in macrosAlex Crichton-1/+1
This removes the `attr` matcher and adds a `meta` matcher. The previous `attr` matcher is now ambiguous because it doesn't disambiguate whether it means inner attribute or outer attribute. The new behavior can still be achieved by taking an argument of the form `#[$foo:meta]` (the brackets are part of the macro pattern). Closes #13067
2014-03-28De-@ NamedMatch.Eduard Burtescu-26/+27
2014-03-28De-@ TokenTree.Eduard Burtescu-7/+11
2014-03-28Used inherited mutability in lexer::Reader.Eduard Burtescu-184/+152
2014-03-27serialize: use ResultSean McArthur-15/+103
All of Decoder and Encoder's methods now return a Result. Encodable.encode() and Decodable.decode() return a Result as well. fixes #12292
2014-03-26auto merge of #13145 : alexcrichton/rust/flip-some-defaults, r=brsonbors-3/+3
This change prepares `rustc` to accept private fields by default. These changes will have to go through a snapshot before the rest of the changes can happen.
2014-03-26syntax: Permit visibility on tuple fieldsAlex Crichton-3/+3
This change is in preparation for #8122. Nothing is currently done with these visibility qualifiers, they are just parsed and accepted by the compiler. RFC: 0004-private-fields
2014-03-25Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by ↵Marvin Löbel-4/+4
value
2014-03-24auto merge of #12998 : huonw/rust/log_syntax, r=alexcrichtonbors-35/+33
syntax: allow `trace_macros!` and `log_syntax!` in item position. Previously trace_macros!(true) fn main() {} would complain about `trace_macros` being an expression macro in item position. This is a pointless limitation, because the macro is purely compile-time, with no runtime effect. (And similarly for log_syntax.) This also changes the behaviour of `trace_macros!` very slightly, it used to be equivalent to macro_rules! trace_macros { (true $($_x: tt)*) => { true }; (false $($_x: tt)*) => { false } } I.e. you could invoke it with arbitrary trailing arguments, which were ignored. It is changed to accept only exactly `true` or `false` (with no trailing arguments) and expands to `()`.
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-7/+16
`TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-22syntax: Fix fallout of removing get()Alex Crichton-81/+52
2014-03-22Migrate all users of opt_vec to owned_slice, delete opt_vec.Huon Wilson-35/+31
syntax::opt_vec is now entirely unused, and so can go.
2014-03-22syntax: allow `trace_macros!` and `log_syntax!` in item position.Huon Wilson-35/+33
Previously trace_macros!(true) fn main() {} would complain about `trace_macros` being an expression macro in item position. This is a pointless limitation, because the macro is purely compile-time, with no runtime effect. (And similarly for log_syntax.) This also changes the behaviour of `trace_macros!` very slightly, it used to be equivalent to macro_rules! trace_macros { (true $($_x: tt)*) => { true }; (false $($_x: tt)*) => { false } } I.e. you could invoke it with arbitrary trailing arguments, which were ignored. It is changed to accept only exactly `true` or `false` (with no trailing arguments) and expands to `()`.
2014-03-21syntax: make OptVec immutable.Huon Wilson-10/+15
This is the first step to replacing OptVec with a new representation: remove all mutability. Any mutations have to go via `Vec` and then make to `OptVec`. Many of the uses of OptVec are unnecessary now that Vec has no-alloc emptiness (and have been converted to Vec): the only ones that really need it are the AST and sty's (and so on) where there are a *lot* of instances of them, and they're (mostly) immutable.
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-52/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-36/+36
Closes #12771
2014-03-20rename std::vec -> std::sliceDaniel Micay-2/+2
Closes #12702
2014-03-19auto merge of #12770 : eddyb/rust/drop-tld, r=cmrbors-0/+9
Sadly, this seems to make memory usage worse (unless `Vec<T>` makes it worse and this PR doesn't change that much, which is entirely possible).
2014-03-19Discard MTWT & interner tables from TLD after they stop being useful.Eduard Burtescu-0/+9
2014-03-18Docify std::vec_ngSteven Fackler-6/+6
I also removed a couple of methods that were silly and added sort.
2014-03-17rustc: disallow trailing parentheses for nullary enum variantsLaurent Bonnans-1/+1
Fixes #12560
2014-03-17Fix rustdoc and tests.Eduard Burtescu-7/+7
2014-03-17De-@ codemap and diagnostic.Eduard Burtescu-19/+18
2014-03-17De-@ ParseSess uses.Eduard Burtescu-21/+22
2014-03-16auto merge of #12929 : sfackler/rust/automatically-derived, r=cmrbors-8/+4
This will enable rustdoc to treat them specially. I also got rid of `std::cmp::cmp2`, which is isomorphic to the `TotalOrd` impl for 2-tuples and never used.
2014-03-15Tag derived impls with #[automatically_derived]Steven Fackler-8/+4
This will enable rustdoc to treat them specially.
2014-03-15rustc: Remove compiler support for __log_level()Alex Crichton-1/+1
This commit removes all internal support for the previously used __log_level() expression. The logging subsystem was previously modified to not rely on this magical expression. This also removes the only other function to use the module_data map in trans, decl_gc_metadata. It appears that this is an ancient function from a GC only used long ago. This does not remove the crate map entirely, as libgreen still uses it to hook in to the event loop provided by libgreen.
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-1/+12
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }
2014-03-13auto merge of #12798 : pczarn/rust/inline-asm, r=alexcrichtonbors-50/+69
## read+write modifier '+' This small sugar was left out in the original implementation (#5359). When an output operand with the '+' modifier is encountered, we store the index of that operand alongside the expression to create and append an input operand later. The following lines are equivalent: ``` asm!("" : "+m"(expr)); asm!("" : "=m"(expr) : "0"(expr)); ``` ## misplaced options and clobbers give a warning It's really annoying when a small typo might change behavior without any warning. ``` asm!("mov $1, $0" : "=r"(x) : "r"(8u) : "cc" , "volatile"); //~^ WARNING expected a clobber, but found an option ``` ## liveness Fixed incorrect order of propagation. Sometimes it caused spurious warnings in code: `warning: value assigned to `i` is never read, #[warn(dead_assignment)] on by default` ~~Note: Rebased on top of another PR. (uses other changes)~~ * [x] Implement read+write * [x] Warn about misplaced options * [x] Fix liveness (`dead_assignment` lint) * [x] Add all tests