summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-11-20Fix an ICE on diagnostics originating in external macrosJakub Bukaj-33/+45
2014-11-20auto merge of #19071 : huonw/rust/col2column, r=nikomatsakisbors-5/+5
This macro is very rarely used, so there is no need (and it is better) for it to avoid the abbreviation. Closes rust-lang/rfcs#467.
2014-11-20auto merge of #19113 : nikomatsakis/rust/unboxed-boxed-closure-unification, ↵bors-88/+27
r=acrichto Use the expected type to infer the argument/return types of unboxed closures. Also, in `||` expressions, use the expected type to decide if the result should be a boxed or unboxed closure (and if an unboxed closure, what kind). This supercedes PR #19089, which was already reviewed by @pcwalton.
2014-11-20Rename `col!` to `column!`.Huon Wilson-5/+5
This macro is very rarely used, so there is no need (and it is better) for it to avoid the abbreviation. Closes rust-lang/rfcs#467. [breaking-change]
2014-11-20fixed markdown rendering a H1 in commentDavis Silverman-2/+2
2014-11-20removed usage of struct_variant feature as it is no longer gatedSimon Wollwage-1/+1
2014-11-19Fixes to the roll-upJakub Bukaj-1/+1
2014-11-19rollup merge of #19103: huonw/literal-suffixesJakub Bukaj-250/+329
Futureproof Rust for fancier suffixed literals. The Rust compiler tokenises a literal followed immediately (no whitespace) by an identifier as a single token: (for example) the text sequences `"foo"bar`, `1baz` and `1u1024` are now a single token rather than the pairs `"foo"` `bar`, `1` `baz` and `1u` `1024` respectively. The compiler rejects all such suffixes in the parser, except for the 12 numeric suffixes we have now. I'm fairly sure this will affect very few programs, since it's not currently legal to have `<literal><identifier>` in a Rust program, except in a macro invocation. Any macro invocation relying on this behaviour can simply separate the two tokens with whitespace: `foo!("bar"baz)` becomes `foo!("bar" baz)`. This implements [RFC 463](https://github.com/rust-lang/rfcs/blob/master/text/0463-future-proof-literal-suffixes.md), and so closes https://github.com/rust-lang/rust/issues/19088.
2014-11-19rollup merge of #19090: kmcallister/deriving-non-typeJakub Bukaj-2/+5
Besides being more helpful, this gives us the flexibility to later define a meaning for something like ```rust #[deriving(...)] mod bar { ... } ```
2014-11-19rollup merge of #19073: jakub-/issue-19069Jakub Bukaj-11/+23
Fixes #19069. These were never intended not to be feature-gated but this PR is nonetheless a... [breaking-change]
2014-11-19rollup merge of #19040: alexcrichton/issue-18904Jakub Bukaj-26/+5
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc]. There are a number of breaking changes as a part of this commit which will need to be handled to migrated old code: * A number of formatting traits have been removed: String, Bool, Char, Unsigned, Signed, and Float. It is recommended to instead use Show wherever possible or to use adaptor structs to implement other methods of formatting. * The format specifier for Boolean has changed from `t` to `b`. * The enum `FormatError` has been renamed to `Error` as well as becoming a unit struct instead of an enum. The `WriteError` variant no longer exists. * The `format_args_method!` macro has been removed with no replacement. Alter code to use the `format_args!` macro instead. * The public fields of a `Formatter` have become read-only with no replacement. Use a new formatting string to alter the formatting flags in combination with the `write!` macro. The fields can be accessed through accessor methods on the `Formatter` structure. Other than these breaking changes, the contents of std::fmt should now also all contain stability markers. Most of them are still #[unstable] or #[experimental] [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md [breaking-change] Closes #18904
2014-11-19Merge the ExprFnBlock and ExprUnboxedClosure into one ExprClosure with an ↵Niko Matsakis-88/+27
optional unboxed closure kind.
2014-11-20Switch numeric suffix parsing to use the new system.Huon Wilson-145/+99
This moves errors and all handling of numeric suffixes into the parser rather than the lexer.
2014-11-20Parse and store suffixes on literals.Huon Wilson-90/+221
This adds an optional suffix at the end of a literal token: `"foo"bar`. An actual use of a suffix in a expression (or other literal that the compiler reads) is rejected in the parser. This doesn't switch the handling of numbers to this system, and doesn't outlaw illegal suffixes for them yet.
2014-11-19Refactor QPath to take an ast::TraitRefNiko Matsakis-18/+28
2014-11-18std: Stabilize std::fmtAlex Crichton-26/+5
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc]. There are a number of breaking changes as a part of this commit which will need to be handled to migrated old code: * A number of formatting traits have been removed: String, Bool, Char, Unsigned, Signed, and Float. It is recommended to instead use Show wherever possible or to use adaptor structs to implement other methods of formatting. * The format specifier for Boolean has changed from `t` to `b`. * The enum `FormatError` has been renamed to `Error` as well as becoming a unit struct instead of an enum. The `WriteError` variant no longer exists. * The `format_args_method!` macro has been removed with no replacement. Alter code to use the `format_args!` macro instead. * The public fields of a `Formatter` have become read-only with no replacement. Use a new formatting string to alter the formatting flags in combination with the `write!` macro. The fields can be accessed through accessor methods on the `Formatter` structure. Other than these breaking changes, the contents of std::fmt should now also all contain stability markers. Most of them are still #[unstable] or #[experimental] [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md [breaking-change] Closes #18904
2014-11-19Switch to an independent enum for `Lit*` subtokens.Huon Wilson-91/+85
2014-11-18auto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichtonbors-1/+41
Allows parsing view items (`use` and `extern crate`) individually. Does not change behavior of any existing functions. Closes #19024
2014-11-18deriving: error out when used on a non-typeKeegan McAllister-2/+5
Besides being more helpful, this gives us the flexibility to later define a meaning for something like #[deriving(...)] mod bar { ... }
2014-11-18Feature gate non-ASCII lifetime identifiersJakub Bukaj-11/+23
Fixes #19069.
2014-11-18Update test for equivalency to include region binders in object types, add ↵Niko Matsakis-4/+3
new tests relating to HRTB, consolidate the `unboxed_closures` and `overloaded_calls` feature gates.
2014-11-18Convert TyPolyTraitRef to accept arbitary bounds, so that things likeNiko Matsakis-56/+97
`Box<for<'a> Foo<&'a T> + 'a>` can be accepted. Also cleanup the visitor/fold in general, exposing more callbacks.
2014-11-18Place parenthetical notation under the `unboxed_closure` feature-gate.Niko Matsakis-2/+14
Consolidate the `unboxed_closure_sugar` and `unboxed_closure` feature gates.
2014-11-18auto merge of #18885 : thestinger/rust/writer, r=aturonbors-5/+5
The trait has an obvious, sensible implementation directly on vectors so the MemWriter wrapper is unnecessary. This will halt the trend towards providing all of the vector methods on MemWriter along with eliminating the noise caused by conversions between the two types. It also provides the useful default Writer methods on Vec<u8>. After the type is removed and code has been migrated, it would make sense to add a new implementation of MemWriter with seeking support. The simple use cases can be covered with vectors alone, and ones with the need for seeks can use a new MemWriter implementation.
2014-11-18implement Writer for Vec<u8>Daniel Micay-5/+5
The trait has an obvious, sensible implementation directly on vectors so the MemWriter wrapper is unnecessary. This will halt the trend towards providing all of the vector methods on MemWriter along with eliminating the noise caused by conversions between the two types. It also provides the useful default Writer methods on Vec<u8>. After the type is removed and code has been migrated, it would make sense to add a new implementation of MemWriter with seeking support. The simple use cases can be covered with vectors alone, and ones with the need for seeks can use a new MemWriter implementation.
2014-11-18auto merge of #19050 : japaric/rust/moar-dst, r=aturonbors-9/+9
r? @aturon cc #16918
2014-11-17libsyntax: Add tests for `parse_view_item`Murarth-1/+33
2014-11-17libsyntax: Add `parse_view_item` method to ParserMurarth-0/+8
2014-11-18auto merge of #19049 : jakub-/rust/roll-up, r=alexcrichtonbors-15/+36
r? @alexcrichton
2014-11-18rollup merge of #19020: Gankro/better-warnJakub Bukaj-1/+2
Came up on IRC that this was a bit unhelpful as to what should actually be *done*. I am new to changing compiler messages, please let me know if there's anything else that needs to be done to accomadate this change. (My build system is still constantly crashing [Is bors contagious?], so this hasn't been formally `check`ed. I figure it's a simple enough change that any consequences [like compile-fail expected messages?] can be eyeballed by someone more experienced.)
2014-11-18rollup merge of #19018: tomjakubowski/fix-issue-19003Jakub Bukaj-1/+9
Make struct variant syntax more consistent with struct syntax and fix an assert in middle::typeck. Fix #19003
2014-11-18rollup merge of #18911: canndrew/slice_shift_charJakub Bukaj-3/+3
`slice_shift_char` splits a `str` into it's leading `char` and the remainder of the `str`. Currently, it returns a `(Option<char>, &str)` such that: "bar".slice_shift_char() => (Some('b'), "ar") "ar".slice_shift_char() => (Some('a'), "r") "r".slice_shift_char() => (Some('r'), "") "".slice_shift_char() => (None, "") This is a little odd. Either a `str` can be split into both a head and a tail or it cannot. So the return type should be `Option<(char, &str)>`. With the current behaviour, in the case of the empty string, the `str` returned is meaningless - it is always the empty string. This PR changes `slice_shift_char` so that: "bar".slice_shift_char() => Some(('b', "ar")) "ar".slice_shift_char() => Some(('a', "r")) "r".slice_shift_char() => Some(('r', "")) "".slice_shift_char() => None
2014-11-18rollup merge of #18910: aturon/borrow-traitsJakub Bukaj-10/+18
Following [the collections reform RFC](https://github.com/rust-lang/rfcs/pull/235), this PR: * Adds a new `borrow` module to libcore. The module contains traits for borrowing data (`BorrowFrom` and `BorrowFromMut`), generalized cloning (`ToOwned`), and a clone-on-write smartpointer (`Cow`). * Deprecates the `_equiv` family of methods on `HashMap` and `HashSet` by instead generalizing the "normal" methods like `get` and `remove` to use the new `std::borrow` infrastructure. * Generalizes `TreeMap`, `TreeSet`, `BTreeMap` and `BTreeSet` to use the new `std::borrow` infrastructure for lookups. [breaking-change]
2014-11-18rollup merge of #18890: luqmana/tfJakub Bukaj-0/+4
This is especially useful for declaring a static with external linkage in an executable. There isn't any way to do that currently since we mark everything in an executable as internal by default. Also, a quick fix to have the no-compiler-rt target option respected when building staticlibs as well.
2014-11-17libsyntax: DSTify `ToSource` and `ToSourceWithHygiene`Jorge Aparicio-9/+9
2014-11-17Fallout from deprecationAaron Turon-10/+18
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-11-17Rewrite method resolution to be cleaner, more correct, and to layNiko Matsakis-1/+1
groundwork for better performance. Key points: - Separate out determining which method to use from actually selecting a method (this should enable caching, as well as the pcwalton fast-reject strategy). - Merge the impl selection back into method resolution and don't rely on trait matching (this should perform better but also is needed to resolve some kind of conflicts, see e.g. `method-two-traits-distinguished-via-where-clause.rs`) - Purge a lot of out-of-date junk and coercions from method lookups.
2014-11-17Switch to purely namespaced enumsSteven Fackler-53/+180
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17auto merge of #19027 : nick29581/rust/coercions-4, r=alexcrichtonbors-7/+7
The forwards compatible parts of #18645, rebased. Converts implicit coercions from `[T, ..n]` to `&[T]` into explicit references.
2014-11-17Fix fallout from coercion removalNick Cameron-7/+7
2014-11-17change return type of slice_shift_charAndrew Cann-3/+3
`slice_shift_char` splits a `str` into it's leading `char` and the remainder of the `str`. Currently, it returns a `(Option<char>, &str)` such that: "bar".slice_shift_char() => (Some('b'), "ar") "ar".slice_shift_char() => (Some('a'), "r") "r".slice_shift_char() => (Some('r'), "") "".slice_shift_char() => (None, "") This is a little odd. Either a `str` can be split into both a head and a tail or it cannot. So the return type should be `Option<(char, &str)>`. With the current behaviour, in the case of the empty string, the `str` returned is meaningless - it is always the empty string. This commit changes slice_shift_char so that: "bar".slice_shift_char() => Some(('b', "ar")) "ar".slice_shift_char() => Some(('a', "r")) "r".slice_shift_char() => Some(('r', "")) "".slice_shift_char() => None [breaking-change]
2014-11-17auto merge of #18914 : Gankro/rust/cloned, r=aturonbors-1/+1
Part of #18424. r? @aturon [breaking-change]
2014-11-17slightly better deprecation message for fn syntaxAlexis Beingessner-1/+2
2014-11-16Disallow parsing of struct variants with 0 fieldsTom Jakubowski-1/+9
Make struct variant syntax more consistent with struct syntax and fix an assert in middle::typeck. Fix #19003
2014-11-16auto merge of #18994 : sfackler/rust/struct-variants-pt2, r=jakub-bors-20/+11
Struct variant field visibility is now inherited. Remove `pub` keywords from declarations. Closes #18641 [breaking-change] r? @alexcrichton
2014-11-16fallout from deprecating find_copy and get_copyAlexis Beingessner-1/+1
2014-11-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-218/+184
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-16rollup merge of #18948: barosl/doc-encodable-fixJakub Bukaj-31/+40
2014-11-15Un-feature gate struct variantsSteven Fackler-20/+11
Struct variant field visibility is now inherited. Remove `pub` keywords from declarations. Closes #18641 [breaking-change]
2014-11-15auto merge of #18922 : japaric/rust/for, r=jakub-bors-2/+2
r? @alexcrichton