summary refs log tree commit diff
path: root/src/librustc/metadata/encoder.rs
AgeCommit message (Collapse)AuthorLines
2015-05-13eddyb's changes for DST coercionsNick Cameron-0/+10
+ lots of rebasing
2015-05-12Fix ty::populate_implementations_for_trait_if_necessary to load the trait's ↵Eduard Burtescu-0/+1
impls from all the crates.
2015-05-12rustc::metadata: use u64 for DefId's instead of strings.Eduard Burtescu-29/+31
2015-04-30Use hash-tables in trait selectionAriel Ben-Yehuda-10/+8
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-5/+5
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-23Functional changes for associated constants. Cross-crate usage of associated ↵Sean Patrick Santos-8/+75
constants is not yet working.
2015-04-23Structural changes for associated constantsSean Patrick Santos-8/+12
Introduces new variants and types in syntax::ast, middle::ty, and middle::def.
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-07rustdoc: Improve handling inlined associated typesAlex Crichton-1/+2
* All bounds are now discovered through the trait to be inlined. * The `?Sized` bound now renders correctly for inlined associated types. * All `QPath`s (`<A as B>::C`) instances are rendered as `A::C` where `C` is a hyperlink to the trait `B`. This should improve at least how the docs look at least. * Supertrait bounds are now separated and display as the source lists them. Closes #20727 Closes #21145
2015-04-03In librustc*, convert many uses of ast::Ident to ast::Name, fixing much of ↵Jonathan S-12/+12
#6993.
2015-04-01Fallout in libsyntax/librustc: use newtype'd options for linked lists,Niko Matsakis-4/+3
since `Option` is not fundamental and hence the old impls run afoul of the orphan rules.
2015-03-28Rollup merge of #23803 - richo:unused-braces, r=ManishearthManish Goregaokar-1/+1
Pretty much what it says on the tin.
2015-03-28cleanup: Remove unused braces in use statementsRicho Healey-1/+1
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-5/+5
Now that support has been removed, all lingering use cases are renamed.
2015-03-23Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses ofNiko Matsakis-3/+3
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about how to use `[]`.
2015-03-13Fallout of std::old_io deprecationAlex Crichton-38/+48
2015-03-11syntax: move MethMac to MacImplItem and combine {Provided,Required}Method ↵Eduard Burtescu-21/+18
into MethodTraitItem.
2015-03-11syntax: rename TypeMethod to MethodSig and use it in MethDecl.Eduard Burtescu-2/+2
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-42/+17
2015-03-11syntax: move indirection around {Trait,Impl}Item, from within.Eduard Burtescu-15/+11
2015-03-06Change the data structures for tracking defaulted traits. In the tcx, weNiko Matsakis-0/+6
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-04Separate supertrait collection from processing a `TraitDef`. This allowsNiko Matsakis-17/+27
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-0/+30
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-03-03metadata: Bump the metadata encoding version.Kang Seonghoon-1/+1
We have changed the encoding enough to bump that. Also added some notes about metadata encoding to librbml/lib.rs.
2015-03-03metadata: Implement relaxation of short RBML lengths.Kang Seonghoon-26/+31
We try to move the data when the length can be encoded in the much smaller number of bytes. This interferes with indices and type abbreviations however, so this commit introduces a public interface to get and mark a "stable" (i.e. not affected by relaxation) position of the current pointer. The relaxation logic only moves a small data, currently at most 256 bytes, as moving the data can be costly. There might be further opportunities to allow more relaxation by moving fields around, which I didn't seriously try.
2015-03-03metadata: Avoid the use of raw `wr_str` or `write_all`.Kang Seonghoon-151/+70
They are, with a conjunction of `start_tag` and `end_tag`, commonly used to write a document with a binary data of known size. However the use of `start_tag` makes the length always 4 bytes long, which is almost not optimal (requiring the relaxation step to remedy). Directly using `wr_tagged_*` methods is better for both readability and resulting metadata size.
2015-02-24Fix fallout from rebasing.Eduard Burtescu-2/+2
2015-02-24Implement `<T>::method` UFCS expression syntax.Eduard Burtescu-1/+1
2015-02-24rustc: combine partial_def_map and last_private_map into def_map.Eduard Burtescu-3/+1
2015-02-24syntax: don't use TraitRef in QPath.Eduard Burtescu-3/+2
2015-02-24syntax: don't store a secondary NodeId for TyPath.Eduard Burtescu-1/+1
2015-02-24Auto merge of #21689 - FlaPer87:oibit-send-and-friends, r=nikomatsakisbors-0/+12
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-22Validate inline attribute argumentsSimonas Kazlauskas-10/+2
2015-02-22Rename DefTrait to DefaultImplFlavio Percoco-1/+1
2015-02-22Fix fallout from libsyntax implementationFlavio Percoco-0/+12
2015-02-22Rollup merge of #22584 - alexcrichton:snapshots, r=GankroManish Goregaokar-42/+0
2015-02-20Register new snapshotsAlex Crichton-42/+0
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-39/+39
where possible.
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-5/+5
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-5/+5
2015-02-18std: Stabilize the `hash` moduleAlex Crichton-0/+42
This commit is an implementation of [RFC 823][rfc] which is another pass over the `std::hash` module for stabilization. The contents of the module were not entirely marked stable, but some portions which remained quite similar to the previous incarnation are now marked `#[stable]`. Specifically: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0823-hash-simplification.md * `std::hash` is now stable (the name) * `Hash` is now stable * `Hash::hash` is now stable * `Hasher` is now stable * `SipHasher` is now stable * `SipHasher::new` and `new_with_keys` are now stable * `Hasher for SipHasher` is now stable * Many `Hash` implementations are now stable All other portions of the `hash` module remain `#[unstable]` as they are less commonly used and were recently redesigned. This commit is a breaking change due to the modifications to the `std::hash` API and more details can be found on the [RFC][rfc]. Closes #22467 [breaking-change]
2015-02-12Update metadata to reflect that predicates/schemes/trait-defs are now severedNiko Matsakis-33/+36
2015-02-08Auto merge of #21999 - tomjakubowski:rustdoc-fixes, r=alexcrichtonbors-1/+2
r? @alexcrichton
2015-02-06Encode foreign function argument namesTom Jakubowski-1/+2
Fix #21917
2015-02-06Update to last version, remove "[]" as much as possibleGuillaumeGomez-3/+3
2015-02-06librustc has been updatedGuillaumeGomez-9/+9
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-2/+2
2015-02-04remove all kind annotations from closuresJorge Aparicio-1/+1