summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/generic
AgeCommit message (Collapse)AuthorLines
2015-08-29Allow #[derive()] to generate unsafe trait implsMichael Layzell-1/+11
2015-08-28Move ExpnInfo to NameManish Goregaokar-2/+2
2015-08-27Enumify CompilerExpansion in ExpnInfoManish Goregaokar-2/+1
2015-08-24Auto merge of #27239 - apasel422:issue-19102, r=huonwbors-1/+7
closes #19102
2015-08-17Implement `repr(simd)` as an alias for `#[simd]`.Huon Wilson-1/+1
2015-08-03syntax: Implement #![no_core]Alex Crichton-6/+2
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-23add `#[allow(unused_qualifications)]` to derived implsAndrew Paseltiner-1/+7
closes #19102
2015-07-21Avoid repeated trait bounds in derived implsFlorian Hartwig-0/+11
2015-06-14Replaced a comment mentioning a fixed issueMarkus Westerlind-3/+5
Replaced it with a comment mentioning the rationale for checking the discriminants first.
2015-06-13Utilize discriminant_value for more efficient derivingMarkus-39/+85
The new code generated for deriving on enums looks something like this: ```rust let __self0_vi = unsafe { std::intrinsics::discriminant_value(&self) } as i32; let __self1_vi = unsafe { std::intrinsics::discriminant_value(&__arg1) } as i32; let __self2_vi = unsafe { std::intrinsics::discriminant_value(&__arg2) } as i32; /// if __self0_vi == __self1_vi && __self0_vi == __self2_vi && ... { match (...) { (Variant1, Variant1, ...) => Body1 (Variant2, Variant2, ...) => Body2, ... _ => ::core::intrinsics::unreachable() } } else { ... // catch-all remainder can inspect above variant index values. } ``` This helps massively for C-like enums since they will be compiled as a single comparison giving observed speedups of up to 8x. For more complex enums the speedup is more difficult to measure but it should not be slower to generate code this way regardless.
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-1/+1
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-6/+6
2015-05-21syntax: parse `const fn` for free functions and inherent methods.Eduard Burtescu-0/+1
2015-05-17Allow #[derive()] to generate unsafe methodsManish Goregaokar-1/+10
2015-05-13Merge branch 'master' into mulit-decorNick Cameron-2/+2
2015-05-12RebasingNick Cameron-5/+5
2015-05-12Merge branch 'master' intoNick Cameron-29/+36
2015-05-11Auto merge of #25085 - carols10cents:remove-old-tilde, r=steveklabnikbors-2/+2
There were still some mentions of `~[T]` and `~T`, mostly in comments and debugging statements. I tried to do my best to preserve meaning, but I might have gotten some wrong-- I'm happy to fix anything :)
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-1/+1
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-05-03Update old uses of ~ in comments and debugging statementsCarol Nichols-2/+2
2015-05-02Rename AstBuilder::expr_int -> AstBuilder::expr_isizeManish Goregaokar-3/+6
2015-05-01Get tests passingNick Cameron-2/+3
2015-05-01Give access to field attributes in ext::derivingManish Goregaokar-29/+33
2015-04-30WIP refactor expansion of decorators and move derive to MultiDecoratorNick Cameron-32/+39
2015-04-21syntax: Replace [].tail with the stable [1..] syntaxErick Tryzelaar-1/+1
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-5/+5
2015-04-18Auto merge of #23985 - erickt:derive-cleanup, r=ericktbors-6/+5
This extracts some of the minor cleanup patches from #23905.
2015-04-15syntax: Change deriving methods to take a `&mut FnMut(P<Item>)`Erick Tryzelaar-6/+5
This allows #[derive(...)]` to create more than one impl
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-10fix some comments.Felix S. Klock II-6/+7
2015-04-10Incorporate repr-attr into deriving(PartialOrd) to avoid truncation errors.Felix S. Klock II-13/+38
remove out of date fixme.
2015-04-10Re-add a fixme after some investigation into what's going on.Felix S. Klock II-0/+11
2015-04-10Change `derive` expansions to use `discriminant_value` intrinsic.Felix S. Klock II-30/+27
Fix #15523.
2015-03-27rollup merge of #23741: alexcrichton/remove-int-uintAlex Crichton-1/+1
Conflicts: src/librustc/middle/ty.rs src/librustc_trans/trans/adt.rs src/librustc_typeck/check/mod.rs src/libserialize/json.rs src/test/run-pass/spawn-fn.rs
2015-03-25rustc: Remove support for int/uintAlex Crichton-1/+1
This commit removes all parsing, resolve, and compiler support for the old and long-deprecated int/uint types.
2015-03-24syntax: Update #[derive(...)] to work with phantom and associated typesErick Tryzelaar-6/+118
Closes #7671, #19839
2015-03-11syntax: move MethMac to MacImplItem and combine {Provided,Required}Method ↵Eduard Burtescu-2/+2
into MethodTraitItem.
2015-03-11syntax: rename TypeMethod to MethodSig and use it in MethDecl.Eduard Burtescu-7/+7
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-26/+20
2015-03-11syntax: move indirection around {Trait,Impl}Item, from within.Eduard Burtescu-7/+7
2015-03-06Add #[allow_internal_unstable] to track stability for macros better.Huon Wilson-1/+2
Unstable items used in a macro expansion will now always trigger stability warnings, *unless* the unstable items are directly inside a macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns unless the span of the unstable item is a subspan of the definition of a macro marked with that attribute. E.g. #[allow_internal_unstable] macro_rules! foo { ($e: expr) => {{ $e; unstable(); // no warning only_called_by_foo!(); }} } macro_rules! only_called_by_foo { () => { unstable() } // warning } foo!(unstable()) // warning The unstable inside `foo` is fine, due to the attribute. But the `unstable` inside `only_called_by_foo` is not, since that macro doesn't have the attribute, and the `unstable` passed into `foo` is also not fine since it isn't contained in the macro itself (that is, even though it is only used directly in the macro). In the process this makes the stability tracking much more precise, e.g. previously `println!("{}", unstable())` got no warning, but now it does. As such, this is a bug fix that may cause [breaking-change]s. The attribute is definitely feature gated, since it explicitly allows side-stepping the feature gating system.
2015-02-24Auto merge of #21689 - FlaPer87:oibit-send-and-friends, r=nikomatsakisbors-1/+1
This is one more step towards completing #13231 This series of commits add support for default trait implementations. The changes in this PR don't break existing code and they are expected to preserve the existing behavior in the compiler as far as built-in bounds checks go. The PR adds negative implementations of `Send`/`Sync` for some types and it removes the special cases for `Send`/`Sync` during the trait obligations checks. That is, it now fully relies on the traits check rather than lang items. Once this patch lands and a new snapshot is created, it'll be possible to add default impls for `Send` and `Sync` and remove entirely the use of `BuiltinBound::{BoundSend,BoundSync}` for positive implementations as well. This PR also removes the restriction on negative implementations. That is, it is now possible to add negative implementations for traits other than `Send`/`Sync`
2015-02-22Add support for default trait impls in libsyntaxFlavio Percoco-1/+1
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-8/+8
where possible.
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-16/+16
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-16/+16
2015-02-18Opt for .cloned() over .map(|x| x.clone()) etc.Kevin Butler-5/+5
2015-02-12Made `Self` a keyword.Marvin Löbel-8/+8
It is only allowed in paths now, where it will either work inside a `trait` or `impl` item, or not resolve outside of it. [breaking-change] Closes #22137
2015-02-09Accept quantification of lifetimes outside the self type in where clauses.Nick Cameron-0/+1
Closes #20022