about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2015-01-05Change `&` pat to only work with &T, and `&mut` with &mut T.Huon Wilson-1/+1
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-0/+19
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-04Add syntax for negative implementations of traitsFlavio Percoco-0/+19
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-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-104/+104
2015-01-02Merge remote-tracking branch 'erickt/rustup'Brian Anderson-1/+1
2015-01-02rollup merge of #20425: sanxiyn/opt-local-tyAlex Crichton-1/+1
This avoids having ast::Ty nodes which have no counterpart in the source.
2015-01-02Make type in ast::Local optionalSeo Sanghyeon-1/+1
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
2014-12-30Add a FIXME relating to using `ast::Name`Niko Matsakis-1/+1
2014-12-29rollup merge of #20194: nick29581/dst-syntaxAlex Crichton-5/+10
Part of #19607. r? @nikomatsakis
2014-12-30Remove ExprSlice by hacking the compilerNick Cameron-1/+0
[breaking-change] The `mut` in slices is now redundant. Mutability is 'inferred' from position. This means that if mutability is only obvious from the type, you will need to use explicit calls to the slicing methods.
2014-12-30Add hypothetical support for ranges with only an upper boundNick Cameron-1/+1
Note that this doesn't add the surface syntax.
2014-12-29syntax: whitespace cleanupErick Tryzelaar-1/+1
2014-12-29Slash the ast::Stmt type from 104 to 24 bytes.Huon Wilson-1/+1
(on platforms with 64-bit pointers.) The StmtMac variant is rather large and also fairly rare, so let's optimise the common case.
2014-12-26Accept `?Sized` as well as `Sized?`Nick Cameron-5/+10
Includes a bit of refactoring to store `?` unbounds as bounds with a modifier, rather than in their own world, in the AST at least.
2014-12-24Add syntax for rangesNick Cameron-0/+1
2014-12-22rollup merge of #20033: alexcrichton/deprecate-serialiseAlex Crichton-103/+106
This commit completes the deprecation story for the in-tree serialization library. The compiler will now emit a warning whenever it encounters `deriving(Encodable)` or `deriving(Decodable)`, and the library itself is now marked `#[unstable]` for when feature staging is enabled. All users of serialization can migrate to the `rustc-serialize` crate on crates.io which provides the exact same interface as the libserialize library in-tree. The new deriving modes are named `RustcEncodable` and `RustcDecodable` and require `extern crate "rustc-serialize" as rustc_serialize` at the crate root in order to expand correctly. To migrate all crates, add the following to your `Cargo.toml`: [dependencies] rustc-serialize = "0.1.1" And then add the following to your crate root: extern crate "rustc-serialize" as rustc_serialize; Finally, rename `Encodable` and `Decodable` deriving modes to `RustcEncodable` and `RustcDecodable`. [breaking-change]
2014-12-22serialize: Fully deprecate the libraryAlex Crichton-103/+106
This commit completes the deprecation story for the in-tree serialization library. The compiler will now emit a warning whenever it encounters `deriving(Encodable)` or `deriving(Decodable)`, and the library itself is now marked `#[unstable]` for when feature staging is enabled. All users of serialization can migrate to the `rustc-serialize` crate on crates.io which provides the exact same interface as the libserialize library in-tree. The new deriving modes are named `RustcEncodable` and `RustcDecodable` and require `extern crate "rustc-serialize" as rustc_serialize` at the crate root in order to expand correctly. To migrate all crates, add the following to your `Cargo.toml`: [dependencies] rustc-serialize = "0.1.1" And then add the following to your crate root: extern crate "rustc-serialize" as rustc_serialize; Finally, rename `Encodable` and `Decodable` deriving modes to `RustcEncodable` and `RustcDecodable`. [breaking-change]
2014-12-21Fallout of std::str stabilizationAlex Crichton-1/+1
2014-12-21rollup merge of #20039: barosl/if-let-friendly-errorAlex Crichton-4/+3
Fixes #19991.
2014-12-20Add support for multiple region bounds in where clausesJared Roesch-3/+1
2014-12-20Add parser support for generalized where clausesJared Roesch-2/+11
Implement support in the parser for generalized where clauses, as well as the conversion of ast::WherePredicates to ty::Predicate in `collect.rs`.
2014-12-20Drop the Match prefix from the MatchSource variantsBarosl Lee-4/+3
2014-12-20Print a friendly error for the if-let construct without an else blockBarosl Lee-1/+1
Fixes #19991.
2014-12-19libsyntax: use `#[deriving(Copy)]`Jorge Aparicio-90/+30
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-2/+15
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-16AST refactor: make the place in ExprBox an option.Felix S. Klock II-1/+1
This is to allow us to migrate away from UnUniq in a followup commit, and thus unify the code paths related to all forms of `box`.
2014-12-14Parse `unsafe impl` but don't do anything particularly interesting with the ↵Niko Matsakis-1/+2
results.
2014-12-14Parse `unsafe trait` but do not do anything with it beyond parsing and ↵Niko Matsakis-1/+2
integrating into rustdoc etc.
2014-12-14Rename FnStyle trait to Unsafety.Niko Matsakis-17/+12
2014-12-14Remove `proc` types/expressions from the parser, compiler, andNiko Matsakis-3/+0
language. Recommend `move||` instead.
2014-12-12Add support for equality constraints on associated typesNick Cameron-2/+41
2014-12-11Register new snapshotsAlex Crichton-1/+0
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-1/+64
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-11-30syntax: Make `asm!` clobbers a proper vector.Kang Seonghoon-1/+1
Otherwise `--pretty expanded` diverges.
2014-11-26rollup merge of #19329: steveklabnik/doc_style_cleanup2Alex Crichton-4/+2
2014-11-26/*! -> //!Steve Klabnik-4/+2
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-26Implement the new parsing rules for types in the parser, modifying the AST ↵Niko Matsakis-1/+3
appropriately.
2014-11-23Remove type parameters from ExprField and ExprTupFieldAdolfo Ochagavía-2/+2
2014-11-20auto merge of #19113 : nikomatsakis/rust/unboxed-boxed-closure-unification, ↵bors-2/+1
r=acrichto Use the expected type to infer the argument/return types of unboxed closures. Also, in `||` expressions, use the expected type to decide if the result should be a boxed or unboxed closure (and if an unboxed closure, what kind). This supercedes PR #19089, which was already reviewed by @pcwalton.
2014-11-19rollup merge of #19103: huonw/literal-suffixesJakub Bukaj-1/+1
Futureproof Rust for fancier suffixed literals. The Rust compiler tokenises a literal followed immediately (no whitespace) by an identifier as a single token: (for example) the text sequences `"foo"bar`, `1baz` and `1u1024` are now a single token rather than the pairs `"foo"` `bar`, `1` `baz` and `1u` `1024` respectively. The compiler rejects all such suffixes in the parser, except for the 12 numeric suffixes we have now. I'm fairly sure this will affect very few programs, since it's not currently legal to have `<literal><identifier>` in a Rust program, except in a macro invocation. Any macro invocation relying on this behaviour can simply separate the two tokens with whitespace: `foo!("bar"baz)` becomes `foo!("bar" baz)`. This implements [RFC 463](https://github.com/rust-lang/rfcs/blob/master/text/0463-future-proof-literal-suffixes.md), and so closes https://github.com/rust-lang/rust/issues/19088.
2014-11-19rollup merge of #19040: alexcrichton/issue-18904Jakub Bukaj-1/+1
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc]. There are a number of breaking changes as a part of this commit which will need to be handled to migrated old code: * A number of formatting traits have been removed: String, Bool, Char, Unsigned, Signed, and Float. It is recommended to instead use Show wherever possible or to use adaptor structs to implement other methods of formatting. * The format specifier for Boolean has changed from `t` to `b`. * The enum `FormatError` has been renamed to `Error` as well as becoming a unit struct instead of an enum. The `WriteError` variant no longer exists. * The `format_args_method!` macro has been removed with no replacement. Alter code to use the `format_args!` macro instead. * The public fields of a `Formatter` have become read-only with no replacement. Use a new formatting string to alter the formatting flags in combination with the `write!` macro. The fields can be accessed through accessor methods on the `Formatter` structure. Other than these breaking changes, the contents of std::fmt should now also all contain stability markers. Most of them are still #[unstable] or #[experimental] [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md [breaking-change] Closes #18904
2014-11-19Merge the ExprFnBlock and ExprUnboxedClosure into one ExprClosure with an ↵Niko Matsakis-2/+1
optional unboxed closure kind.
2014-11-20Parse and store suffixes on literals.Huon Wilson-1/+1
This adds an optional suffix at the end of a literal token: `"foo"bar`. An actual use of a suffix in a expression (or other literal that the compiler reads) is rejected in the parser. This doesn't switch the handling of numbers to this system, and doesn't outlaw illegal suffixes for them yet.
2014-11-19Refactor QPath to take an ast::TraitRefNiko Matsakis-3/+3
2014-11-18std: Stabilize std::fmtAlex Crichton-1/+1
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc]. There are a number of breaking changes as a part of this commit which will need to be handled to migrated old code: * A number of formatting traits have been removed: String, Bool, Char, Unsigned, Signed, and Float. It is recommended to instead use Show wherever possible or to use adaptor structs to implement other methods of formatting. * The format specifier for Boolean has changed from `t` to `b`. * The enum `FormatError` has been renamed to `Error` as well as becoming a unit struct instead of an enum. The `WriteError` variant no longer exists. * The `format_args_method!` macro has been removed with no replacement. Alter code to use the `format_args!` macro instead. * The public fields of a `Formatter` have become read-only with no replacement. Use a new formatting string to alter the formatting flags in combination with the `write!` macro. The fields can be accessed through accessor methods on the `Formatter` structure. Other than these breaking changes, the contents of std::fmt should now also all contain stability markers. Most of them are still #[unstable] or #[experimental] [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md [breaking-change] Closes #18904
2014-11-19Switch to an independent enum for `Lit*` subtokens.Huon Wilson-1/+1
2014-11-18Convert TyPolyTraitRef to accept arbitary bounds, so that things likeNiko Matsakis-1/+1
`Box<for<'a> Foo<&'a T> + 'a>` can be accepted. Also cleanup the visitor/fold in general, exposing more callbacks.
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+49
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]