summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-09-19rollup merge of #17314 : eddyb/span-no-gcAlex Crichton-123/+133
2014-09-19rollup merge of #17236 : fhahn/issue-16723-multiple-itemsAlex Crichton-20/+15
2014-09-19Allow syntax extensions to return multiple items, closes #16723.Florian Hahn-20/+15
This patch replaces `MacItem` with `MacItems`.
2014-09-19Add enum variants to the type namespaceNick Cameron-27/+28
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-18librustc: Implement the syntax in the RFC for unboxed closure sugar.Patrick Walton-81/+77
Part of issue #16640. I am leaving this issue open to handle parsing of higher-rank lifetimes in traits. This change breaks code that used unboxed closures: * Instead of `F:|&: int| -> int`, write `F:Fn(int) -> int`. * Instead of `F:|&mut: int| -> int`, write `F:FnMut(int) -> int`. * Instead of `F:|: int| -> int`, write `F:FnOnce(int) -> int`. [breaking-change]
2014-09-18libsyntax: Disallow keywords followed by `::`.Patrick Walton-35/+48
This breaks code that looked like: mymacro!(static::foo); ... where `mymacro!` expects a path or expression. Change such macros to not accept keywords followed by `::`. Closes #17298. [breaking-change]
2014-09-19Implement slicing syntax.Nick Cameron-10/+131
`expr[]`, `expr[expr..]`, `expr[..expr]`,`expr[expr..expr]` Uses the Slice and SliceMut traits. Allows ... as well as .. in range patterns.
2014-09-18Fix fallout in tests from removing the use of Gc in ExpnInfo.Eduard Burtescu-10/+10
2014-09-18syntax: use an index in CodeMap instead of Gc for ExpnInfo.Eduard Burtescu-113/+123
2014-09-17librustc: Implement associated types behind a feature gate.Patrick Walton-155/+530
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-17auto merge of #17343 : alexcrichton/rust/rollup, r=alexcrichtonbors-34/+31
2014-09-17Pop the expansion context after expanding a method macroKeegan McAllister-1/+4
We were leaving these on the stack, causing spurious backtraces. I've confirmed that this test fails without the fix.
2014-09-17auto merge of #16836 : P1start/rust/closure_ret_bang, r=alexcrichtonbors-10/+10
Fixes #13490.
2014-09-17rollup merge of #17290 : bkoropoff/issue-17283Alex Crichton-34/+31
2014-09-17doc: Remove "see above".Jonas Hietala-4/+3
2014-09-17doc: Backticks and spelling mistakes.Jonas Hietala-13/+13
2014-09-17doc: Cleanup.Jonas Hietala-149/+123
Remove ~~~ for code block specification. Use /// Over /** */ for doc blocks.
2014-09-17rebasing fixesNick Cameron-6/+4
2014-09-17move feature_gate to libsyntaxNick Cameron-0/+462
2014-09-17move std_inject to libsyntaxNick Cameron-0/+236
2014-09-17move most of front to libsyntaxNick Cameron-0/+889
2014-09-16Propagate restrictions against struct literals to the RHS of assignmentsBrian Koropoff-2/+3
This prevents confusing errors when accidentally using an assignment in an `if` expression. For example: ```rust fn main() { let x = 1u; if x = x { println!("{}", x); } } ``` Previously, this yielded: ``` test.rs:4:16: 4:17 error: expected `:`, found `!` test.rs:4 println!("{}", x); ^ ``` With this change, it now yields: ``` test.rs:3:8: 3:13 error: mismatched types: expected `bool`, found `()` (expected bool, found ()) test.rs:3 if x = x { ^~~~~ ``` Closes issue #17283
2014-09-16Convert restriction enum into bitflagsBrian Koropoff-32/+28
This makes having multiple restrictions at once cleaner. Also drop NO_DOUBLEBAR restriction since it is never used.
2014-09-17auto merge of #17223 : retep998/rust/into_string, r=huonwbors-42/+42
Replaces some usage of `.to_string()` with `.into_string()`
2014-09-16Fallout from renamingAaron Turon-74/+80
2014-09-16auto merge of #17280 : thestinger/rust/heap, r=pcwaltonbors-2/+2
2014-09-15auto merge of #17221 : bkoropoff/rust/strinterner-unsafe, r=sfacklerbors-11/+0
The `StrInterner::clear()` method takes self immutably but can invalidate references returned by `StrInterner::get_ref`. Since `get_ref` is unused, just remove it. Closes #17181
2014-09-15heap: optimize EMPTY to avoid relocationsDaniel Micay-2/+2
Sized deallocation makes it pointless to provide an address that never overlaps with pointers returned by an allocator. Code can branch on the capacity of the allocation instead of a comparison with this sentinel. This improves the situation in #8859, and the remaining issues are only from the logging API, which should be disabled by default in optimized release builds anyway along with debug assertions. The remaining issues are part of #17081. Closes #8859
2014-09-14auto merge of #17163 : pcwalton/rust/impls-next-to-struct, r=alexcrichtonbors-0/+1
type they provide an implementation for. This breaks code like: mod foo { struct Foo { ... } } impl foo::Foo { ... } Change this code to: mod foo { struct Foo { ... } impl Foo { ... } } Closes #17059. RFC #155. [breaking-change] r? @brson
2014-09-14Add help diagnostic messagesP1start-11/+31
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message.
2014-09-14syntax: document the ptr module.Eduard Burtescu-1/+30
2014-09-14syntax: implement in-place folding of P<T> and Vec<T>.Eduard Burtescu-4/+17
2014-09-14syntax: tests: fix fallout from using ptr::P.Eduard Burtescu-16/+16
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-1688/+1529
2014-09-14syntax: ast_map: use borrowed references into the AST.Eduard Burtescu-268/+366
2014-09-14syntax: fold: use move semantics for efficient folding.Eduard Burtescu-722/+691
2014-09-14syntax: ast: replace Gc<T> (previously @T) with P<T>.Eduard Burtescu-77/+76
2014-09-14syntax: add a custom owned smart pointer in ptr::P.Eduard Burtescu-10/+82
2014-09-13librustc: Forbid inherent implementations that aren't adjacent to thePatrick Walton-0/+1
type they provide an implementation for. This breaks code like: mod foo { struct Foo { ... } } impl foo::Foo { ... } Change this code to: mod foo { struct Foo { ... } impl Foo { ... } } Additionally, if you used the I/O path extension methods `stat`, `lstat`, `exists`, `is_file`, or `is_dir`, note that these methods have been moved to the the `std::io::fs::PathExtensions` trait. This breaks code like: fn is_it_there() -> bool { Path::new("/foo/bar/baz").exists() } Change this code to: use std::io::fs::PathExtensions; fn is_it_there() -> bool { Path::new("/foo/bar/baz").exists() } Closes #17059. RFC #155. [breaking-change]
2014-09-13auto merge of #17162 : sfackler/rust/decorator-traits, r=huonwbors-39/+53
The other extension types already worked this way and it can be useful to track some state along with the extension. I also removed the `BasicMacroExpander` and `BasicIdentMacroExpander` since the span inside of them was never used. The expander function types now directly implement the relevant trait.
2014-09-13Improve memory usage of libsyntaxPeter Atashian-42/+42
Replaces some usage of `.to_string()` with `.into_string()` Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-09-12Remove unused, unsound method on StrInternerBrian Koropoff-11/+0
The string slices returned by `get_ref` can actually be invalidated by calling `clear`. Since this method is unused, it is easiest to simply remove it. Closes #17181
2014-09-12auto merge of #17134 : vberger/rust/lint_unused_extern_crate, r=alexcrichtonbors-2/+0
This PR creates a new lint : ``unused_extern_crate``, which do pretty much the same thing as ``unused_import``, but for ``extern crate`` statements. It is related to feature request #10385. I adapted the code tracking used imports so that it tracks extern crates usage as well. This was mainly trial and error and while I believe all cases are covered, there might be some code I added that is useless (long compile times didn't give me the opportunity to check this in detail). Also, I removed some unused ``extern crate`` statements from the libs, that where spotted by this new lint.
2014-09-12Track the visited AST's lifetime throughout Visitor.Eduard Burtescu-147/+130
2014-09-12Remove largely unused context from Visitor.Eduard Burtescu-388/+339
2014-09-12Removing unused extern crates.Victor Berger-2/+0
2014-09-10Remove BasicMacroExpander and BasicIdentMacroExpanderSteven Fackler-29/+10
The spans inside of these types were always None and never used. Pass the expander function directly instead of wrapping it in one of these types. [breaking-change]
2014-09-11auto merge of #16866 : P1start/rust/tuple-indexing, r=brsonbors-1/+89
This allows code to access the fields of tuples and tuple structs behind the feature gate `tuple_indexing`: ```rust #![feature(tuple_indexing)] 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); ``` Implements [RFC 53](https://github.com/rust-lang/rfcs/blob/master/active/0053-tuple-accessors.md). Closes #16950.
2014-09-10Change ItemModifier and ItemDecorator to traitsSteven Fackler-12/+45
For convenience, the traits are implemented for the respective bare functions. Change code from this: ```rust ItemDecorator(some_function) // or ItemModifier(some_other_function) ``` to ```rust ItemDecorator(box some_function) // or ItemModifier(box some_other_function) ``` [breaking-change]
2014-09-09librustc: Obsolete the old external crate renaming syntax.Patrick Walton-5/+6
Instead of `extern crate foo = bar`, write `extern crate bar as foo`. Instead of `extern crate baz = "quux"`, write `extern crate "quux" as baz`. Closes #16461. [breaking-change]