summary refs log tree commit diff
path: root/src/librustc/metadata/tyencode.rs
AgeCommit message (Collapse)AuthorLines
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
2014-12-30Implement associated type projection and normalization.Niko Matsakis-4/+24
2014-12-30More rebase fixes.Huon Wilson-7/+7
2014-12-29Store Substs in an arena in the tcx.Huon Wilson-1/+1
This current inflates memory use more than 3 times.
2014-12-22Adjust metadata for new fields and enum variants. Yawn.Niko Matsakis-1/+6
2014-12-20rustc: use Ty instead of passing ty::sty around.Eduard Burtescu-100/+97
2014-12-19Make all predicates higher-ranked, not just trait references.Niko Matsakis-3/+3
2014-12-19Centralize on using `Binder` to introduce new binding levels, rather than ↵Niko Matsakis-7/+7
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-3/+3
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-1/+1
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-14Rename FnStyle trait to Unsafety.Niko Matsakis-5/+5
2014-12-13librustc: use unboxed closuresJorge Aparicio-5/+9
2014-12-12Switch to using predicates to drive checking. Correct various tests --Niko Matsakis-0/+27
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-11-20Refactored new CodeExtent type for improved abstraction.Felix S. Klock II-3/+14
(Previously, statically identifiable scopes/regions were solely identified with NodeId's; this refactoring prepares for a future where that 1:1 correspondence does not hold.)
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-17/+26
2014-11-19rustc: middle: rename `ty::t` to `Ty` and use it unqualified everywhere.Eduard Burtescu-3/+3
2014-11-19rustc: avoid `use`-ing `syntax::ast::*`.Eduard Burtescu-22/+21
2014-11-18Switch the code to use De Bruijn indices rather than binder-ids.Niko Matsakis-2/+2
2014-11-16Try to remove ty_nil, some kind of error in exhaustiveness checkingNiko Matsakis-1/+0
2014-11-10Use FnvHashMap instead of HashMap in rustcAriel Ben-Yehuda-2/+2
2014-11-07Make TyTrait embed a `TraitRef`, so that when we extend TraitRef, it ↵Niko Matsakis-7/+4
naturally carries over to object types. I wanted to embed an `Rc<TraitRef>`, but I was foiled by the current static rules, which prohibit non-Sync values from being stored in static locations. This means that the constants for `ty_int` and so forth cannot be initialized.
2014-11-06Fallout from collection conventionsAlexis Beingessner-1/+1
2014-10-28Remove ty_bot from the type systemJakub Bukaj-2/+8
We now instead use a fresh variable for expressions that diverge.
2014-10-27Fix monomorphization of unboxed closuresBrian Koropoff-2/+4
This adds a `Substs` field to `ty_unboxed_closure` and plumbs basic handling of it throughout the compiler. trans now correctly monomorphizes captured free variables and llvm function defs. This fixes uses of unboxed closures which reference a free type or region parameter from their environment in either their signature or free variables. Closes #16791
2014-10-22Part of #6993. Moved a bunch of uses of Ident to NameJonathan S-1/+1
2014-10-16Fix soundness bug in treatment of closure upvars by regionckBrian Koropoff-0/+3
- Unify the representations of `cat_upvar` and `cat_copied_upvar` - In `link_reborrowed_region`, account for the ability of upvars to change their mutability due to later processing. A map of recursive region links we may want to establish in the future is maintained, with the links being established when the kind of the borrow is adjusted. - When categorizing upvars, add an explicit deref that represents the closure environment pointer for closures that do not take the environment by value. The region for the implicit pointer is an anonymous free region type introduced for this purpose. This creates the necessary constraint to prevent unsound reborrows from the environment. - Add a note to categorizations to make it easier to tell when extra dereferences have been inserted by an upvar without having to perform deep pattern matching. - Adjust borrowck to deal with the changes. Where `cat_upvar` and `cat_copied_upvar` were previously treated differently, they are now both treated roughly like local variables within the closure body, as the explicit derefs now ensure proper behavior. However, error diagnostics had to be changed to explicitly look through the extra dereferences to avoid producing confusing messages about references not present in the source code. Closes issue #17403. Remaining work: - The error diagnostics that result from failed region inference are pretty inscrutible and should be improved. Code like the following is now rejected: let mut x = 0u; let f = || &mut x; let y = f(); let z = f(); // multiple mutable references to the same location This also breaks code that uses a similar construction even if it does not go on to violate aliasability semantics. Such code will need to be reworked in some way, such as by using a capture-by-value closure type. [breaking-change]
2014-10-02rustc: remove support for Gc.Eduard Burtescu-1/+0
2014-09-17librustc: Implement associated types behind a feature gate.Patrick Walton-0/+2
The implementation essentially desugars during type collection and AST type conversion time into the parameter scheme we have now. Only fully qualified names--e.g. `<T as Foo>::Bar`--are supported.
2014-09-16Generalize lifetime bounds on type parameters to support multipleNiko Matsakis-1/+1
lifetime bounds. This doesn't really cause any difficulties, because we already had to accommodate the fact that multiple implicit bounds could accumulate. Object types still require precisely one lifetime bound. This is a pre-step towards generalized where clauses (once you have lifetime bounds in where clauses, it is harder to restrict them to exactly one).
2014-09-08rustc: fix fallout from the addition of a 'tcx lifetime on tcx.Eduard Burtescu-2/+2
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-12/+23
2014-08-26DST coercions and DST structsNick Cameron-2/+5
[breaking-change] 1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code. 2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible. 3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
2014-08-14librustc: Tie up loose ends in unboxed closures.Patrick Walton-1/+2
This patch primarily does two things: (1) it prevents lifetimes from leaking out of unboxed closures; (2) it allows unboxed closure type notation, call notation, and construction notation to construct closures matching any of the three traits. This breaks code that looked like: let mut f; { let x = &5i; f = |&mut:| *x + 10; } Change this code to avoid having a reference escape. For example: { let x = &5i; let mut f; // <-- move here to avoid dangling reference f = |&mut:| *x + 10; } I believe this is enough to consider unboxed closures essentially implemented. Further issues (for example, higher-rank lifetimes) should be filed as followups. Closes #14449. [breaking-change]
2014-08-07Rename `Share` to `Sync`Alex Crichton-1/+1
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use` statement, but the `NoShare` struct is no longer part of `std::kinds::marker` due to #12660 (the build cannot bootstrap otherwise). All code referencing the `Share` trait should now reference the `Sync` trait, and all code referencing the `NoShare` type should now reference the `NoSync` type. The functionality and meaning of this trait have not changed, only the naming. Closes #16281 [breaking-change]
2014-07-31Move SeekableMemWriter into librbmlErick Tryzelaar-1/+1
2014-07-29remove seek from std::io::MemWriter, add SeekableMemWriter to librustcErick Tryzelaar-22/+23
Not all users of MemWriter need to seek, but having MemWriter seekable adds between 3-29% in overhead in certain circumstances. This fixes that performance gap by making a non-seekable MemWriter, and creating a new SeekableMemWriter for those circumstances when that functionality is actually needed. ``` test io::mem::test::bench_buf_reader ... bench: 682 ns/iter (+/- 85) test io::mem::test::bench_buf_writer ... bench: 580 ns/iter (+/- 57) test io::mem::test::bench_mem_reader ... bench: 793 ns/iter (+/- 99) test io::mem::test::bench_mem_writer_001_0000 ... bench: 48 ns/iter (+/- 27) test io::mem::test::bench_mem_writer_001_0010 ... bench: 65 ns/iter (+/- 27) = 153 MB/s test io::mem::test::bench_mem_writer_001_0100 ... bench: 132 ns/iter (+/- 12) = 757 MB/s test io::mem::test::bench_mem_writer_001_1000 ... bench: 802 ns/iter (+/- 151) = 1246 MB/s test io::mem::test::bench_mem_writer_100_0000 ... bench: 481 ns/iter (+/- 28) test io::mem::test::bench_mem_writer_100_0010 ... bench: 1957 ns/iter (+/- 126) = 510 MB/s test io::mem::test::bench_mem_writer_100_0100 ... bench: 8222 ns/iter (+/- 434) = 1216 MB/s test io::mem::test::bench_mem_writer_100_1000 ... bench: 82496 ns/iter (+/- 11191) = 1212 MB/s test io::mem::test::bench_seekable_mem_writer_001_0000 ... bench: 48 ns/iter (+/- 2) test io::mem::test::bench_seekable_mem_writer_001_0010 ... bench: 64 ns/iter (+/- 2) = 156 MB/s test io::mem::test::bench_seekable_mem_writer_001_0100 ... bench: 129 ns/iter (+/- 7) = 775 MB/s test io::mem::test::bench_seekable_mem_writer_001_1000 ... bench: 801 ns/iter (+/- 159) = 1248 MB/s test io::mem::test::bench_seekable_mem_writer_100_0000 ... bench: 711 ns/iter (+/- 51) test io::mem::test::bench_seekable_mem_writer_100_0010 ... bench: 2532 ns/iter (+/- 227) = 394 MB/s test io::mem::test::bench_seekable_mem_writer_100_0100 ... bench: 8962 ns/iter (+/- 947) = 1115 MB/s test io::mem::test::bench_seekable_mem_writer_100_1000 ... bench: 85086 ns/iter (+/- 11555) = 1175 MB/s ``` [breaking-change]
2014-07-18librustc: Implement unboxed closures with mutable receiversPatrick Walton-1/+5
2014-07-17librustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,Patrick Walton-1/+1
except where trait objects are involved. Part of issue #15349, though I'm leaving it open for trait objects. Cross borrowing for trait objects remains because it is needed until we have DST. This will break code like: fn foo(x: &int) { ... } let a = box 3i; foo(a); Change this code to: fn foo(x: &int) { ... } let a = box 3i; foo(&*a); [breaking-change]
2014-07-05Refactored VecPerParamSpace to hide exposure of `Vec` representation.Felix S. Klock II-1/+1
This basically meant changing the interface so that no borrowed `&Vec` is exposed, by hiding `fn get_vec` and `fn get_mut_vec` and revising `fn all_vecs`. Instead, clients should use one of the other methods; `get_slice`, `pop`, `truncate`, `replace`, `push_all`, or `is_empty_in`, which should work for any case currently used in rustc.
2014-06-24Remove the quad_precision_float feature gateAlex Crichton-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-18Remove TraitStore from ty_traitNick Cameron-2/+0
Use ty_rptr/ty_uniq(ty_trait) rather than TraitStore to represent trait types. Also addresses (but doesn't close) #12470. Part of the work towards DST (#12938). [breaking-change] lifetime parameters in `&mut trait` are now invariant. They used to be contravariant.
2014-06-15Register new snapshotsAlex Crichton-25/+0
2014-06-13Introduce VecPerParamSpace and use it to represent sets of types andNiko Matsakis-18/+30
parameters This involves numerous substeps: 1. Treat Self same as any other parameter. 2. No longer compute offsets for method parameters. 3. Store all generic types (both trait/impl and method) with a method, eliminating odd discrepancies. 4. Stop doing unspeakable things to static methods and instead just use the natural types, now that we can easily add the type parameters from trait into the method's polytype. 5. No doubt some more. It was hard to separate these into distinct commits. Fixes #13564