summary refs log tree commit diff
path: root/src/librustc/metadata/decoder.rs
AgeCommit message (Collapse)AuthorLines
2015-05-13eddyb's changes for DST coercionsNick Cameron-0/+10
+ lots of rebasing
2015-05-12rustc_typeck: remove the "preload all impls ever" workaround in coherence.Eduard Burtescu-10/+0
2015-05-12Fix ty::populate_implementations_for_trait_if_necessary to load the trait's ↵Eduard Burtescu-9/+41
impls from all the crates.
2015-05-12rustc: rename ty::populate_implementations_for_type_if_necessary to make it ↵Eduard Burtescu-5/+6
clear that it only populates inherent impls.
2015-05-12rustc::metadata: use u64 for DefId's instead of strings.Eduard Burtescu-56/+40
2015-04-30Use hash-tables in trait selectionAriel Ben-Yehuda-0/+5
Puts implementations in bins hashed by the fast-reject key, and only looks up the relevant impls, reducing O(n^2)-ishness Before: 688.92user 5.08system 8:56.70elapsed 129%CPU (0avgtext+0avgdata 1208164maxresident)k, LLVM 379.142s After: 637.78user 5.11system 8:17.48elapsed 129%CPU (0avgtext+0avgdata 1201448maxresident)k LLVM 375.552s Performance increase is +7%-ish
2015-04-30Stop using Rc in TraitRef and TraitDefAriel Ben-Yehuda-3/+3
The former stopped making sense when we started interning substs and made TraitRef a 2-word copy type, and I'm moving the latter into an arena as they live as long as the type context.
2015-04-23Fix a number of bugs that interfered with cross-crate usage of associated ↵Sean Patrick Santos-14/+16
consts.
2015-04-23Functional changes for associated constants. Cross-crate usage of associated ↵Sean Patrick Santos-1/+61
constants is not yet working.
2015-04-23Structural changes for associated constantsSean Patrick Santos-5/+2
Introduces new variants and types in syntax::ast, middle::ty, and middle::def.
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-4/+3
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-2/+2
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-03In librustc*, convert many uses of ast::Ident to ast::Name, fixing much of ↵Jonathan S-1/+1
#6993.
2015-03-31Auto merge of #23549 - aturon:stab-num, r=alexcrichtonbors-1/+1
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change] r? @alexcrichton
2015-03-31Stabilize std::numAaron Turon-1/+1
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-30std: Standardize (input, output) param orderingsAlex Crichton-1/+1
This functions swaps the order of arguments to a few functions that previously took (output, input) parameters, but now take (input, output) parameters (in that order). The affected functions are: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-11/+11
Now that support has been removed, all lingering use cases are renamed.
2015-03-12rustdoc: Fix ICE with cross-crate default implsAlex Crichton-1/+6
This adds a special code path for impls which are listed as default impls to ensure that they're loaded correctly.
2015-03-06Change the data structures for tracking defaulted traits. In the tcx, weNiko Matsakis-6/+5
now have a simple set of trait def-ids. During coherence, we use a separate table to track the default impls for any given trait so that we can report a nice error. This fixes various bugs in the metadata encoding that led to `ty::trait_has_default_impl` yielding the wrong values in the cross-crate case. (In particular, default impl def-ids were not included in the list of all impl def-ids; I debated fixing just that, but this approach seemed cleaner overall, since we usually treat the "defaulted" bit on traits as being a property of the trait, and now iterating over a list of impls doesn't intermingle default impls with normal impls.)
2015-03-05Auto merge of #23026 - nikomatsakis:issue-20220-supertrait, r=nikomatsakisbors-35/+11
The main gist of this PR is commit 1077efb which removes the list of supertraits from the `TraitDef` and pulls them into a separate table, which is accessed via `lookup_super_predicates`. This is analogous to `lookup_predicates`, which gets the complete where clause. This allows us to create the `TraitDef`, which contains the list generics and so forth, without fully knowing the list of supertraits. This in turn allows the *supertrait listing* to contain references to associated types like `<Self as Foo>::Item`, which were previously impossible because conversion required having the `TraitDef` for `Foo`. We do not yet support `Self::Item` in a supertrait listing. This doesn't work because to convert that, it attempts to expand out the full set of supertraits, which are in the process of being created. This could potentially be worked out by having the expansion of supertraits proceed in a lazy fashion, but we'd have to define shadowing rules for associated types which we don't currently have. Along the way (in 9de9ec5) I also removed the restriction against duplicate bounds and generalized the code so that it can handle having the same supertrait multiple times with different arguments, e.g. `Foo : Bar<i32> + Bar<u32>`. This restriction was serving no particular purpose, since the same trait could be extended multiple times indirectly, and in the era of multidispatch it is actively harmful. This is technically a [breaking-change] because it affects the definition of a super-trait. Anything in a where clause that looks like `where Self : Foo` is now considered a supertrait. Because cycles are disallowed in supertraits, that could lead to some errors. This has not been observed in any existing code. r? @nrc
2015-03-04std: Deprecate std::old_io::fsAlex Crichton-6/+6
This commit deprecates the majority of std::old_io::fs in favor of std::fs and its new functionality. Some functions remain non-deprecated but are now behind a feature gate called `old_fs`. These functions will be deprecated once suitable replacements have been implemented. The compiler has been migrated to new `std::fs` and `std::path` APIs where appropriate as part of this change.
2015-03-04Separate supertrait collection from processing a `TraitDef`. This allowsNiko Matsakis-35/+11
us to construct trait-references and do other things without forcing a full evaluation of the supertraits. One downside of this scheme is that we must invoke `ensure_super_predicates` before using any construct that might require knowing about the super-predicates.
2015-03-04Encode codemap and span information in crate metadata.Michael Woerister-1/+16
This allows to create proper debuginfo line information for items inlined from other crates (e.g. instantiations of generics). Only the codemap's 'metadata' is stored in a crate's metadata. That is, just filename, line-beginnings, etc. but not the actual source code itself. We are thus missing the opportunity of making Rust the first "open-source-only" programming language out there. Pity.
2015-03-03Add `core::num::wrapping` and fix overflow errors.James Miller-1/+1
Many of the core rust libraries have places that rely on integer wrapping behaviour. These places have been altered to use the wrapping_* methods: * core::hash::sip - A number of macros * core::str - The `maximal_suffix` method in `TwoWaySearcher` * rustc::util::nodemap - Implementation of FnvHash * rustc_back::sha2 - A number of macros and other places * rand::isaac - Isaac64Rng, changed to use the Wrapping helper type Some places had "benign" underflow. This is when underflow or overflow occurs, but the unspecified value is not used due to other conditions. * collections::bit::Bitv - underflow when `self.nbits` is zero. * collections::hash::{map,table} - Underflow when searching an empty table. Did cause undefined behaviour in this case due to an out-of-bounds ptr::offset based on the underflowed index. However the resulting pointers would never be read from. * syntax::ext::deriving::encodable - Underflow when calculating the index of the last field in a variant with no fields. These cases were altered to avoid the underflow, often by moving the underflowing operation to a place where underflow could not happen. There was one case that relied on the fact that unsigned arithmetic and two's complement arithmetic are identical with wrapping semantics. This was changed to use the wrapping_* methods. Finally, the calculation of variant discriminants could overflow if the preceeding discriminant was `U64_MAX`. The logic in `rustc::middle::ty` for this was altered to avoid the overflow completely, while the remaining places were changed to use wrapping methods. This is because `rustc::middle::ty::enum_variants` now throws an error when the calculated discriminant value overflows a `u64`. This behaviour can be triggered by the following code: ``` enum Foo { A = U64_MAX, B } ``` This commit also implements the remaining integer operators for Wrapped<T>.
2015-02-27std: Deprecated the `old_io::extensions` moduleAlex Crichton-7/+12
The `u64_from_be_bytes` and `u64_to_be_bytes` functions are being deprecated with no replacement for now. [breaking-change]
2015-02-24rustc_resolve: remove the distinction between DefStaticMethod and DefMethod.Eduard Burtescu-18/+4
2015-02-24rustc: load DefAssociatedTy from cross-crate metadata. Fixes #20542.Eduard Burtescu-17/+25
2015-02-24rustc: remove unused ForeignType item family.Eduard Burtescu-3/+1
2015-02-24Revert bogus rename from DefTrait to DefaultImpl.Eduard Burtescu-1/+1
2015-02-24Auto merge of #21689 - FlaPer87:oibit-send-and-friends, r=nikomatsakisbors-4/+15
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-22Rename DefTrait to DefaultImplFlavio Percoco-7/+7
2015-02-22look for default trait candidatesFlavio Percoco-0/+9
2015-02-22Fix fallout from libsyntax implementationFlavio Percoco-3/+5
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-1/+1
where possible.
2015-02-12Pacify the merciless nrc.Niko Matsakis-3/+3
2015-02-12Update metadata to reflect that predicates/schemes/trait-defs are now severedNiko Matsakis-11/+29
2015-02-02`for x in xs.iter()` -> `for x in &xs`Jorge Aparicio-3/+3
2015-02-01More deprecating of i/u suffixes in librariesAlfie John-2/+2
2015-01-30Merge remote-tracking branch 'origin/master' into rollupAlex Crichton-0/+7
Conflicts: src/liballoc/lib.rs src/libcore/ops.rs
2015-01-30std: Stabilize FromStr and parseAlex Crichton-1/+1
This commits adds an associated type to the `FromStr` trait representing an error payload for parses which do not succeed. The previous return value, `Option<Self>` did not allow for this form of payload. After the associated type was added, the following attributes were applied: * `FromStr` is now stable * `FromStr::Err` is now stable * `FromStr::from_str` is now stable * `StrExt::parse` is now stable * `FromStr for bool` is now stable * `FromStr for $float` is now stable * `FromStr for $integral` is now stable * Errors returned from stable `FromStr` implementations are stable * Errors implement `Display` and `Error` (both impl blocks being `#[stable]`) Closes #15138
2015-01-30Use `#[rustc_paren_sugar]` as a more extensible way of deciding whenNiko Matsakis-0/+7
paren sugar is legal.
2015-01-29Auto merge of #21677 - japaric:no-range, r=alexcrichtonbors-1/+1
Note: Do not merge until we get a newer snapshot that includes #21374 There was some type inference fallout (see 4th commit) because type inference with `a..b` is not as good as with `range(a, b)` (see #21672). r? @alexcrichton
2015-01-29s/Show/Debug/gJorge Aparicio-1/+1
2015-01-28Rename found_ast to FoundAst and qualify uses.Ms2ger-5/+5
This matches contemporary Rust style.
2015-01-26Fallout of io => old_ioAlex Crichton-5/+5
2015-01-19remove unnecessary parentheses from range notationJorge Aparicio-1/+1
2015-01-16Record negative trait_impls separatedlyFlavio Percoco-0/+23
2015-01-13Return the Vec from decoder::get_item_attrs.Ms2ger-6/+4
Using a closure unnecessarily obfuscates the code.
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