summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
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-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]
2014-09-09auto merge of #16662 : pczarn/rust/format-fmtstr-opt, r=brsonbors-51/+99
Based on an observation that strings and arguments are always interleaved, thanks to #15832. Additionally optimize invocations where formatting parameters are unspecified for all arguments, e.g. `"{} {:?} {:x}"`, by emptying the `__STATIC_FMTARGS` array. Next, `Arguments::new` replaces an empty slice with `None` so that passing empty `__STATIC_FMTARGS` generates slightly less machine code when `Arguments::new` is inlined. Furthermore, formatting itself treats these cases separately without making redundant copies of formatting parameters. All in all, this adds a single mov instruction per `write!` in most cases. That's why code size has increased.
2014-09-10Implement tuple and tuple struct indexingP1start-1/+89
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-09-09Optimize for the most common cases of `format!`Piotr Czarnecki-49/+73
Format specs are ignored and not stored in case they're all default. Restore default formatting parameters during iteration. Pass `None` instead of empty slices of format specs to take advantage of non-nullable pointer optimization. Generate a call to one of two functions of `fmt::Argument`.
2014-09-09Decouple string and argument piecesPiotr Czarnecki-30/+54
2014-09-09rollup merge of #17054 : pcwalton/subslice-syntaxAlex Crichton-32/+43
2014-09-08librustc: Change the syntax of subslice matching to use postfix `..`Patrick Walton-32/+43
instead of prefix `..`. This breaks code that looked like: match foo { [ first, ..middle, last ] => { ... } } Change this code to: match foo { [ first, middle.., last ] => { ... } } RFC #55. Closes #16967. [breaking-change]
2014-09-08quote: Explicitly borrow the ExtCtxtKeegan McAllister-1/+3
Fixes #16992.
2014-09-07Fix deprecate warning "extern crate ... as ..."Sebastien Martini-1/+1
Its arguments were inverted.
2014-09-07auto merge of #17032 : jamesluke/rust/master, r=alexcrichtonbors-1/+1
"extern create" -> "extern crate"
2014-09-06fix sized deallocation for OwnedSliceDaniel Micay-1/+4
2014-09-05Fix documentation typo.jamesluke-1/+1
2014-09-05make separate compilation respect #[inline] attributesStuart Pernsteiner-1/+9
Adjust the handling of `#[inline]` items so that they get translated into every compilation unit that uses them. This is necessary to preserve the semantics of `#[inline(always)]`. Crate-local `#[inline]` functions and statics are blindly translated into every compilation unit. Cross-crate inlined items and monomorphizations of `#[inline]` functions are translated the first time a reference is seen in each compilation unit. When using multiple compilation units, inlined items are given `available_externally` linkage whenever possible to avoid duplicating object code.
2014-09-05auto merge of #16990 : DiamondLovesYou/rust/level-derive-clone, r=alexcrichtonbors-1/+1
2014-09-04Auto-derive Clone for syntax::diagnostic::Level.Richard Diamond-1/+1
2014-09-04auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, ↵bors-5/+5
r=alexcrichton I corrected spelling and capitalization errors in comments and strings.
2014-09-04auto merge of #16923 : wickerwaka/rust/crate-as-fixup, r=alexcrichtonbors-3/+8
Changed occurances of: extern crate foo = "bar"; to: extern crate "bar" as foo; Added warning for old deprecated syntax
2014-09-04Center alignment for fmtwickerwaka-0/+3
Use '^' to specify center alignment in format strings. fmt!( "[{:^5s}]", "Hi" ) -> "[ Hi ]" fmt!( "[{:^5s}]", "H" ) -> "[ H ]" fmt!( "[{:^5d}]", 1i ) -> "[ 1 ]" fmt!( "[{:^5d}]", -1i ) -> "[ -1 ]" fmt!( "[{:^6d}]", 1i ) -> "[ 1 ]" fmt!( "[{:^6d}]", -1i ) -> "[ -1 ]" If the padding is odd then the padding on the right will be one character longer than the padding on the left. Tuples squashed
2014-09-04auto merge of #16883 : jakub-/rust/issue-16648, r=pcwaltonbors-1/+1
They were only correct in the simplest case. Some of the optimisations are certainly possible but should be introduced carefully and only when the whole pattern codegen infrastructure is in a better shape. Fixes #16648.
2014-09-03Fix spelling errors and capitalization.Joseph Crail-5/+5
2014-09-03Remove cross-borrowing for traits.Nick Cameron-3/+3
Closes #15349 [breaking-change] Trait objects are no longer implicitly coerced from Box<T> to &T. You must make an explicit coercion using `&*`.
2014-09-01auto merge of #16891 : eddyb/rust/patlit-from-expr-macros, r=kballardbors-0/+10
Enables any macros using `MacExpr` to be treated as patterns when they produce a literal in the form `ExprLit` (e.g. `stringify!` or `line!`). Fixes #16876.
2014-09-01Updated to new extern crate syntax.wickerwaka-3/+8
Added warning for old deprecated syntax
2014-08-31auto merge of #16809 : nick29581/rust/dst-bug-3, r=alexcrichtonbors-13/+6
This corrects a rebasing error. Also adds a test so it won't happen again. r?
2014-08-31auto merge of #16788 : Manishearth/rust/raw-ptr-syntax-ty, r=huonwbors-1/+16
@huonw , r? :) #16781
2014-08-30rollup merge of #16839 : treeman/issue-15358Alex Crichton-1/+1
2014-08-31Allow ExprLit expression macros to be used in patterns.Eduard Burtescu-0/+10
2014-08-30auto merge of #16859 : alexcrichton/rust/snapshots, r=huonwbors-26/+0
2014-08-30Remove the branch merging optimisations for slice patternsJakub Wieczorek-1/+1
They were only correct in the simplest case. Some of the optimisations are certainly possible but should be introduced carefully and only when the whole pattern codegen infrastructure is in a better shape. Fixes #16648.
2014-08-30auto merge of #16419 : huonw/rust/pretty-expanded-hygiene, r=pnkfelixbors-3/+7
Different Identifiers and Names can have identical textual representations, but different internal representations, due to the macro hygiene machinery (syntax contexts and gensyms). This provides a way to see these internals by compiling with `--pretty expanded,hygiene`. This is useful for debugging & hacking on macros (e.g. diagnosing https://github.com/rust-lang/rust/issues/15750/https://github.com/rust-lang/rust/issues/15962 likely would've been faster with this functionality). E.g. ```rust #![feature(macro_rules)] // minimal junk #![no_std] macro_rules! foo { ($x: ident) => { y + $x } } fn bar() { foo!(x) } ``` ```rust #![feature(macro_rules)] // minimal junk #![no_std] fn bar /* 61#0 */() { y /* 60#2 */ + x /* 58#3 */ } ```