about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-01-05sed -i -s 's/ for Sized?//g' **/*.rsJorge Aparicio-2/+2
2015-01-05Implement macro re-exportKeegan McAllister-1/+50
Fixes #17103.
2015-01-05Allow leading :: in use itemsKeegan McAllister-0/+4
2015-01-05Add a special macro nonterminal $crateKeegan McAllister-9/+82
2015-01-05Replace LetSyntaxTT with MacroRulesTTKeegan McAllister-57/+30
The implementation of LetSyntaxTT was specialized to macro_rules! in various ways. This gets rid of the false generality and simplifies the code.
2015-01-05Ungate default type parameters.Huon Wilson-33/+8
These are in scope for 1.0, and this is good to e.g. find as many bugs as possible.
2015-01-05Ungate globs.Huon Wilson-8/+2
These are in scope for 1.0, so this is good to e.g. make it easier find bugs.
2015-01-05Ungate associated types.Huon Wilson-24/+1
They work pretty well now, and the stdlib is using them everywhere so they're impossible to avoid anyway.
2015-01-05Refactor struct parsing and add testsJared Roesch-46/+78
2015-01-04serialize: Use assoc types + less old_orphan_checkAlex Crichton-52/+119
This commit moves the libserialize crate (and will force the hand of the rustc-serialize crate) to not require the `old_orphan_check` feature gate as well as using associated types wherever possible. Concretely, the following changes were made: * The error type of `Encoder` and `Decoder` is now an associated type, meaning that these traits have no type parameters. * The `Encoder` and `Decoder` type parameters on the `Encodable` and `Decodable` traits have moved to the corresponding method of the trait. This movement alleviates the dependency on `old_orphan_check` but implies that implementations can no longer be specialized for the type of encoder/decoder being implemented. Due to the trait definitions changing, this is a: [breaking-change]
2015-01-05Change `&` pat to only work with &T, and `&mut` with &mut T.Huon Wilson-8/+16
This implements RFC 179 by making the pattern `&<pat>` require matching against a variable of type `&T`, and introducing the pattern `&mut <pat>` which only works with variables of type `&mut T`. The pattern `&mut x` currently parses as `&(mut x)` i.e. a pattern match through a `&T` or a `&mut T` that binds the variable `x` to have type `T` and to be mutable. This should be rewritten as follows, for example, for &mut x in slice.iter() { becomes for &x in slice.iter() { let mut x = x; Due to this, this is a [breaking-change] Closes #20496.
2015-01-05auto merge of #20285 : FlaPer87/rust/oibit-send-and-friends, r=nikomatsakisbors-9/+66
This commit introduces the syntax for negative implementations of traits as shown below: `impl !Trait for Type {}` cc #13231 Part of RFC rust-lang/rfcs#127 r? @nikomatsakis
2015-01-04Fix the parsing of where-clauses for structsJared Roesch-3/+21
2015-01-05auto merge of #20163 : bfops/rust/master, r=Gankrobors-11/+8
TODOs: - ~~Entry is still `<'a, K, V>` instead of `<'a, O, V>`~~ - ~~BTreeMap is still outstanding~~. - ~~Transform appropriate things into `.entry(...).get().or_else(|e| ...)`~~ Things that make me frowny face: - I'm not happy about the fact that this `clone`s the key even when it's already owned. - With small keys (e.g. `int`s), taking a reference seems wasteful. r? @Gankro cc: @cgaebel
2015-01-04Put negative trait implemtations behind a feature gateFlavio Percoco-1/+14
2015-01-04Add syntax for negative implementations of traitsFlavio Percoco-9/+53
This commit introduces the syntax for negative implmenetations of traits as shown below: `impl !Trait for Type {}` cc #13231 Part of RFC #3
2015-01-04Merge pull request #20452 from brson/rustupbors-1/+1
Move rustup to the combined installer Reviewed-by: brson
2015-01-04[breaking change] Update entry API as part of RFC 509.Ben Foppa-11/+8
2015-01-03Remove deprecated functionalityAlex Crichton-114/+2
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-193/+193
2015-01-03sed -i -s 's/\bmod}/self}/g' **/*.rsJorge Aparicio-1/+1
2015-01-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-12/+12
2015-01-03use assoc types in binop traitsJorge Aparicio-5/+15
2015-01-03syntax: fix falloutJorge Aparicio-11/+19
2015-01-03auto merge of #20154 : P1start/rust/qualified-assoc-type-generics, ↵bors-34/+10
r=nikomatsakis This modifies `Parser::eat_lt` to always split up `<<`s, instead of doing so only when a lifetime name followed or the `force` parameter (now removed) was `true`. This is because `Foo<<TYPE` is now a valid start to a type, whereas previously only `Foo<<LIFETIME` was valid. This is a [breaking-change]. Change code that looks like this: ```rust let x = foo as bar << 13; ``` to use parentheses, like this: ```rust let x = (foo as bar) << 13; ``` Closes #17362.
2015-01-02rollup merge of #20410: japaric/assoc-typesAlex Crichton-4/+13
Conflicts: src/liballoc/lib.rs src/libcollections/lib.rs src/libcollections/slice.rs src/libcore/ops.rs src/libcore/prelude.rs src/libcore/ptr.rs src/librustc/middle/traits/project.rs src/libstd/c_str.rs src/libstd/io/mem.rs src/libstd/io/mod.rs src/libstd/lib.rs src/libstd/path/posix.rs src/libstd/path/windows.rs src/libstd/prelude.rs src/libstd/rt/exclusive.rs src/libsyntax/lib.rs src/test/compile-fail/issue-18566.rs src/test/run-pass/deref-mut-on-ref.rs src/test/run-pass/deref-on-ref.rs src/test/run-pass/dst-deref-mut.rs src/test/run-pass/dst-deref.rs src/test/run-pass/fixup-deref-mut.rs src/test/run-pass/issue-13264.rs src/test/run-pass/overloaded-autoderef-indexing.rs
2015-01-02Merge remote-tracking branch 'erickt/rustup'Brian Anderson-1/+1
2015-01-02rollup merge of #20341: nikomatsakis/impl-trait-for-trait-2Alex Crichton-3/+2
Conflicts: src/librustc/middle/traits/mod.rs src/libstd/io/mod.rs src/test/run-pass/builtin-superkinds-self-type.rs
2015-01-02Merge remote-tracking branch 'origin/master' into rollupAlex Crichton-23/+39
Conflicts: src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
2015-01-02rollup merge of #20425: sanxiyn/opt-local-tyAlex Crichton-22/+20
This avoids having ast::Ty nodes which have no counterpart in the source.
2015-01-02rollup merge of #20416: nikomatsakis/coherenceAlex Crichton-3/+23
Conflicts: src/test/run-pass/issue-15734.rs src/test/run-pass/issue-3743.rs
2015-01-02rollup merge of #20334: nagisa/ffi-llvmAlex Crichton-0/+11
Fixes #20313 r? @huonw
2015-01-02core: use assoc types in `Deref[Mut]`Jorge Aparicio-4/+13
2015-01-02rollup merge of #20377: alexcrichton/issue-20352Alex Crichton-1/+2
2015-01-02Fix fallout from change, adding explicit `Sized` annotations where necessary.Niko Matsakis-3/+2
2015-01-02std: Stabilize the prelude moduleAlex Crichton-25/+45
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
2015-01-02Make type in ast::Local optionalSeo Sanghyeon-22/+20
2015-01-02Accept `derive` instead of `deriving`Nick Cameron-22/+34
[breaking-change] `deriving is still accepted, but gives a deprecation warning
2015-01-02Accept `self` in place of `mod` in use itemsNick Cameron-1/+5
[breaking-change] `mod` is still accepted, but gives a deprecated warning
2015-01-02Fix orphan checking (cc #19470). (This is not a complete fix of #19470 ↵Niko Matsakis-3/+23
because of the backwards compatibility feature gate.) This is a [breaking-change]. The new rules require that, for an impl of a trait defined in some other crate, two conditions must hold: 1. Some type must be local. 2. Every type parameter must appear "under" some local type. Here are some examples that are legal: ```rust struct MyStruct<T> { ... } // Here `T` appears "under' `MyStruct`. impl<T> Clone for MyStruct<T> { } // Here `T` appears "under' `MyStruct` as well. Note that it also appears // elsewhere. impl<T> Iterator<T> for MyStruct<T> { } ``` Here is an illegal example: ```rust // Here `U` does not appear "under" `MyStruct` or any other local type. // We call `U` "uncovered". impl<T,U> Iterator<U> for MyStruct<T> { } ``` There are a couple of ways to rewrite this last example so that it is legal: 1. In some cases, the uncovered type parameter (here, `U`) should be converted into an associated type. This is however a non-local change that requires access to the original trait. Also, associated types are not fully baked. 2. Add `U` as a type parameter of `MyStruct`: ```rust struct MyStruct<T,U> { ... } impl<T,U> Iterator<U> for MyStruct<T,U> { } ``` 3. Create a newtype wrapper for `U` ```rust impl<T,U> Iterator<Wrapper<U>> for MyStruct<T,U> { } ``` Because associated types are not fully baked, which in the case of the `Hash` trait makes adhering to this rule impossible, you can temporarily disable this rule in your crate by using `#![feature(old_orphan_check)]`. Note that the `old_orphan_check` feature will be removed before 1.0 is released.
2015-01-01std: Enforce Unicode in fmt::WriterAlex Crichton-1/+2
This commit is an implementation of [RFC 526][rfc] which is a change to alter the definition of the old `fmt::FormatWriter`. The new trait, renamed to `Writer`, now only exposes one method `write_str` in order to guarantee that all implementations of the formatting traits can only produce valid Unicode. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md One of the primary improvements of this patch is the performance of the `.to_string()` method by avoiding an almost-always redundant UTF-8 check. This is a breaking change due to the renaming of the trait as well as the loss of the `write` method, but migration paths should be relatively easy: * All usage of `write` should move to `write_str`. If truly binary data was being written in an implementation of `Show`, then it will need to use a different trait or an altogether different code path. * All usage of `write!` should continue to work as-is with no modifications. * All usage of `Show` where implementations just delegate to another should continue to work as-is. [breaking-change] Closes #20352
2015-01-02More falloutNick Cameron-1/+1
2015-01-02Fallout - change array syntax to use `;`Nick Cameron-2/+2
2015-01-02Accept ranges with only a maximum value: `..expr`Nick Cameron-4/+11
2015-01-02Disallow [_, ..n] syntax for fixed length arrays and repeating array ↵Nick Cameron-15/+2
constructors Closes #19999 [breaking-change] Use [_; n] instead.
2015-01-01auto merge of #20190 : cmr/rust/gate-macro-args, r=alexcrichtonbors-35/+120
Uses the same approach as https://github.com/rust-lang/rust/pull/17286 (and subsequent changes making it more correct), where the visitor will skip any pieces of the AST that are from "foreign code", where the spans don't line up, indicating that that piece of code is due to a macro expansion. If this breaks your code, read the error message to determine which feature gate you should add to your crate. Closes #18102 [breaking-change]
2015-01-01Feature gate macro argumentsCorey Richardson-35/+120
Uses the same approach as https://github.com/rust-lang/rust/pull/17286 (and subsequent changes making it more correct), where the visitor will skip any pieces of the AST that are from "foreign code", where the spans don't line up, indicating that that piece of code is due to a macro expansion. If this breaks your code, read the error message to determine which feature gate you should add to your crate, and bask in the knowledge that your code won't mysteriously break should you try to use the 1.0 release. Closes #18102 [breaking-change]
2014-12-31syntax: unbox closures used in let bindingsJorge Aparicio-15/+15
2014-12-31syntax: unbox closures used in function argumentsJorge Aparicio-31/+35
2014-12-31Feature gate FFI imports of LLVM intrinsicsSimonas Kazlauskas-0/+11
Fixes #20313