about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2014-11-16auto merge of #18994 : sfackler/rust/struct-variants-pt2, r=jakub-bors-2/+2
Struct variant field visibility is now inherited. Remove `pub` keywords from declarations. Closes #18641 [breaking-change] r? @alexcrichton
2014-11-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-12/+13
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-15Un-feature gate struct variantsSteven Fackler-2/+2
Struct variant field visibility is now inherited. Remove `pub` keywords from declarations. Closes #18641 [breaking-change]
2014-11-14auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichtonbors-3/+3
This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below: [breaking-change] - `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`. - `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead. - `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers. - `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value. - `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that - `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically. - `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead. - The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt` - `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types. - `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.
2014-11-13auto merge of #18811 : pczarn/rust/issue-18763-ice, r=pnkfelixbors-5/+5
Fix ICEs introduced in #17830 * fixed get_tt for doc comments * properly handle MatchNt in `quote` Fixes #18763 Fixes #18775
2014-11-13Remove lots of numeric traits from the preludesBrendan Zabarauskas-0/+1
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-11-13Deprecate Zero and One traitsBrendan Zabarauskas-3/+2
2014-11-10Document ast::Ty_Manish Goregaokar-2/+18
2014-11-09Fix ICEs that involved quasi-quotationPiotr Czarnecki-5/+5
* fixed get_tt for doc comments * properly handle MatchNt in `quote` Fixes #18763 Fixes #18775
2014-11-07Update parser with `for` syntaxNiko Matsakis-6/+14
2014-11-07auto merge of #17830 : pczarn/rust/interp_tt, r=pnkfelixbors-80/+83
Closes #14197 Removes the `matchers` nonterminal. If you're using `$foo:matchers` in a macro, write `$foo:tt` instead. [breaking-change]
2014-11-07Add `ast::SequenceRepetition`Piotr Czarnecki-32/+63
2014-11-06Remove the unboxed closure `|:|` notation from types and trait references ↵Niko Matsakis-16/+0
completely.
2014-11-06Support parenthesized paths `Foo(A,B) -> C` that expand to `Foo<(A,B),C>`. ↵Niko Matsakis-1/+96
These paths also bind anonymous regions (or will, once HRTB is fully working). Fixes #18423.
2014-11-05Remove `Matcher`sPiotr Czarnecki-72/+12
2014-11-05Use `TokenTree`s in lhs of macrosPiotr Czarnecki-9/+41
2014-11-05Register snapshots.Eduard Burtescu-3/+0
2014-11-03rollup merge of #18568 : gamazeps/issue18551Alex Crichton-1/+1
2014-11-03rollup merge of #18506 : nikomatsakis/assoc-type-boundsAlex Crichton-3/+1
2014-11-03Restructure AST so that the associated type definition carriesNiko Matsakis-3/+1
bounds like any other "type parameter".
2014-11-03Clean-up transmutes in libsyntaxAriel Ben-Yehuda-1/+1
2014-11-03Doc: corrects obsolete pointer syntaxgamazeps-1/+1
Goes from ~ to box Closes #18551
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-15/+36
This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
2014-10-29Rename fail! to panic!Steve Klabnik-1/+1
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-28Convert some token functions into methodsBrendan Zabarauskas-1/+1
2014-10-27rollup merge of #18332 : jbcrail/fix-commentsAlex Crichton-1/+1
2014-10-25Fix spelling mistakes in comments.Joseph Crail-1/+1
2014-10-26Add a KleeneOp enum for clarityBrendan Zabarauskas-7/+12
2014-10-26Reduce the size of the TokenTreeBrendan Zabarauskas-3/+2
2014-10-26Use standard capitalisation for TokenTree variantsBrendan Zabarauskas-13/+13
2014-10-26Rename TokenTree variants for clarityBrendan Zabarauskas-12/+15
This should be clearer, and fits in better with the `TTNonterminal` variant. Renames: - `TTTok` -> `TTToken` - `TTDelim` -> `TTDelimited` - `TTSeq` -> `TTSequence`
2014-10-26Add Span and separate open/close delims to TTDelimBrendan Zabarauskas-3/+28
This came up when working [on the gl-rs generator extension](https://github.com/bjz/gl-rs/blob/990383de801bd2e233159d5be07c9b5622827620/src/gl_generator/lib.rs#L135-L146). The new definition of `TTDelim` adds an associated `Span` that covers the whole token tree and enforces the invariant that a delimited sequence of token trees must have an opening and closing delimiter. A `get_span` method has also been added to `TokenTree` type to make it easier to implement better error messages for syntax extensions.
2014-10-24Add a lint for not using field pattern shorthandsP1start-1/+2
Closes #17792.
2014-10-16libsyntax: Remove all uses of {:?}.Luqman Aden-1/+1
2014-10-13rollup merge of #17927 : alexcrichton/more-constAlex Crichton-1/+3
2014-10-13auto merge of #17733 : jgallagher/rust/while-let, r=alexcrichtonbors-1/+4
This is *heavily* based on `if let` (#17634) by @jakub- and @kballard This should close #17687
2014-10-12rustc: Warn about dead constantsAlex Crichton-1/+3
A few catch-all blocks ended up not having this case for constants. Closes #17925
2014-10-11Remove `virtual` structs from the languageJakub Wieczorek-4/+0
2014-10-10Desugar `while let` into `loop { match { ... } }`John Gallagher-1/+2
2014-10-10Teach libsyntax about `while let`John Gallagher-0/+2
2014-10-09syntax: Convert statics to constantsAlex Crichton-5/+5
2014-10-09rustc: Add `const` globals to the languageAlex Crichton-0/+1
This change is an implementation of [RFC 69][rfc] which adds a third kind of global to the language, `const`. This global is most similar to what the old `static` was, and if you're unsure about what to use then you should use a `const`. The semantics of these three kinds of globals are: * A `const` does not represent a memory location, but only a value. Constants are translated as rvalues, which means that their values are directly inlined at usage location (similar to a #define in C/C++). Constant values are, well, constant, and can not be modified. Any "modification" is actually a modification to a local value on the stack rather than the actual constant itself. Almost all values are allowed inside constants, whether they have interior mutability or not. There are a few minor restrictions listed in the RFC, but they should in general not come up too often. * A `static` now always represents a memory location (unconditionally). Any references to the same `static` are actually a reference to the same memory location. Only values whose types ascribe to `Sync` are allowed in a `static`. This restriction is in place because many threads may access a `static` concurrently. Lifting this restriction (and allowing unsafe access) is a future extension not implemented at this time. * A `static mut` continues to always represent a memory location. All references to a `static mut` continue to be `unsafe`. This is a large breaking change, and many programs will need to be updated accordingly. A summary of the breaking changes is: * Statics may no longer be used in patterns. Statics now always represent a memory location, which can sometimes be modified. To fix code, repurpose the matched-on-`static` to a `const`. static FOO: uint = 4; match n { FOO => { /* ... */ } _ => { /* ... */ } } change this code to: const FOO: uint = 4; match n { FOO => { /* ... */ } _ => { /* ... */ } } * Statics may no longer refer to other statics by value. Due to statics being able to change at runtime, allowing them to reference one another could possibly lead to confusing semantics. If you are in this situation, use a constant initializer instead. Note, however, that statics may reference other statics by address, however. * Statics may no longer be used in constant expressions, such as array lengths. This is due to the same restrictions as listed above. Use a `const` instead. [breaking-change] [rfc]: https://github.com/rust-lang/rfcs/pull/246
2014-10-02syntax: ast: remove TyBox and UnBox.Eduard Burtescu-2/+0
2014-09-30Produce a better error for irrefutable `if let` patternsKevin Ballard-1/+7
Modify ast::ExprMatch to include a new value of type ast::MatchSource, making it easy to tell whether the match was written literally or produced via desugaring. This allows us to customize error messages appropriately.
2014-09-30Teach libsyntax about `if let`Kevin Ballard-0/+1
2014-09-28Keep ExpnId abstract by providing conversionsKeegan McAllister-2/+2
2014-09-27Translate inline assembly errors back to source locationsKeegan McAllister-1/+2
Fixes #17552.
2014-09-24Use more descriptive names in dead code messagesJakub Wieczorek-0/+25
2014-09-22librustc: Parse and resolve higher-rank lifetimes in traits.Patrick Walton-0/+2
They will ICE during typechecking if used, because they depend on trait reform. This is part of unboxed closures.
2014-09-19rollup merge of #17318 : nick29581/sliceAlex Crichton-0/+1