about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/rand.rs
AgeCommit message (Collapse)AuthorLines
2015-04-14syntax: Remove derive(Rand)Alex Crichton-175/+0
2015-03-28cleanup: Remove unused braces in use statementsRicho Healey-1/+1
2015-03-03Switched to Box::new in many places.Felix S. Klock II-2/+2
Many of the modifications putting in `Box::new` calls also include a pointer to Issue 22405, which tracks going back to `box <expr>` if possible in the future. (Still tried to use `Box<_>` where it sufficed; thus some tests still have `box_syntax` enabled, as they use a mix of `box` and `Box::new`.) Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-02-12Made `Self` a keyword.Marvin Löbel-1/+1
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-07Don't use std:: paths in syntax extensions when compiling a #![no_std] crateKeegan McAllister-0/+6
Fixes #16803. Fixes #14342. Fixes half of #21827 -- slice syntax is still broken.
2015-02-07Use path helper macros in derivingKeegan McAllister-2/+2
2015-02-04remove all kind annotations from closuresJorge Aparicio-1/+1
2015-02-04Auto merge of #21892 - huonw:deprecate-rand, r=alexcrichtonbors-0/+4
Use [`rand`](https://crates.io/crates/rand) and [`derive_rand`](https://crates.io/crates/derive_rand) from crates.io. [breaking-change]
2015-02-04Deprecate in-tree `rand`, `std::rand` and `#[derive(Rand)]`.Huon Wilson-0/+4
Use the crates.io crate `rand` (version 0.1 should be a drop in replacement for `std::rand`) and `rand_macros` (`#[derive_Rand]` should be a drop-in replacement). [breaking-change]
2015-02-03Correct one case where the inference was detecting a looser result than theNiko Matsakis-1/+1
explicit annotation, leading to "extra `mut` declaration" lint errors.
2015-01-25Associated types support for deriving::generic::TraitDefDzmitry Malyshau-1/+2
2015-01-21rollup merge of #21340: pshc/libsyntax-no-more-intsAlex Crichton-3/+3
Collaboration with @rylev! I didn't change `int` in the [quasi-quoter](https://github.com/pshc/rust/blob/99ae1a30f3ca28c0f7e431620560d30e44627124/src/libsyntax/ext/quote.rs#L328), because I'm not sure if there will be adverse effects. Addresses #21095.
2015-01-17libsyntax: rename functions from uint to usizePaul Collier-3/+3
2015-01-17s/deriving/derives in Comments/DocsEarl St Sauver-2/+2
There are a large number of places that incorrectly refer to deriving in comments, instead of derives. Fixes #20984
2015-01-08Test fixes.Huon Wilson-3/+3
2015-01-05syntax: remove remaining boxed closuresJorge Aparicio-1/+1
2014-12-26Accept `?Sized` as well as `Sized?`Nick Cameron-1/+0
Includes a bit of refactoring to store `?` unbounds as bounds with a modifier, rather than in their own world, in the AST at least.
2014-12-13libsyntax: use unboxed closuresJorge Aparicio-12/+16
2014-12-12Add support for equality constraints on associated typesNick Cameron-0/+1
2014-11-17Switch to purely namespaced enumsSteven Fackler-7/+10
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-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-12/+10
2014-07-11Removed dead structures after changes to PartialOrd/Ord derivings.Felix S. Klock II-1/+0
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-11Revise the `const_nonmatching` flag with more info about author's intent.Felix S. Klock II-1/+1
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-08Change DST syntax: type -> Sized?Nick Cameron-1/+1
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-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-6/+9
2014-06-02syntax: Remove use of `pub use` globsklutzy-0/+1
`quote_expr!` now injects two more (priv) `use` globs. This may cause extra unused_imports warning.
2014-05-29std: Recreate a `rand` moduleAlex Crichton-2/+3
This commit shuffles around some of the `rand` code, along with some reorganization. The new state of the world is as follows: * The librand crate now only depends on libcore. This interface is experimental. * The standard library has a new module, `std::rand`. This interface will eventually become stable. Unfortunately, this entailed more of a breaking change than just shuffling some names around. The following breaking changes were made to the rand library: * Rng::gen_vec() was removed. This has been replaced with Rng::gen_iter() which will return an infinite stream of random values. Previous behavior can be regained with `rng.gen_iter().take(n).collect()` * Rng::gen_ascii_str() was removed. This has been replaced with Rng::gen_ascii_chars() which will return an infinite stream of random ascii characters. Similarly to gen_iter(), previous behavior can be emulated with `rng.gen_ascii_chars().take(n).collect()` * {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all relied on being able to use an OSRng for seeding, but this is no longer available in librand (where these types are defined). To retain the same functionality, these types now implement the `Rand` trait so they can be generated with a random seed from another random number generator. This allows the stdlib to use an OSRng to create seeded instances of these RNGs. * Rand implementations for `Box<T>` and `@T` were removed. These seemed to be pretty rare in the codebase, and it allows for librand to not depend on liballoc. Additionally, other pointer types like Rc<T> and Arc<T> were not supported. If this is undesirable, librand can depend on liballoc and regain these implementations. * The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`, but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice structure now has a lifetime associated with it. * The `sample` method on `Rng` has been moved to a top-level function in the `rand` module due to its dependence on `Vec`. cc #13851 [breaking-change]
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-1/+1
2014-04-23auto merge of #13704 : edwardw/rust/doc-hidden, r=alexcrichtonbors-1/+1
Closes #13698
2014-04-23auto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakisbors-1/+3
This alters the borrow checker's requirements on invoking closures from requiring an immutable borrow to requiring a unique immutable borrow. This means that it is illegal to invoke a closure through a `&` pointer because there is no guarantee that is not aliased. This does not mean that a closure is required to be in a mutable location, but rather a location which can be proven to be unique (often through a mutable pointer). For example, the following code is unsound and is no longer allowed: type Fn<'a> = ||:'a; fn call(f: |Fn|) { f(|| { f(|| {}) }); } fn main() { call(|a| { a(); }); } There is no replacement for this pattern. For all closures which are stored in structures, it was previously allowed to invoke the closure through `&self` but it now requires invocation through `&mut self`. The standard library has a good number of violations of this new rule, but the fixes will be separated into multiple breaking change commits. Closes #12224
2014-04-23Fix other bugs with new closure borrowingAlex Crichton-1/+3
This fixes various issues throughout the standard distribution and tests.
2014-04-23Honor hidden doc attribute of derivable trait methodsEdward Wang-1/+1
Closes #13698
2014-04-23Support unsized types with the `type` keywordNick Cameron-1/+2
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-3/+3
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-2/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-12Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.Felix S. Klock II-2/+1
There is a broader revision (that does this across the board) pending in #12675, but that is awaiting the arrival of more data (to decide whether to keep OptVec alive by using a non-Vec internally). For this code, the representation of lifetime lists needs to be the same in both ScopeChain and in the ast and ty structures. So it seemed cleanest to just use `vec_ng::Vec`, now that it has a cheaper empty representation than the current `vec` code.
2014-03-12std: Move rand to librand.Huon Wilson-4/+3
This functionality is not super-core and so doesn't need to be included in std. It's possible that std may need rand (it does a little bit now, for io::test) in which case the functionality required could be moved to a secret hidden module and reexposed by librand. Unfortunately, using #[deprecated] here is hard: there's too much to mock to make it feasible, since we have to ensure that programs still typecheck to reach the linting phase.
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-2/+4
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-19/+19
2014-02-21syntax: Allow syntax extensions to have attributesErick Tryzelaar-0/+1
2014-02-13Tweak ItemDecorator APISteven Fackler-3/+3
The old method of building up a list of items and threading it through all of the decorators was unwieldy and not really scalable as non-deriving ItemDecorators become possible. The API is now that the decorator gets an immutable reference to the item it's attached to, and a callback that it can pass new items to. If we want to add syntax extensions that can modify the item they're attached to, we can add that later, but I think it'll have to be separate from ItemDecorator to avoid strange ordering issues.
2014-02-11libsyntax -- fix unsafe sharing in closuresNiko Matsakis-5/+6
2014-02-08Update deriving to pass around the `cx` linearlyNiko Matsakis-4/+3
2014-02-08syntax: convert deriving to take &mut ExtCtxt.Huon Wilson-6/+5
2014-01-27syntax: improve the spans of some #[deriving] traits.Huon Wilson-28/+24
This makes error messages about (e.g.) `#[deriving(Clone)] struct Foo { x: Type }` point at `x: Type` rather than `Clone` in the header (while still referring to the `#[deriving(Clone)]` in the expansion info).
2014-01-18syntax::ext: replace span_fatal with span_err in many places.Huon Wilson-1/+3
This means that compilation continues for longer, and so we can see more errors per compile. This is mildly more user-friendly because it stops users having to run rustc n times to see n macro errors: just run it once to see all of them.
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-3/+3
2013-12-28Stop using @ExtCtxtSteven Fackler-3/+3
2013-12-07syntax::deriving: add the cx and span to the TraitDef to reduce duplication.Huon Wilson-1/+3