about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/generic
AgeCommit message (Collapse)AuthorLines
2014-12-20Add parser support for generalized where clausesJared Roesch-2/+8
Implement support in the parser for generalized where clauses, as well as the conversion of ast::WherePredicates to ty::Predicate in `collect.rs`.
2014-12-17rollup merge of #19831: luqmana/deriving-whereAlex Crichton-5/+25
Fixes #19358.
2014-12-14Parse `unsafe impl` but don't do anything particularly interesting with the ↵Niko Matsakis-1/+2
results.
2014-12-14Rename FnStyle trait to Unsafety.Niko Matsakis-1/+1
2014-12-14libsyntax: Make deriving also respect where bounds.Luqman Aden-5/+25
2014-12-13libsyntax: use unboxed closuresJorge Aparicio-27/+35
2014-12-12Add support for equality constraints on associated typesNick Cameron-3/+3
2014-11-26rollup merge of #19329: steveklabnik/doc_style_cleanup2Alex Crichton-4/+2
2014-11-26/*! -> //!Steve Klabnik-4/+2
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-3/+3
bounds.
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-18std: Stabilize std::fmtAlex Crichton-1/+1
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-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-17Switch to purely namespaced enumsSteven Fackler-24/+26
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-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-9/+4
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-07Update parser with `for` syntaxNiko Matsakis-2/+2
2014-10-27Preserve struct field pattern shorthand in the prettyprinter.Kevin Mehall-1/+1
Use the `is_shorthand` field introduced by #17813 (ead6c4b) to make the prettyprinter output the shorthand form. Fixes a few places that set `is_shorthand: true` when the pattern is not a PatIdent with the same name as the field.
2014-10-24Add a lint for not using field pattern shorthandsP1start-1/+4
Closes #17792.
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-3/+5
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-09-22auto merge of #17339 : treeman/rust/doc-things, r=alexcrichtonbors-156/+129
Also some cleanup to conform to documentation style.
2014-09-18syntax: use an index in CodeMap instead of Gc for ExpnInfo.Eduard Burtescu-2/+1
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-16Fallout from renamingAaron Turon-9/+9
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-137/+134
2014-08-31auto merge of #16788 : Manishearth/rust/raw-ptr-syntax-ty, r=huonwbors-1/+5
@huonw , r? :) #16781
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-0/+6
2014-08-27Allow *-pointers in PtrTy (fixes #16781)Manish Goregaokar-1/+5
2014-08-16librustc: Forbid external crates, imports, and/or items from beingPatrick Walton-1/+1
declared with the same name in the same scope. This breaks several common patterns. First are unused imports: use foo::bar; use baz::bar; Change this code to the following: use baz::bar; Second, this patch breaks globs that import names that are shadowed by subsequent imports. For example: use foo::*; // including `bar` use baz::bar; Change this code to remove the glob: use foo::{boo, quux}; use baz::bar; Or qualify all uses of `bar`: use foo::{boo, quux}; use baz; ... baz::bar ... Finally, this patch breaks code that, at top level, explicitly imports `std` and doesn't disable the prelude. extern crate std; Because the prelude imports `std` implicitly, there is no need to explicitly import it; just remove such directives. The old behavior can be opted into via the `import_shadowing` feature gate. Use of this feature gate is discouraged. This implements RFC #116. Closes #16464. [breaking-change]
2014-08-14librustc: Implement simple `where` clauses.Patrick Walton-4/+13
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-2/+7
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-7/+16
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-05Fixes missing overflow lint for i64 #14269Falco Hirschenberger-1/+1
The `type_overflow` lint, doesn't catch the overflow for `i64` because the overflow happens earlier in the parse phase when the `u64` as biggest possible int gets casted to `i64` , without checking the for overflows. We can't lint in the parse phase, so a refactoring of the `LitInt` type was necessary. The types `LitInt`, `LitUint` and `LitIntUnsuffixed` where merged to one type `LitInt` which stores it's value as `u64`. An additional parameter was added which indicate the signedness of the type and the sign of the value.
2014-07-19Fixed lifetimes on syntax deriving structs, implemented CloneDzmitry Malyshau-2/+6
2014-07-18librustc: Implement unboxed closures with mutable receiversPatrick Walton-7/+20
2014-07-17librustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,Patrick Walton-1/+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-16libsyntax: Remove `Send` from `PtrTy` in `deriving`.Patrick Walton-6/+0
It'll be complex to port to the new explicit-self regime and it seems to be unused.
2014-07-13refactor Method definition to make space for macrosJohn Clements-7/+7
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-11Removed dead structures after changes to PartialOrd/Ord derivings.Felix S. Klock II-259/+16
Remove the `NonMatchesExplode` variant now that no deriving impl uses it. Removed `EnumNonMatching` entirely. Remove now irrelevant `on_matching` field and `HandleNonMatchingEnums` type. Removed unused `EnumNonMatchFunc` type def. Drive-by: revise `EnumNonMatchCollapsedFunc` doc. Made all calls to `expand_enum_method_body` go directly to `build_enum_match_tuple`. Alpha-rename `enum_nonmatch_g` back to `enum_nonmatch_f` to reduce overall diff noise. Inline sole call of `some_ordering_const`. Inline sole call of `ordering_const`. Removed a bunch of code that became dead after the above changes.
2014-07-11`O(n*k)` code-size deriving on enums (better than previous `O(n^k)`).Felix S. Klock II-36/+389
In the above formulas, `n` is the number of variants, and `k` is the number of self-args fed into deriving. In the particular case of interest (namely `PartialOrd` and `Ord`), `k` is always 2, so we are basically comparing `O(n)` versus `O(n^2)`. Also, the stage is set for having *all* enum deriving codes go through `build_enum_match_tuple` and getting rid of `build_enum_match`. Also, seriously attempted to clean up the code itself. Added a bunch of comments attempting to document what I learned as I worked through the original code and adapted it to this new strategy.
2014-07-11Revise the `const_nonmatching` flag with more info about author's intent.Felix S. Klock II-7/+24
In particular, I want authors of deriving modes to understand what they are opting into (namely quadratic code size or worse) when they select NonMatchesExplode.
2014-07-09syntax: doc comments all the thingsCorey Richardson-174/+172
2014-07-08carry self ident forward through re-parsingJohn Clements-5/+9
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-08Change DST syntax: type -> Sized?Nick Cameron-7/+8
closes #13367 [breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g., ``` trait Tr for Sized? {} fn foo<Sized? X: Share>(x: X) {} ```
2014-07-03Fix spelling errors.Joseph Crail-1/+1
2014-07-03Simplify PatIdent to contain an Ident rather than a PathJohn Clements-18/+9
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-1/+1
This commit removes superfluous to_string calls from various places
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-11syntax: Move the AST from @T to Gc<T>Alex Crichton-71/+75