summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-12/+17
`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-23Register new snapshotsFlavio Percoco-1/+0
2014-03-23use TotalEq for HashMapDaniel Micay-89/+92
Closes #5283
2014-03-22auto merge of #13085 : edwardw/rust/saddest-cell, r=cmrbors-9/+8
2014-03-22auto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichtonbors-1/+1
This PR removes the `Freeze` kind and the `NoFreeze` marker completely. Fixes #12577 cc @nikomatsakis r?
2014-03-23Get rid of @CellEdward Wang-9/+8
2014-03-22syntax: Fix fallout of removing get()Alex Crichton-209/+159
2014-03-22doc: Remove Freeze / NoFreeze from docsFlavio Percoco-1/+1
2014-03-21auto merge of #13016 : huonw/rust/new-opt-vec, r=cmrbors-320/+243
Replace syntax::opt_vec with syntax::owned_slice The `owned_slice::OwnedSlice` is `(*T, uint)` (i.e. a direct equivalent to DSTs `~[T]`). This shaves two words off the old OptVec type; and also makes substituting in other implementations easy, by removing all the mutation methods. (And also everything that's very rarely/never used.)
2014-03-22Migrate all users of opt_vec to owned_slice, delete opt_vec.Huon Wilson-267/+85
syntax::opt_vec is now entirely unused, and so can go.
2014-03-22syntax: add the OwnedSlice vector wrapper.Huon Wilson-0/+143
This is a stand-in until we have a saner `~[T]` type (i.e. a proper owned slice). It's a library version of what `~[T]` will be, i.e. an owned pointer and a length.
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-21Rewrite rc::Rc using cell::CellEdward Wang-8/+0
Since `Arc` has been using `Atomic`, this closes 12625. Closes #12625.
2014-03-20syntax: Tidy up parsing the new attribute syntaxAlex Crichton-47/+41
2014-03-20Added new attribute syntax with backward compatibility.Daniel Fagnan-11/+51
Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
2014-03-21syntax: make OptVec immutable.Huon Wilson-60/+22
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-20Register new snapshotsAlex Crichton-3/+3
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-84/+7
It's now in the prelude.
2014-03-20auto merge of #12686 : FlaPer87/rust/shared, r=nikomatsakisbors-9/+1
`Share` implies that all *reachable* content is *threadsafe*. Threadsafe is defined as "exposing no operation that permits a data race if multiple threads have access to a &T pointer simultaneously". (NB: the type system should guarantee that if you have access to memory via a &T pointer, the only other way to gain access to that memory is through another &T pointer)... Fixes #11781 cc #12577 What this PR will do ================ - [x] Add Share kind and - [x] Replace usages of Freeze with Share in bounds. - [x] Add Unsafe<T> #12577 - [x] Forbid taking the address of a immutable static item with `Unsafe<T>` interior What's left to do in a separate PR (after the snapshot)? =========================================== - Remove `Freeze` completely
2014-03-20auto merge of #13028 : thestinger/rust/vec_ng, r=huonwbors-76/+76
Closes #12771
2014-03-20Relax interner's Share boundFlavio Percoco-12/+1
The interner uses `RefCell` internally which opted out from Share.
2014-03-20Replace Freeze bounds with Share boundsFlavio Percoco-5/+8
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-76/+76
Closes #12771
2014-03-20auto merge of #12854 : nick29581/rust/parse-enum-struct, r=alexcrichtonbors-10/+8
...where the field and variable are unified
2014-03-20rename std::vec -> std::sliceDaniel Micay-8/+8
Closes #12702
2014-03-20Fix spans for enum-struct match armsNick Cameron-10/+8
Correct spans for fields in enum struct arms where the field and variable are unified
2014-03-19auto merge of #12770 : eddyb/rust/drop-tld, r=cmrbors-0/+19
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/+19
2014-03-18Docify std::vec_ngSteven Fackler-6/+6
I also removed a couple of methods that were silly and added sort.
2014-03-18libsyntax: librustdoc: ignore utf-8 BOM in .rs filesLiigo Zhuang-1/+10
Closes #12974
2014-03-18syntax: Don't parameterize the the pretty printerAlex Crichton-20/+21
The pretty printer constitues an enormous amount of code, there's no reason for it to be generic. This just least to a huge amount of metadata which isn't necessary. Instead, this change migrates the pretty printer to using a trait object instead. Closes #12985
2014-03-17rustc: disallow trailing parentheses for nullary enum variantsLaurent Bonnans-3/+20
Fixes #12560
2014-03-17Fix rustdoc and tests.Eduard Burtescu-68/+48
2014-03-17Refactor pprust a bit.Eduard Burtescu-2107/+1963
2014-03-17De-@ codemap and diagnostic.Eduard Burtescu-215/+189
2014-03-17De-@ ParseSess uses.Eduard Burtescu-93/+75
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-18/+2
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-36/+45
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-14auto merge of #12896 : alexcrichton/rust/goodbye-extra, r=brsonbors-1/+1
This commit shreds all remnants of libextra from the compiler and standard distribution. Two modules, c_vec/tempfile, were moved into libstd after some cleanup, and the other modules were moved to separate crates as seen fit. Closes #8784 Closes #12413 Closes #12576
2014-03-14extra: Put the nail in the coffin, delete libextraAlex Crichton-1/+1
This commit shreds all remnants of libextra from the compiler and standard distribution. Two modules, c_vec/tempfile, were moved into libstd after some cleanup, and the other modules were moved to separate crates as seen fit. Closes #8784 Closes #12413 Closes #12576
2014-03-14rustc: Fix cfg(not(a, b)) to be not(a && b)Alex Crichton-2/+2
Previously, the cfg attribute `cfg(not(a, b))` was translated to `(!a && !b)`, but this isn't very useful because that can already be expressed as `cfg(not(a), not(b))`. This commit changes the translation to `!(a && b)` which is more symmetrical of the rest of the `cfg` attribute. Put another way, I would expect `cfg(clause)` to be the opposite of `cfg(not(clause))`, but this is not currently the case with multiple element clauses.
2014-03-14auto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakisbors-3/+5
# Summary This patch introduces the `_` token into the type grammar, with the meaning "infer this type". With this change, the following two lines become equivalent: ``` let x = foo(); let x: _ = foo(); ``` But due to its composability, it enables partial type hints like this: ``` let x: Bar<_> = baz(); ``` Using it on the item level is explicitly forbidden, as the Rust language does not enable global type inference by design. This implements the feature requested in https://github.com/mozilla/rust/issues/9508. # Things requiring clarification - The change to enable it is very small, but I have only limited understanding of the related code, so the approach here might be wrong. - In particular, while this patch works, it does so in a way not originally intended according to the code comments. - This probably needs more tests, or rather feedback for which tests are still missing. - I'm unsure how this interacts with lifetime parameters, and whether it is correct in regard to them. - Partial type hints on the right side of `as` like `&foo as *_` work in both a normal function contexts and in constexprs like `static foo: *int = &'static 123 as *_`. The question is whether this should be allowed in general. # Todo for this PR - The manual and tutorial still needs updating. # Bugs I'm unsure how to fix - Requesting inference for the top level of the right hand side of a `as` fails to infer correctly, even if all possible hints are given: ``` .../type_hole_1.rs:35:18: 35:22 error: the type of this value must be known in this context .../type_hole_1.rs:35 let a: int = 1u32 as _; ^~~~ ```
2014-03-14Added support for type placeholders (explicit requested typeMarvin Löbel-3/+5
inference in a type with `_` ). This enables partial type inference.
2014-03-14auto merge of #12874 : huonw/rust/printier-rustc, r=alexcrichtonbors-10/+11
rustc: make stack traces print for .span_bug/.bug. Previously a call to either of those to diagnostic printers would defer to the `fatal` equivalents, which explicitly silence the stderr printing, including a stack trace from `RUST_LOG=std::rt::backtrace`. This splits the bug printers out to their own diagnostic type so that things work properly. Also, this removes the `Ok(...)` that was being printed around the subtask's stderr output.
2014-03-13auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestingerbors-0/+1
lint: add lint for use of a `~[T]`. This is useless at the moment (since pretty much every crate uses `~[]`), but should help avoid regressions once completely removed from a crate.
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
2014-03-14lint: add lint for use of a `~[T]`.Huon Wilson-0/+1
This is useless at the moment (since pretty much every crate uses `~[]`), but should help avoid regressions once completely removed from a crate.
2014-03-14rustc: make stack traces print for .span_bug/.bug.Huon Wilson-10/+11
Previously a call to either of those to diagnostic printers would defer to the `fatal` equivalents, which explicitly silence the stderr printing, including a stack trace from `RUST_LOG=std::rt::backtrace`. This splits the bug printers out to their own diagnostic type so that things work properly. Also, this removes the `Ok(...)` that was being printed around the subtask's stderr output.