about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving
AgeCommit message (Collapse)AuthorLines
2014-11-26/*! -> //!Steve Klabnik-17/+7
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-46/+59
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-17Fix fallout from coercion removalNick Cameron-0/+1
2014-11-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-12/+7
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-15Improve examples for syntax::ext::deriving::encodableBarosl Lee-31/+40
The examples in the documentation for syntax::ext::deriving::encodable are outdated, and do not work. To fix this, the following changes are applied: - emit_field() -> emit_struct_field() - read_field() -> read_struct_field() - Use Result to report errors - Add the mut keyword to Encoder/Decoder - Prefer Encodable::encode() to emit_uint
2014-11-09auto merge of #18755 : japaric/rust/ord, r=alexcrichtonbors-10/+31
Closes #18738 cc #15689 r? @alexcrichton cc @cmr
2014-11-07Update Partial/Total Eq/Ord terminologyJorge Aparicio-7/+7
2014-11-07syntax: Use UFCS in the expansion of `#[deriving(PartialOrd)]`Jorge Aparicio-4/+25
2014-11-07Update parser with `for` syntaxNiko Matsakis-2/+2
2014-11-05Use operator sugar in the expansion of `#[deriving(PartialEq)]`Jorge Aparicio-5/+31
2014-11-03syntax: Use UFCS in the expansion of `#[deriving(Clone)]`Jorge Aparicio-3/+11
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-5/+7
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-10/+10
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-275/+253
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-08auto merge of #16285 : alexcrichton/rust/rename-share, r=huonwbors-2/+2
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use` statement, but the `NoShare` struct is no longer part of `std::kinds::marker` due to #12660 (the build cannot bootstrap otherwise). All code referencing the `Share` trait should now reference the `Sync` trait, and all code referencing the `NoShare` type should now reference the `NoSync` type. The functionality and meaning of this trait have not changed, only the naming. Closes #16281 [breaking-change]
2014-08-07Rename `Share` to `Sync`Alex Crichton-2/+2
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use` statement, but the `NoShare` struct is no longer part of `std::kinds::marker` due to #12660 (the build cannot bootstrap otherwise). All code referencing the `Share` trait should now reference the `Sync` trait, and all code referencing the `NoShare` type should now reference the `NoSync` type. The functionality and meaning of this trait have not changed, only the naming. Closes #16281 [breaking-change]
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-08-01Fix misspelled comments.Joseph Crail-1/+1
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-352/+29
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-43/+455
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-23/+40
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-249/+244
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-16/+14
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-29Implement RFC#28: Add PartialOrd::partial_cmpSteven Fackler-5/+99
I ended up altering the semantics of Json's PartialOrd implementation. It used to be the case that Null < Null, but I can't think of any reason for an ordering other than the default one so I just switched it over to using the derived implementation. This also fixes broken `PartialOrd` implementations for `Vec` and `TreeMap`. RFC: 0028-partial-cmp