about summary refs log tree commit diff
path: root/src/librustc/middle/astencode.rs
AgeCommit message (Collapse)AuthorLines
2014-11-26/*! -> //!Steve Klabnik-69/+51
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-20Refactored new CodeExtent type for improved abstraction.Felix S. Klock II-4/+16
(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: fix fallout of adding the `'tcx` lifetime to `Ty`.Eduard Burtescu-121/+142
2014-11-19rustc: middle: rename `ty::t` to `Ty` and use it unqualified everywhere.Eduard Burtescu-14/+14
2014-11-18Switch the code to use De Bruijn indices rather than binder-ids.Niko Matsakis-2/+2
2014-11-18Move trans, back, driver, and back into a new crate, rustc_trans. Reduces ↵Niko Matsakis-1/+1
memory usage significantly and opens opportunities for more parallel compilation.
2014-11-17auto merge of #19027 : nick29581/rust/coercions-4, r=alexcrichtonbors-10/+10
The forwards compatible parts of #18645, rebased. Converts implicit coercions from `[T, ..n]` to `&[T]` into explicit references.
2014-11-17Fix fallout from coercion removalNick Cameron-10/+10
2014-11-16fallout from deprecating find_copy and get_copyAlexis Beingessner-2/+1
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-19/+23
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-13/+13
2014-11-05auto merge of #18546 : bkoropoff/rust/unboxed-closures-cross-crate, r=nick29581bors-8/+14
This fixes some metadata/AST encoding problems that lead to ICEs. The way this is currently handled will need revisiting if abstract return types are added, as unboxed closure types from extern crates could show up without being inlined into the local crate. Closes #16790 (I think this was fixed earlier by accident and just needed a test case) Closes #18378 Closes #18543 r? @pcwalton
2014-11-03rollup merge of #18506 : nikomatsakis/assoc-type-boundsAlex Crichton-3/+4
2014-11-03rollup merge of #18318 : arielb1/transmute-cleanupAlex Crichton-33/+10
2014-11-03Add a 4th space for associated types defined in a trait (currently unused)Niko Matsakis-1/+2
2014-11-03Restructure AST so that the associated type definition carriesNiko Matsakis-2/+2
bounds like any other "type parameter".
2014-11-03Clean-up transmutes in librustcAriel Ben-Yehuda-33/+10
None of them would break by implementation-defined struct layout, but one would break with strict lifetime aliasing, and the rest are just ugly code.
2014-11-02Treat cross-crate unboxed closure def IDs consistentlyBrian Koropoff-2/+6
Always translate the ID into the local crate ID space since presently the only way to encounter an unboxed closure type from another crate is to inline once of its functions. This may need to change if abstract return types are added. Closes #18543
2014-11-02Fix decoding of unboxed closure kindsBrian Koropoff-6/+8
Closes #18378. Note that cross-crate unboxed closures are still unimplemented and will fail to work currently.
2014-11-01Fix def ID mapping for method defsBrian Koropoff-11/+5
This prevents def IDs with the wrong crate ID from showing up when using UFCS. Closes #18501
2014-11-01Remove FnStyle from DefFn and DefStaticMethodNick Cameron-4/+3
2014-10-29Rename fail! to panic!Steve Klabnik-8/+8
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-24Add a lint for not using field pattern shorthandsP1start-2/+2
Closes #17792.
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-1/+1
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-16Fix soundness bug in treatment of closure upvars by regionckBrian Koropoff-1/+2
- 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-16librustc: Remove all uses of {:?}.Luqman Aden-2/+2
2014-10-15Allow self as an arg in extension methodsNick Cameron-2/+2
2014-10-09rustc: Add `const` globals to the languageAlex Crichton-0/+1
This change is an implementation of [RFC 69][rfc] which adds a third kind of global to the language, `const`. This global is most similar to what the old `static` was, and if you're unsure about what to use then you should use a `const`. The semantics of these three kinds of globals are: * A `const` does not represent a memory location, but only a value. Constants are translated as rvalues, which means that their values are directly inlined at usage location (similar to a #define in C/C++). Constant values are, well, constant, and can not be modified. Any "modification" is actually a modification to a local value on the stack rather than the actual constant itself. Almost all values are allowed inside constants, whether they have interior mutability or not. There are a few minor restrictions listed in the RFC, but they should in general not come up too often. * A `static` now always represents a memory location (unconditionally). Any references to the same `static` are actually a reference to the same memory location. Only values whose types ascribe to `Sync` are allowed in a `static`. This restriction is in place because many threads may access a `static` concurrently. Lifting this restriction (and allowing unsafe access) is a future extension not implemented at this time. * A `static mut` continues to always represent a memory location. All references to a `static mut` continue to be `unsafe`. This is a large breaking change, and many programs will need to be updated accordingly. A summary of the breaking changes is: * Statics may no longer be used in patterns. Statics now always represent a memory location, which can sometimes be modified. To fix code, repurpose the matched-on-`static` to a `const`. static FOO: uint = 4; match n { FOO => { /* ... */ } _ => { /* ... */ } } change this code to: const FOO: uint = 4; match n { FOO => { /* ... */ } _ => { /* ... */ } } * Statics may no longer refer to other statics by value. Due to statics being able to change at runtime, allowing them to reference one another could possibly lead to confusing semantics. If you are in this situation, use a constant initializer instead. Note, however, that statics may reference other statics by address, however. * Statics may no longer be used in constant expressions, such as array lengths. This is due to the same restrictions as listed above. Use a `const` instead. [breaking-change] [rfc]: https://github.com/rust-lang/rfcs/pull/246
2014-09-30Fixes ICE when using reexported unit-like structsMichael Kainer-1/+1
Fixes that unit-like structs cannot be used if they are reexported and used in another crate. The compiler fails with an ICE, because unit-like structs are exported as DefFn and the expression `UnitStruct` is interpreted as function pointer instead of a call to the constructor. To resolve this ambiguity tuple-like struct constructors are now exported as CtorFn. When `rustc::metadata::decoder` finds a CtorFn it sets a new flag `is_ctor` in DefFn to true. Relevant changes are in `rustc::metadata::{encoder, decoder}` and in `rustc::middle::ty`. Closes #12660 and #16973.
2014-09-24Remove dead code from librustcJakub Wieczorek-73/+0
2014-09-19rollup merge of #17338 : nick29581/variants-namespaceAlex Crichton-18/+18
2014-09-19rollup merge of #17314 : eddyb/span-no-gcAlex Crichton-1/+1
2014-09-19Add enum variants to the type namespaceNick Cameron-18/+18
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-18rustc: remove Gc<Def> and depth from DefUpvar.Eduard Burtescu-4/+1
2014-09-18rustc: move type definitions from middle::freevars to middle::ty.Eduard Burtescu-15/+14
2014-09-18rustc: add a closure depth to DefUpvar.Eduard Burtescu-1/+2
2014-09-18rustc: remove BindingMode from DefLocal.Eduard Burtescu-1/+1
2014-09-18rustc: remove DefArg and DefBinding in favor of DefLocal.Eduard Burtescu-2/+0
2014-09-18Fix fallout in tests from removing the use of Gc in ExpnInfo.Eduard Burtescu-1/+1
2014-09-17librustc: Implement associated types behind a feature gate.Patrick Walton-3/+18
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-17rustdoc: Correctly distinguish enums and typesP1start-1/+1
This is done by adding a new field to the `DefTy` variant of `middle::def::Def`, which also clarifies an error message in the process. Closes #16712.
2014-09-16Fallout from renamingAaron Turon-5/+5
2014-09-15trans -- stop tracking vtables precisely, instead recompute as needed.Niko Matsakis-60/+180
2014-09-14rustc: fix fallout from using ptr::P.Eduard Burtescu-287/+263
2014-09-09rollup merge of #17040 : kmcallister/borrow-extctxtAlex Crichton-4/+4
2014-09-08quote: Explicitly borrow the ExtCtxtKeegan McAllister-4/+4
Fixes #16992.
2014-09-08rustc: fix fallout from the addition of a 'tcx lifetime on tcx.Eduard Burtescu-12/+12
2014-09-02DST raw pointers - *-pointers are fat pointersNick Cameron-4/+21
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-5/+33