summary refs log tree commit diff
path: root/src/librustc/metadata/decoder.rs
AgeCommit message (Collapse)AuthorLines
2015-01-07rollup merge of #20721: japaric/snapAlex Crichton-3/+3
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustc/lint/builtin.rs src/librustc/session/config.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/context.rs src/librustc_trans/trans/type_.rs src/librustc_typeck/check/_match.rs src/librustdoc/html/format.rs src/libsyntax/std_inject.rs src/libsyntax/util/interner.rs src/test/compile-fail/mut-pattern-mismatched.rs
2015-01-07use slicing sugarJorge Aparicio-3/+3
2015-01-07std: Stabilize the std::hash moduleAlex Crichton-3/+2
This commit aims to prepare the `std::hash` module for alpha by formalizing its current interface whileholding off on adding `#[stable]` to the new APIs. The current usage with the `HashMap` and `HashSet` types is also reconciled by separating out composable parts of the design. The primary goal of this slight redesign is to separate the concepts of a hasher's state from a hashing algorithm itself. The primary change of this commit is to separate the `Hasher` trait into a `Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was actually just a factory for various states, but hashing had very little control over how these states were used. Additionally the old `Hasher` trait was actually fairly unrelated to hashing. This commit redesigns the existing `Hasher` trait to match what the notion of a `Hasher` normally implies with the following definition: trait Hasher { type Output; fn reset(&mut self); fn finish(&self) -> Output; } This `Hasher` trait emphasizes that hashing algorithms may produce outputs other than a `u64`, so the output type is made generic. Other than that, however, very little is assumed about a particular hasher. It is left up to implementors to provide specific methods or trait implementations to feed data into a hasher. The corresponding `Hash` trait becomes: trait Hash<H: Hasher> { fn hash(&self, &mut H); } The old default of `SipState` was removed from this trait as it's not something that we're willing to stabilize until the end of time, but the type parameter is always required to implement `Hasher`. Note that the type parameter `H` remains on the trait to enable multidispatch for specialization of hashing for particular hashers. Note that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is simply used as part `derive` and the implementations for all primitive types. With these definitions, the old `Hasher` trait is realized as a new `HashState` trait in the `collections::hash_state` module as an unstable addition for now. The current definition looks like: trait HashState { type Hasher: Hasher; fn hasher(&self) -> Hasher; } The purpose of this trait is to emphasize that the one piece of functionality for implementors is that new instances of `Hasher` can be created. This conceptually represents the two keys from which more instances of a `SipHasher` can be created, and a `HashState` is what's stored in a `HashMap`, not a `Hasher`. Implementors of custom hash algorithms should implement the `Hasher` trait, and only hash algorithms intended for use in hash maps need to implement or worry about the `HashState` trait. The entire module and `HashState` infrastructure remains `#[unstable]` due to it being recently redesigned, but some other stability decision made for the `std::hash` module are: * The `Writer` trait remains `#[experimental]` as it's intended to be replaced with an `io::Writer` (more details soon). * The top-level `hash` function is `#[unstable]` as it is intended to be generic over the hashing algorithm instead of hardwired to `SipHasher` * The inner `sip` module is now private as its one export, `SipHasher` is reexported in the `hash` module. And finally, a few changes were made to the default parameters on `HashMap`. * The `RandomSipHasher` default type parameter was renamed to `RandomState`. This renaming emphasizes that it is not a hasher, but rather just state to generate hashers. It also moves away from the name "sip" as it may not always be implemented as `SipHasher`. This type lives in the `std::collections::hash_map` module as `#[unstable]` * The associated `Hasher` type of `RandomState` is creatively called... `Hasher`! This concrete structure lives next to `RandomState` as an implemenation of the "default hashing algorithm" used for a `HashMap`. Under the hood this is currently implemented as `SipHasher`, but it draws an explicit interface for now and allows us to modify the implementation over time if necessary. There are many breaking changes outlined above, and as a result this commit is a: [breaking-change]
2015-01-06Register new snapshotsAlex Crichton-2/+2
Conflicts: src/librbml/lib.rs src/libserialize/json_stage0.rs src/libserialize/serialize_stage0.rs src/libsyntax/ast.rs src/libsyntax/ext/deriving/generic/mod.rs src/libsyntax/parse/token.rs
2015-01-07Replace full slice notation with index callsNick Cameron-3/+3
2015-01-05rollup merge of #20482: kmcallister/macro-reformAlex Crichton-7/+8
Conflicts: src/libflate/lib.rs src/libstd/lib.rs src/libstd/macros.rs src/libsyntax/feature_gate.rs src/libsyntax/parse/parser.rs src/libsyntax/show_span.rs src/test/auxiliary/macro_crate_test.rs src/test/compile-fail/lint-stability.rs src/test/run-pass/intrinsics-math.rs src/test/run-pass/tcp-connect-timeouts.rs
2015-01-05DecodeInlinedItem: convert to "unboxed" closuresJorge Aparicio-9/+9
2015-01-05Reformat metadata for exported macrosKeegan McAllister-7/+8
Instead of copy-pasting the whole macro_rules! item from the original .rs file, we serialize a separate name, attributes list, and body, the latter as pretty-printed TTs. The compilation of macro_rules! macros is decoupled somewhat from the expansion of macros in item position. This filters out comments, and facilitates selective imports.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-3/+3
2015-01-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-1/+1
2015-01-02rollup merge of #20416: nikomatsakis/coherenceAlex Crichton-3/+9
Conflicts: src/test/run-pass/issue-15734.rs src/test/run-pass/issue-3743.rs
2015-01-02rollup merge of #20385: nick29581/x-objectAlex Crichton-3/+3
Closes #19056
2015-01-02std: Stabilize the prelude moduleAlex Crichton-1/+3
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2015-01-02Fix an infinite loop in the stability check that was the result ofNiko Matsakis-3/+9
various bugs in `trait_id_of_impl`. The end result was that looking up the "trait_id_of_impl" with a trait's def-id yielded the same trait again, even though it ought to have yielded None.
2014-12-31rustc: replace `GetCrateDataCb` alias with an unboxed closureJorge Aparicio-16/+17
2015-01-01Fix a bug with cross-crate trait implsNick Cameron-3/+3
Closes #19056
2014-12-30Patch more metadata decoding problems.Niko Matsakis-5/+6
2014-12-30Adjust tests for inferenceGet more conservative about inference for now. ↵Niko Matsakis-1/+1
Seems better to err on the side of being more correct rather than less. Fix a bug in typing index expressions that was exposed as a result, and add one type annotation that is not required. Delete some random tests that were relying on old behavior and don't seem to add anything anymore.
2014-12-30Convert to use `Rc<TraitRef>` in object types (finally!).Niko Matsakis-5/+5
2014-12-30Implement associated type projection and normalization.Niko Matsakis-1/+14
2014-12-30Rename `Polytype` to `TypeScheme` to differentiate type schemes (early ↵Niko Matsakis-2/+2
bound) from higher-ranked things (late-bound), which also use the `Poly` prefix.
2014-12-29Switch Region information from uint to u32.Huon Wilson-1/+1
This reduces memory use for building librustc with -O from 1.88 to 1.76 GB.
2014-12-27save-analysis: emit names of items that a glob import actually imports.Nick Cameron-0/+8
There is also some work here to make resolve a bit more stable - it no longer overwrites a specific import with a glob import. [breaking-change] Import shadowing of single/list imports by globs is now forbidden. An interesting case is where a glob import imports a re-export (`pub use`) of a single import. This still counts as a single import for the purposes of shadowing .You can usually fix any bustage by re-ordering such imports. A single import may still shadow (override) a glob import or the prelude.
2014-12-22rollup merge of #19891: nikomatsakis/unique-fn-types-3Alex Crichton-1/+1
Conflicts: src/libcore/str.rs src/librustc_trans/trans/closure.rs src/librustc_typeck/collect.rs src/libstd/path/posix.rs src/libstd/path/windows.rs
2014-12-22Rote changes that don't care to distinguish between a fn pointer and a fn item.Niko Matsakis-1/+1
2014-12-21Fallout of std::str stabilizationAlex Crichton-3/+3
2014-12-20rustc: middle: move TraitItemKind from resolve to def.Eduard Burtescu-4/+3
2014-12-19librustc: use `#[deriving(Copy)]`Jorge Aparicio-3/+1
2014-12-19Implement "perfect forwarding" for HR impls (#19730).Niko Matsakis-2/+2
2014-12-19Centralize on using `Binder` to introduce new binding levels, rather than ↵Niko Matsakis-2/+2
having FnSig carry an implicit binding level. This means that we be more typesafe in general, since things that instantiate bound regions can drop the Binder to reflect that.
2014-12-19Create distinct types for a PolyTraitRef (with bindings) and a normal TraitRef.Niko Matsakis-2/+2
2014-12-14Parse `unsafe impl` but don't do anything particularly interesting with the ↵Niko Matsakis-4/+10
results.
2014-12-14Parse `unsafe trait` but do not do anything with it beyond parsing and ↵Niko Matsakis-0/+5
integrating into rustdoc etc.
2014-12-13librustc: use unboxed closuresJorge Aparicio-30/+43
2014-12-13librustc: fix falloutJorge Aparicio-1/+3
2014-12-12Switch to using predicates to drive checking. Correct various tests --Niko Matsakis-2/+14
in most cases, just the error message changed, but in some cases we are reporting new errors that OUGHT to have been reported before but we're overlooked (mostly involving the `'static` bound on `Send`).
2014-12-12Introduce predicates but don't use them.Niko Matsakis-1/+3
2014-12-12auto merge of #19391 : nick29581/rust/assoc-eq, r=nikomatsakisbors-1/+1
r? @nikomatsakis cc @aturon (I think you were interested in this for some library stuff) closes #18432
2014-12-12auto merge of #19568 : barosl/rust/enum-struct-variants-ice, r=alexcrichtonbors-7/+15
This pull request tries to fix #19340, which states two ICE cases related to enum struct variants. It is my first attempt to fix the compiler. I found this solution by trial and error, so the method used to fix the issue looks very hacky. Please review it, and direct me to find a better solution. I'm also to add test cases. Where should I put them? Maybe `src/test/run-pass/issue-19340.rs`?
2014-12-12Mostly non-behaviour-changing changes (style, etc.)Nick Cameron-1/+1
2014-12-12Fix ICE when a struct variant enum is imported from an external crateBarosl Lee-7/+15
Fixes the first case of #19340.
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-2/+4
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-04Move various data structures out of typeck and into ty.Niko Matsakis-2/+1
2014-11-30fix missed switch pointed out in review plus a few othersjfager-15/+9
2014-11-29Replace some verbose match statements with their `if let` equivalent.jfager-43/+32
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-11-19rustc: middle: remove obsolete ty::get.Eduard Burtescu-1/+1
2014-11-19rustc: fix fallout of adding the `'tcx` lifetime to `Ty`.Eduard Burtescu-39/+45
2014-11-19rustc: middle: rename `ty::t` to `Ty` and use it unqualified everywhere.Eduard Burtescu-3/+3
2014-11-17Fallout from deprecationAaron Turon-2/+1
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+3
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]