about summary refs log tree commit diff
path: root/src/libsyntax/ast_util.rs
AgeCommit message (Collapse)AuthorLines
2014-11-26/*! -> //!Steve Klabnik-5/+1
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-26Rote changes due to the fact that ast paths no longer carry this extraneous ↵Niko Matsakis-1/+1
bounds.
2014-11-18Feature gate non-ASCII lifetime identifiersJakub Bukaj-1/+1
Fixes #19069.
2014-11-18Convert TyPolyTraitRef to accept arbitary bounds, so that things likeNiko Matsakis-4/+4
`Box<for<'a> Foo<&'a T> + 'a>` can be accepted. Also cleanup the visitor/fold in general, exposing more callbacks.
2014-11-06Support parenthesized paths `Foo(A,B) -> C` that expand to `Foo<(A,B),C>`. ↵Niko Matsakis-9/+9
These paths also bind anonymous regions (or will, once HRTB is fully working). Fixes #18423.
2014-11-03rollup merge of #18506 : nikomatsakis/assoc-type-boundsAlex Crichton-1/+1
2014-11-03Restructure AST so that the associated type definition carriesNiko Matsakis-1/+1
bounds like any other "type parameter".
2014-11-03Clean-up transmutes in librustcAriel Ben-Yehuda-18/+15
None of them would break by implementation-defined struct layout, but one would break with strict lifetime aliasing, and the rest are just ugly code.
2014-10-30rollup merge of #18398 : aturon/lint-conventions-2Alex Crichton-1/+1
Conflicts: src/libcollections/slice.rs src/libcore/failure.rs src/libsyntax/parse/token.rs src/test/debuginfo/basic-types-mut-globals.rs src/test/debuginfo/simple-struct.rs src/test/debuginfo/trait-pointers.rs
2014-10-29Rename fail! to panic!Steve Klabnik-5/+5
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-28Update code with new lint namesAaron Turon-1/+1
2014-10-24Add a lint for not using field pattern shorthandsP1start-1/+1
Closes #17792.
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-1/+1
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-16libsyntax: Remove all uses of {:?}.Luqman Aden-1/+1
2014-10-09rustc: Add `const` globals to the languageAlex Crichton-14/+0
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-03Set the `non_uppercase_statics` lint to warn by defaultP1start-0/+1
2014-10-02syntax: ast: remove TyBox and UnBox.Eduard Burtescu-1/+0
2014-09-17librustc: Implement associated types behind a feature gate.Patrick Walton-0/+57
The implementation essentially desugars during type collection and AST type conversion time into the parameter scheme we have now. Only fully qualified names--e.g. `<T as Foo>::Bar`--are supported.
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-101/+15
2014-09-14syntax: ast_map: use borrowed references into the AST.Eduard Burtescu-0/+8
2014-09-12Track the visited AST's lifetime throughout Visitor.Eduard Burtescu-9/+9
2014-09-12Remove largely unused context from Visitor.Eduard Burtescu-40/+36
2014-08-29Register new snapshotsAlex Crichton-8/+0
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-0/+8
2014-08-18Forbid extern statics from appearing in patternsJakub Wieczorek-15/+0
Fixes #16149.
2014-08-14librustc: Implement simple `where` clauses.Patrick Walton-2/+8
These `where` clauses are accepted everywhere generics are currently accepted and desugar during type collection to the type parameter bounds we have today. A new keyword, `where`, has been added. Therefore, this is a breaking change. Change uses of `where` to other identifiers. [breaking-change]
2014-08-14librustc: Stop assuming that implementations and traits only containPatrick Walton-37/+38
methods. This paves the way to associated items by introducing an extra level of abstraction ("impl-or-trait item") between traits/implementations and methods. This new abstraction is encoded in the metadata and used throughout the compiler where appropriate. There are no functional changes; this is purely a refactoring.
2014-08-07Temporary bootstrapping hack: introduce syntax for r egion bounds like `'b:'a`,Niko Matsakis-1/+1
meaning `'b outlives 'a`. Syntax currently does nothing but is needed for full fix to #5763. To use this syntax, the issue_5763_bootstrap feature guard is required.
2014-08-06AST refactoring: merge PatWild and PatWildMulti into one variant with a flag.Felix S. Klock II-1/+1
2014-07-20Implement new mod import sugarJakub Wieczorek-1/+1
Implements RFC #168.
2014-07-19Register new snapshotsAlex Crichton-64/+9
2014-07-18librustc: Implement unboxed closures with mutable receiversPatrick Walton-8/+21
2014-07-15use trait rather than fnsJohn Clements-21/+81
please note the snapshot-waiting unpleasantness. I'm unable to use the traditional #[cfg(stage0)] mechanism to swap the new style in for later compiler stages, because macros invocations in method positions cause the parser to choke before cfg can strip it out. Parenthetical note: this problem wouldn't arise with an interleaved parsing/expansion....
2014-07-13refactor Method definition to make space for macrosJohn Clements-20/+55
This change propagates to many locations, but because of the Macro Exterminator (or, more properly, the invariant that it protects), macro invocations can't occur downstream of expansion. This means that in librustc and librustdoc, extracting the desired field can simply assume that it can't be a macro invocation. Functions in ast_util abstract over this check.
2014-07-09libsyntax: Remove uses of advance.Luqman Aden-5/+5
2014-07-09Fix all the test falloutCorey Richardson-4/+4
2014-07-09syntax: doc comments all the thingsCorey Richardson-7/+7
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-7/+7
[breaking-change]
2014-07-03Simplify PatIdent to contain an Ident rather than a PathJohn Clements-7/+3
Rationale: for what appear to be historical reasons only, the PatIdent contains a Path rather than an Ident. This means that there are many places in the code where an ident is artificially promoted to a path, and---much more problematically--- a bunch of elements from a path are simply thrown away, which seems like an invitation to some really nasty bugs. This commit replaces the Path in a PatIdent with a SpannedIdent, which just contains an ident and a span.
2014-06-26Remove unnecessary to_string callsPiotr Jawniak-3/+3
This commit removes superfluous to_string calls from various places
2014-06-25auto merge of #15160 : alexcrichton/rust/remove-f128, r=brsonbors-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-15/+4
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-24Remove the quad_precision_float feature gateAlex Crichton-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-17librustc: Make addresses of immutable statics insignificant unlessPatrick Walton-0/+13
`#[inline(never)]` is used. Closes #8958. This can break some code that relied on the addresses of statics being distinct; add `#[inline(never)]` to the affected statics. [breaking-change]
2014-06-14rustc: Obsolete the `@` syntax entirelyAlex Crichton-1/+1
This removes all remnants of `@` pointers from rustc. Additionally, this removes the `GC` structure from the prelude as it seems odd exporting an experimental type in the prelude by default. Closes #14193 [breaking-change]
2014-06-13libsyntax: Allow `+` to separate trait bounds from objects.Patrick Walton-0/+1
RFC #27. After a snapshot, the old syntax will be removed. This can break some code that looked like `foo as &Trait:Send`. Now you will need to write `foo as (&Trait+Send)`. Closes #12778. [breaking-change]
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-21/+21
2014-06-06Move Def out of syntax crate, where it does not belongNiko Matsakis-27/+0
2014-05-29auto merge of #14483 : ahmedcharles/rust/patbox, r=alexcrichtonbors-1/+1
2014-05-28Add AST node for pattern macrosKeegan McAllister-0/+1