about summary refs log tree commit diff
path: root/src/libsyntax/visit.rs
AgeCommit message (Collapse)AuthorLines
2014-10-02syntax: ast: remove TyBox and UnBox.Eduard Burtescu-1/+1
2014-09-30Teach libsyntax about `if let`Kevin Ballard-1/+7
2014-09-22librustc: Parse and resolve higher-rank lifetimes in traits.Patrick Walton-1/+4
They will ICE during typechecking if used, because they depend on trait reform. This is part of unboxed closures.
2014-09-19Implement slicing syntax.Nick Cameron-0/+5
`expr[]`, `expr[expr..]`, `expr[..expr]`,`expr[expr..expr]` Uses the Slice and SliceMut traits. Allows ... as well as .. in range patterns.
2014-09-17librustc: Implement associated types behind a feature gate.Patrick Walton-5/+22
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-14/+5
2014-09-12Track the visited AST's lifetime throughout Visitor.Eduard Burtescu-134/+117
2014-09-12Remove largely unused context from Visitor.Eduard Burtescu-325/+281
2014-09-10Implement tuple and tuple struct indexingP1start-0/+6
This allows code to access the fields of tuples and tuple structs: let x = (1i, 2i); assert_eq!(x.1, 2); struct Point(int, int); let origin = Point(0, 0); assert_eq!(origin.0, 0); assert_eq!(origin.1, 0);
2014-08-29Fix formatting, update copyright datesPythoner6-1/+1
2014-08-29Add support for labeled while loops.Pythoner6-1/+1
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-22/+16
2014-08-26DST coercions and DST structsNick Cameron-3/+0
[breaking-change] 1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code. 2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible. 3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
2014-08-19Fix double evaluation of read+write operandsPiotr Czarnecki-3/+3
Stop read+write expressions from expanding into two occurences in the AST. Add a bool to indicate whether an operand in output position if read+write or not. Fixes #14936
2014-08-14librustc: Implement simple `where` clauses.Patrick Walton-7/+7
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-10/+23
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-14librustc: Tie up loose ends in unboxed closures.Patrick Walton-1/+1
This patch primarily does two things: (1) it prevents lifetimes from leaking out of unboxed closures; (2) it allows unboxed closure type notation, call notation, and construction notation to construct closures matching any of the three traits. This breaks code that looked like: let mut f; { let x = &5i; f = |&mut:| *x + 10; } Change this code to avoid having a reference escape. For example: { let x = &5i; let mut f; // <-- move here to avoid dangling reference f = |&mut:| *x + 10; } I believe this is enough to consider unboxed closures essentially implemented. Further issues (for example, higher-rank lifetimes) should be filed as followups. Closes #14449. [breaking-change]
2014-08-13librustc: Parse, but do not fully turn on, the `ref` keyword forPatrick Walton-2/+2
by-reference upvars. This partially implements RFC 38. A snapshot will be needed to turn this on, because stage0 cannot yet parse the keyword. Part of #12381.
2014-08-07Temporary bootstrapping hack: introduce syntax for r egion bounds like `'b:'a`,Niko Matsakis-2/+2
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-24libsyntax: Remove `~self` and `mut ~self` from the language.Patrick Walton-1/+1
This eliminates the last vestige of the `~` syntax. Instead of `~self`, write `self: Box<TypeOfSelf>`; instead of `mut ~self`, write `mut self: Box<TypeOfSelf>`, replacing `TypeOfSelf` with the self-type parameter as specified in the implementation. Closes #13885. [breaking-change]
2014-07-20Implement new mod import sugarJakub Wieczorek-1/+6
Implements RFC #168.
2014-07-18librustc: Implement unboxed closures with mutable receiversPatrick Walton-2/+10
2014-07-17librustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,Patrick Walton-3/+3
except where trait objects are involved. Part of issue #15349, though I'm leaving it open for trait objects. Cross borrowing for trait objects remains because it is needed until we have DST. This will break code like: fn foo(x: &int) { ... } let a = box 3i; foo(a); Change this code to: fn foo(x: &int) { ... } let a = box 3i; foo(&*a); [breaking-change]
2014-07-16librustc: Implement the fully-expanded, UFCS form of explicit self.Patrick Walton-0/+1
This makes two changes to region inference: (1) it allows region inference to relate early-bound regions; and (2) it allows regions to be related before variance runs. The former is needed because there is no relation between the two regions before region substitution happens, while the latter is needed because type collection has to run before variance. We assume that, before variance is inferred, that lifetimes are invariant. This is a conservative overapproximation. This relates to #13885. This does not remove `~self` from the language yet, however. [breaking-change]
2014-07-13refactor Method definition to make space for macrosJohn Clements-11/+21
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-11make walk/visit_mac opt-in onlyJohn Clements-2/+11
macros can expand into arbitrary items, exprs, etc. This means that using a default walker or folder on an AST before macro expansion is complete will miss things (the things that the macros expand into). As a partial fence against this, this commit moves the default traversal of macros into a separate procedure, and makes the default trait implementation signal an error. This means that Folders and Visitors can traverse macros if they want to, but they need to explicitly add an impl that calls the walk_mac or fold_mac procedure This should prevent problems down the road.
2014-07-09syntax: doc comments all the thingsCorey Richardson-16/+16
2014-07-08carry self ident forward through re-parsingJohn Clements-2/+2
formerly, the self identifier was being discarded during parsing, which stymies hygiene. The best fix here seems to be to attach a self identifier to ExplicitSelf_, a change that rippled through the rest of the compiler, but without any obvious damage.
2014-07-03Simplify PatIdent to contain an Ident rather than a PathJohn Clements-2/+2
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-13libsyntax: Allow `+` to separate trait bounds from objects.Patrick Walton-1/+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-11rustc: Move the AST from @T to Gc<T>Alex Crichton-14/+14
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-138/+140
2014-06-10Fix more misspelled comments and strings.Joseph Crail-1/+1
2014-06-09librustc: Implement sugar for the `FnMut` traitPatrick Walton-0/+13
2014-06-07Add visit_attribute to Visitor, use it for unused_attributeSteven Fackler-16/+46
The lint was missing a *lot* of cases previously.
2014-05-29auto merge of #14483 : ahmedcharles/rust/patbox, r=alexcrichtonbors-1/+1
2014-05-28Add AST node for pattern macrosKeegan McAllister-0/+1
2014-05-27Rename PatUniq to PatBox. Fixes part of #13910.Ahmed Charles-1/+1
2014-05-15syntax::visit: pub `walk_explicit_self` so impls can call it as defaults do.Felix S. Klock II-3/+13
drive-by: added some doc.
2014-05-14Removed unnecessary arguments for walk_* functionsMichael Darakananda-8/+4
2014-05-03Temporary patch to accept arbitrary lifetimes (behind feature gate) in bound ↵Niko Matsakis-1/+2
lists. This is needed to bootstrap fix for #5723.
2014-04-26syntax: ViewItemUse no longer contains multiple view paths.Kang Seonghoon-15/+13
it reflected the obsolete syntax `use a, b, c;` and did not make past the parser (though it was a non-fatal error so we can continue). this legacy affected many portions of rustc and rustdoc as well, so this commit cleans them up altogether.
2014-04-23Support unsized types with the `type` keywordNick Cameron-1/+1
2014-04-20Allow inheritance between structs.Nick Cameron-0/+4
No subtyping, no interaction with traits. Partially addresses #9912.
2014-04-11syntax: remove ast::Sigil.Eduard Burtescu-2/+13
2014-04-10Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and ↵Kasey Carrothers-3/+3
updated associated variable and function names.
2014-04-04syntax: remove obsolete mutability from ExprVec and ExprRepeat.Eduard Burtescu-2/+2
2014-04-03syntax: Remove AbiSet, use one AbiAlex Crichton-2/+2
This change removes the AbiSet from the AST, converting all usage to have just one Abi value. The current scheme selects a relevant ABI given a list of ABIs based on the target architecture and how relevant each ABI is to that architecture. Instead of this mildly complicated scheme, only one ABI will be allowed in abi strings, and pseudo-abis will be created for special cases as necessary. For example the "system" abi exists for stdcall on win32 and C on win64. Closes #10049
2014-03-22Migrate all users of opt_vec to owned_slice, delete opt_vec.Huon Wilson-4/+3
syntax::opt_vec is now entirely unused, and so can go.