about summary refs log tree commit diff
path: root/src/librustc/metadata/tyencode.rs
AgeCommit message (Collapse)AuthorLines
2015-11-26split the metadata code into rustc_metadataAriel Ben-Yehuda-479/+0
tests & rustdoc still broken
2015-10-02Merge branch 'master' into metadietAriel Ben-Yehuda-1/+1
rlib sizes: 1445222 liballoc_jemalloc-bb943c5a.rlib 10664 liballoc_system-bb943c5a.rlib 143592 libarena-bb943c5a.rlib 3639102 libcollections-bb943c5a.rlib 16316910 libcore-bb943c5a.rlib 214154 libflate-bb943c5a.rlib 231440 libfmt_macros-bb943c5a.rlib 536976 libgetopts-bb943c5a.rlib 209672 libgraphviz-bb943c5a.rlib 408008 liblibc-bb943c5a.rlib 189610 liblog-bb943c5a.rlib 662184 librand-bb943c5a.rlib 605112 librbml-bb943c5a.rlib 1397820 librustc_back-bb943c5a.rlib 38383772 librustc-bb943c5a.rlib 12842 librustc_bitflags-bb943c5a.rlib 2297822 librustc_borrowck-bb943c5a.rlib 571064 librustc_data_structures-bb943c5a.rlib 9356542 librustc_driver-bb943c5a.rlib 9477226 librustc_front-bb943c5a.rlib 1605698 librustc_lint-bb943c5a.rlib 77111720 librustc_llvm-bb943c5a.rlib 4783848 librustc_mir-bb943c5a.rlib 3534256 librustc_platform_intrinsics-bb943c5a.rlib 593038 librustc_privacy-bb943c5a.rlib 3122202 librustc_resolve-bb943c5a.rlib 14185212 librustc_trans-bb943c5a.rlib 11940328 librustc_typeck-bb943c5a.rlib 1634264 librustc_unicode-bb943c5a.rlib 15564160 librustdoc-bb943c5a.rlib 8153964 libstd-bb943c5a.rlib 30589338 libsyntax-bb943c5a.rlib 897110 libterm-bb943c5a.rlib 1360662 libtest-bb943c5a.rlib
2015-10-01improve the tyencode abbrev formatAriel Ben-Yehuda-16/+13
3% win on libcore 528828 liballoc-bb943c5a.rlib 1425126 liballoc_jemalloc-bb943c5a.rlib 10090 liballoc_system-bb943c5a.rlib 144904 libarena-bb943c5a.rlib 3773896 libcollections-bb943c5a.rlib 17075242 libcore-bb943c5a.rlib 195770 libflate-bb943c5a.rlib 234702 libfmt_macros-bb943c5a.rlib 536342 libgetopts-bb943c5a.rlib 212028 libgraphviz-bb943c5a.rlib 397068 liblibc-bb943c5a.rlib 185038 liblog-bb943c5a.rlib 680782 librand-bb943c5a.rlib 577574 librbml-bb943c5a.rlib 1381992 librustc_back-bb943c5a.rlib 37554736 librustc-bb943c5a.rlib 12826 librustc_bitflags-bb943c5a.rlib 2257392 librustc_borrowck-bb943c5a.rlib 533858 librustc_data_structures-bb943c5a.rlib 9338878 librustc_driver-bb943c5a.rlib 8960016 librustc_front-bb943c5a.rlib 1594212 librustc_lint-bb943c5a.rlib 79159342 librustc_llvm-bb943c5a.rlib 4590656 librustc_mir-bb943c5a.rlib 3529292 librustc_platform_intrinsics-bb943c5a.rlib 590688 librustc_privacy-bb943c5a.rlib 3084134 librustc_resolve-bb943c5a.rlib 14032890 librustc_trans-bb943c5a.rlib 11833852 librustc_typeck-bb943c5a.rlib 1641496 librustc_unicode-bb943c5a.rlib 15611582 librustdoc-bb943c5a.rlib 2693764 libserialize-bb943c5a.rlib 8266920 libstd-bb943c5a.rlib 29573790 libsyntax-bb943c5a.rlib 895484 libterm-bb943c5a.rlib
2015-10-01don't mark_stable_position needlessly in tyencodeAriel Ben-Yehuda-6/+13
another 1% improvement in libcore size - also 1% in librustc 550076 liballoc-bb943c5a.rlib 1425150 liballoc_jemalloc-bb943c5a.rlib 10100 liballoc_system-bb943c5a.rlib 149372 libarena-bb943c5a.rlib 3964144 libcollections-bb943c5a.rlib 17744342 libcore-bb943c5a.rlib 197420 libflate-bb943c5a.rlib 241582 libfmt_macros-bb943c5a.rlib 550560 libgetopts-bb943c5a.rlib 219444 libgraphviz-bb943c5a.rlib 402668 liblibc-bb943c5a.rlib 187158 liblog-bb943c5a.rlib 704588 librand-bb943c5a.rlib 594522 librbml-bb943c5a.rlib 1392516 librustc_back-bb943c5a.rlib 38196500 librustc-bb943c5a.rlib 12826 librustc_bitflags-bb943c5a.rlib 2286918 librustc_borrowck-bb943c5a.rlib 561714 librustc_data_structures-bb943c5a.rlib 9356400 librustc_driver-bb943c5a.rlib 9378650 librustc_front-bb943c5a.rlib 1603680 librustc_lint-bb943c5a.rlib 79184908 librustc_llvm-bb943c5a.rlib 4746824 librustc_mir-bb943c5a.rlib 3532474 librustc_platform_intrinsics-bb943c5a.rlib 592664 librustc_privacy-bb943c5a.rlib 3114986 librustc_resolve-bb943c5a.rlib 14153174 librustc_trans-bb943c5a.rlib 11918356 librustc_typeck-bb943c5a.rlib 1669986 librustc_unicode-bb943c5a.rlib 15611582 librustdoc-bb943c5a.rlib 2836912 libserialize-bb943c5a.rlib 8549994 libstd-bb943c5a.rlib 30399156 libsyntax-bb943c5a.rlib 907058 libterm-bb943c5a.rlib
2015-10-01move direct accesses of `node` to go through `as_local_node_id`, unlessNiko Matsakis-1/+1
they are being used as an opaque "position identifier"
2015-10-01move job of creating local-def-ids to ast-map (with a few stragglers)Niko Matsakis-1/+1
2015-09-16Use ast attributes every where (remove HIR attributes).Nick Cameron-12/+13
This could be a [breaking-change] if your lint or syntax extension (is that even possible?) uses HIR attributes or literals.
2015-09-03Add an intital HIR and lowering stepNick Cameron-19/+20
2015-08-24store the CodeExtent directly in FreeRegionAriel Ben-Yehuda-6/+1
this makes the code cleaner
2015-08-24Use a Vec instead of an HashMap for the scope hierarchyAriel Ben-Yehuda-17/+18
This increases regionck performance greatly - type-checking on librustc decreased from 9.1s to 8.1s. Because of Amdahl's law, total performance is improved only by about 1.5% (LLVM wizards, this is your opportunity to shine!). before: 576.91user 4.26system 7:42.36elapsed 125%CPU (0avgtext+0avgdata 1142192maxresident)k after: 566.50user 4.84system 7:36.84elapsed 125%CPU (0avgtext+0avgdata 1124304maxresident)k I am somewhat worried really need to find out why we have this Red Queen's Race going on here. Originally I suspected it may be a problem from RFC1214's warnings, but it seems to be an effect from other changes. However, the increase seems to be mostly in LLVM's time, so I guess it's the LLVM wizards' problem.
2015-08-24split ReInfer into ReVar and ReSkolemizedAriel Ben-Yehuda-1/+1
this should reduce the size of ty::Region to 24 bytes (from 32), and they are treated differently in most cases anyway.
2015-08-24fallout from moving def-idNiko Matsakis-1/+2
2015-08-12Add two new kinds of predicates, WellFormed and ObjectSafe.Niko Matsakis-0/+7
2015-08-06introduce an ADTDef struct for struct/enum definitionsAriel Ben-Yehuda-2/+2
2015-07-28remove `get_ident` and `get_name`, make `as_str` soundOliver Schneider-7/+6
2015-07-25Fix error message spansJared Roesch-2/+2
2015-07-24Introduce ClosureSubsts rather than just having random fields in theNiko Matsakis-3/+3
TyClosure variant; thread this through wherever closure substitutions are expected, which leads to a net simplification. Simplify trans treatment of closures in particular.
2015-07-24introduce a Vec<Ty> to TyClosure for storing upvar typesNiko Matsakis-1/+5
2015-07-14Transition to the new object lifetime defaults, replacing the oldNiko Matsakis-2/+0
defaults completely.
2015-07-10Rename TypeWithMutability to TypeAndMutJared Roesch-1/+1
2015-07-08Remove snake_case names from ty.rsJared Roesch-1/+1
2015-07-03Add a boolean flag to ExistentialBounds tracking whether theNiko Matsakis-0/+2
region-bound is expected to change in Rust 1.3, but don't use it for anything in this commit. Note that this is not a "significant" part of the type (it's not part of the formal model) so we have to normalize this away or trans starts to get confused because two equal types wind up with distinct LLVM types.
2015-07-03Code up the new lifetime default rules, but leave them disabledNiko Matsakis-4/+4
for now.
2015-06-23Remove the mostly unecessary ParamBounds structJared Roesch-15/+1
2015-06-12Split TyArray into TyArray and TySlice.Eli Friedman-5/+6
Arrays and slices are closely related, but not that closely; making the separation more explicit is generally more clear.
2015-06-12Cleanup: rename middle::ty::sty and its variants.Eli Friedman-22/+22
Use camel-case naming, and use names which actually make sense in modern Rust.
2015-04-30Stop using Rc in TraitRef and TraitDefAriel Ben-Yehuda-6/+6
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-17Create a struct to represent early-bound regionsNiko Matsakis-5/+5
2015-04-04Encode more precise scoping rules for function params.Felix S. Klock II-1/+3
Function params which outlive everything in the body (incl temporaries). Thus if we assign them their own `CodeExtent`, the region inference can properly show that it is sound to have temporaries with destructors that reference the parameters (because such temporaries will be dropped before the parameters are). This allows us to address issue 23338 in a clean way. As a drive-by, fix a mistake in the tyencode for `CodeExtent::BlockRemainder`.
2015-03-25rustc: Remove support for int/uintAlex Crichton-2/+2
This commit removes all parsing, resolve, and compiler support for the old and long-deprecated int/uint types.
2015-03-13Fallout of std::old_io deprecationAlex Crichton-0/+1
2015-03-03metadata: Implement relaxation of short RBML lengths.Kang Seonghoon-33/+35
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-02Remove the synthetic "region bound" from closures and instead update howNiko Matsakis-2/+1
type-outlives works for closure types so that it ensures that all upvars outlive the region in question. This gives the same guarantees but without introducing artificial regions (and gives better error messages to boot).
2015-02-24Remove bounds struct from TypeParameterDef. Bounds information is nowNiko Matsakis-5/+12
exclusively stored in the where clauses.
2015-02-24Remove ty_open and treat Unsized lvalues as *Unsized.Eduard Burtescu-3/+0
2015-02-16Detect and store object-lifetime-defaults.Niko Matsakis-0/+15
2015-02-11Added DestructionScope variant to CodeExtent, representing the areaFelix S. Klock II-1/+7
immediately surrounding a node that is a terminating_scope (e.g. statements, looping forms) during which the destructors run (the destructors for temporaries from the execution of that node, that is). Introduced DestructionScopeData newtype wrapper around ast::NodeId, to preserve invariant that FreeRegion and ScopeChain::BlockScope carry destruction scopes (rather than arbitrary CodeExtents). Insert DestructionScope and block Remainder into enclosing CodeExtents hierarchy. Add more doc for DestructionScope, complete with ASCII art. Switch to constructing DestructionScope rather than Misc in a number of places, mostly related to `ty::ReFree` creation, and use destruction-scopes of node-ids at various calls to liberate_late_bound_regions. middle::resolve_lifetime: Map BlockScope to DestructionScope in `fn resolve_free_lifetime`. Add the InnermostDeclaringBlock and InnermostEnclosingExpr enums that are my attempt to clarify the region::Context structure, and that later commmts build upon. Improve the debug output for `CodeExtent` attached to `ty::Region::ReScope`. Loosened an assertion in `rustc_trans::trans::cleanup` to account for `DestructionScope`. (Perhaps this should just be switched entirely over to `DestructionScope`, rather than allowing for either `Misc` or `DestructionScope`.) ---- Even though the DestructionScope is new, this particular commit should not actually change the semantics of any current code.
2015-02-02`for x in xs.iter()` -> `for x in &xs`Jorge Aparicio-8/+8
2015-01-27Add `CodeExtent::Remainder` variant; pre-req for new scoping/drop rules.Felix S. Klock II-1/+3
This new variant introduces finer-grain code extents, i.e. we now track that a binding lives only for a suffix of a block, and (importantly) will be dropped when it goes out of scope *before* the bindings that occurred earlier in the block. Both of these notions are neatly captured by marking the block (and each suffix) as an enclosing scope of the next suffix beneath it. This is work that is part of the foundation for issue #8861. (It actually has been seen in earlier posted pull requests; I have just factored it out into its own PR to ease my own rebasing.) ---- These finer grained scopes do mean that some code is newly rejected by `rustc`; for example: ```rust let mut map : HashMap<u8, &u8> = HashMap::new(); let tmp = Box::new(2); map.insert(43, &*tmp); ``` This will now fail to compile with a message that `*tmp` does not live long enough, because the scope of `tmp` is now strictly smaller than that of `map`, and the use of `&u8` in map's type requires that the borrowed references are all to data that live at least as long as the map. The usual fix for a case like this is to move the binding for `tmp` up above that of `map`; note that you can still leave the initialization in the original spot, like so: ```rust let tmp; let mut map : HashMap<u8, &u8> = HashMap::new(); tmp = box 2; map.insert(43, &*tmp); ``` Similarly, one can encounter an analogous situation with `Vec`: one would need to rewrite: ```rust let mut vec = Vec::new(); let tmp = 'c'; vec.push(&tmp); ``` as: ``` let tmp; let mut vec = Vec::new(); tmp = 'c'; vec.push(&tmp); ``` ---- In some corner cases, it does not suffice to reorder the bindings; in particular, when the types for both bindings need to reflect exactly the *same* code extent, and a parent/child relationship between them does not work. In pnkfelix's experience this has arisen most often when mixing uses of cyclic data structures while also allowing a lifetime parameter `'a` to flow into a type parameter context where the type is *invariant* with respect to the type parameter. An important instance of this is `arena::TypedArena<T>`, which is invariant with respect to `T`. (The reason that variance is relevant is this: *if* `TypedArena` were covariant with respect to its type parameter, then we could assign it the longer lifetime when it is initialized, and then convert it to a subtype (via covariance) with a shorter lifetime when necessary. But `TypedArena` is invariant with respect to its type parameter, and thus if `S` is a subtype of `T` (in particular, if `S` has a lifetime parameter that is shorter than that of `T`), then a `TypedArena<S>` is unrelated to `TypedArena<T>`.) Concretely, consider code like this: ```rust struct Node<'a> { sibling: Option<&'a Node<'a>> } struct Context<'a> { // because of this field, `Context<'a>` is invariant with respect to `'a`. arena: &'a TypedArena<Node<'a>>, ... } fn new_ctxt<'a>(arena: &'a TypedArena<Node<'a>>) -> Context<'a> { ... } fn use_ctxt<'a>(fcx: &'a Context<'a>) { ... } let arena = TypedArena::new(); let ctxt = new_ctxt(&arena); use_ctxt(&ctxt); ``` In these situations, if you try to introduce two bindings via two distinct `let` statements, each is (with this commit) assigned a distinct extent, and the region inference system cannot find a single region to assign to the lifetime `'a` that works for both of the bindings. So you get an error that `ctxt` does not live long enough; but moving its binding up above that of `arena` just shifts the error so now the compiler complains that `arena` does not live long enough. SO: What to do? The easiest fix in this case is to ensure that the two bindings *do* get assigned the same static extent, by stuffing both bindings into the same let statement, like so: ```rust let (arena, ctxt): (TypedArena, Context); arena = TypedArena::new(); ctxt = new_ctxt(&arena); use_ctxt(&ctxt); ``` Due to the new code rejections outlined above, this is a ... [breaking-change]
2015-01-26std: Rename Writer::write to Writer::write_allAlex Crichton-1/+1
In preparation for upcoming changes to the `Writer` trait (soon to be called `Write`) this commit renames the current `write` method to `write_all` to match the semantics of the upcoming `write_all` method. The `write` method will be repurposed to return a `usize` indicating how much data was written which differs from the current `write` semantics. In order to head off as much unintended breakage as possible, the method is being deprecated now in favor of a new name. [breaking-change]
2015-01-26Remove "unboxed" attribute in code referring to new closures.Eduard Burtescu-1/+1
2015-01-20Remove onceness & bounds - they don't do anything.Ariel Ben-Yehuda-9/+0
2015-01-20Kill TraitStoreAriel Ben-Yehuda-12/+0
2015-01-08Store deprecated status of i/u-suffixed literals.Huon Wilson-2/+2
2015-01-06syntax/rustc: implement isize/usizeCorey Richardson-2/+2
2015-01-05remove ty_closureJorge Aparicio-4/+0
2015-01-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-1/+1
2014-12-30Remove the def-id from type parameters. Having this def-id was bad for ↵Niko Matsakis-2/+2
several reasons: 1. Produced more unique types than is necessary. This increases memory consumption. 2. Linking the type parameter to its definition *seems* like a good idea, but it encourages reliance on the bounds listing. 3. It made pretty-printing harder and in particular was causing bad error messages when errors occurred before the `TypeParameterDef` entries were fully stored.
2014-12-30Integrate projection bounds to `ExistentialBounds` but do not use them for ↵Niko Matsakis-3/+8
anything.
2014-12-30Convert to use `Rc<TraitRef>` in object types (finally!).Niko Matsakis-2/+2