summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2016-04-07Auto merge of #32016 - nikomatsakis:incr-comp-save, r=mwbors-3/+3
Save/load incremental compilation dep graph Contains the code to serialize/deserialize the dep graph to disk between executions. We also hash the item contents and compare to the new hashes. Also includes a unit test harness. There are definitely some known limitations, such as https://github.com/rust-lang/rust/issues/32014 and https://github.com/rust-lang/rust/issues/32015, but I am leaving those for follow-up work. Note that this PR builds on https://github.com/rust-lang/rust/pull/32007, so the overlapping commits can be excluded from review. r? @michaelwoerister
2016-04-07Make `hir::Visibility` non-copyable and add `ty::Visibility`Jeffrey Seyfried-33/+42
2016-04-06make an incremental crateNiko Matsakis-3/+3
for now, this houses `svh` and the code to check `assert_dep_graph` is sane
2016-04-06rustc: retire hir::map's paths.Eduard Burtescu-155/+14
2016-04-06rustc: move some maps from ty to hir.Eduard Burtescu-7/+7
2016-04-06rustc: move middle::{def,def_id,pat_util} to hir.Eduard Burtescu-13/+13
2016-04-06syntax: dismantle ast_util.Eduard Burtescu-8/+9
2016-04-06rustc: move rustc_front to rustc::hir.Eduard Burtescu-30/+28
2016-03-31librustc_metadata: use bug!(), span_bug!()Benjamin Herr-74/+62
2016-03-30Auto merge of #32439 - jseyfried:visible_suggestions, r=nrcbors-4/+63
diagnostics: make paths to external items more visible This PR changes the reported path for an external item so that it is visible from at least one local module (i.e. it does not use any inaccessible external modules) if possible. If the external item's crate was declared with an `extern crate`, the path is guarenteed to use the `extern crate`. Fixes #23224, fixes #23355, fixes #26635, fixes #27165. r? @nrc
2016-03-30Add method `visible_item_path` to `CStore`Jeffrey Seyfried-4/+63
2016-03-30rename `rustc_const_eval` to `rustc_const_math`Oliver Schneider-3/+3
2016-03-27rustc: move cfg, infer, traits and ty from middle to top-level.Eduard Burtescu-21/+21
2016-03-27rustc: move middle::subst into middle::ty.Eduard Burtescu-8/+8
2016-03-25renumber error from E0522 to E0523Niko Matsakis-2/+2
another name was added in the meantime
2016-03-25Correections due to refactoring .Niko Matsakis-2/+2
2016-03-25pacify the merciless tidy: s/E0521/E0522Niko Matsakis-2/+2
Gah. I always find it confusing that make tidy gives me the highest error code, but not the **next** error code.
2016-03-25renumber diagnostic to avoid conflictNiko Matsakis-2/+2
specialization nabbed E0520
2016-03-25track the extern-crate def-id rather than pathNiko Matsakis-93/+87
We used to track, for each crate, a path that led to the extern-crate that imported it. Instead of that, track the def-id of the extern crate, along with a bit more information, and derive the path on the fly.
2016-03-25store krate information more uniformlyNiko Matsakis-7/+3
make DefPath store krate and enable uniform access to crate_name/crate_disambiguator
2016-03-25track def-id for inlined itemsNiko Matsakis-11/+31
2016-03-25Add a "link-guard" to avoid accidentally linking to a wrong dylib at runtime.Michael Woerister-6/+11
We want to prevent compiling something against one version of a dynamic library and then, at runtime accidentally using a different version of the dynamic library. With the old symbol-naming scheme this could not happen because every symbol had the SVH in it and you'd get an error by the dynamic linker when using the wrong version of a dylib. With the new naming scheme this isn't the case any more, so this patch adds the "link-guard" to prevent this error case. This is implemented as follows: - In every crate that we compile, we emit a function called "__rustc_link_guard_<crate-name>_<crate-svh>" - The body of this function contains calls to the "__rustc_link_guard" functions of all dependencies. - An executable contains a call to it's own "__rustc_link_guard" function. As a consequence the "__rustc_link_guard" function call graph mirrors the crate graph and the dynamic linker will fail if a wrong dylib is loaded somewhere because its "__rustc_link_guard" function will contain a different SVH in its name.
2016-03-25Make the compiler emit an error if the crate graph contains two crates with ↵Michael Woerister-10/+58
the same crate-name and crate-salt but different SVHs.
2016-03-25Compute a salt from arguments passed via -Cmetadata.Michael Woerister-0/+19
2016-03-25Make CrateStore::crate_name() return an InternedString to avoid unnecessary ↵Michael Woerister-2/+2
allocations.
2016-03-25CrateStore: Allow for custom def_id_to_string mappings in encode_type().Michael Woerister-16/+23
2016-03-24remove ErasedRegions from substitutionsNiko Matsakis-26/+3
This hack has long since outlived its usefulness; the transition to trans passing around full substitutions is basically done. Instead of `ErasedRegions`, just supply substitutions with a suitable number of `'static` entries, and invoke `erase_regions` when needed (the latter of which we already do).
2016-03-22sprinkle feature gates here and thereJorge Aparicio-0/+1
2016-03-22try! -> ?Jorge Aparicio-6/+6
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-17trans: Rename MonoId to Instance and start using it in more places.Eduard Burtescu-8/+12
2016-03-17metadata: Constrain FoundAst::FoundParent to an Item.Eduard Burtescu-94/+67
2016-03-17metedata: Remove the unnecessary indirection to astencode.Eduard Burtescu-80/+18
2016-03-14Fixes after a rebaseAaron Turon-1/+1
2016-03-14Move specialization graph walks to iterators; make associated typeAaron Turon-1/+8
projection sensitive to "mode" (most importantly, trans vs middle). This commit introduces several pieces of iteration infrastructure in the specialization graph data structure, as well as various helpers for finding the definition of a given item, given its kind and name. In addition, associated type projection is now *mode-sensitive*, with three possible modes: - **Topmost**. This means that projection is only possible if there is a non-`default` definition of the associated type directly on the selected impl. This mode is a bit of a hack: it's used during early coherence checking before we have built the specialization graph (and therefore before we can walk up the specialization parents to find other definitions). Eventually, this should be replaced with a less "staged" construction of the specialization graph. - **AnyFinal**. Projection succeeds for any non-`default` associated type definition, even if it is defined by a parent impl. Used throughout typechecking. - **Any**. Projection always succeeds. Used by trans. The lasting distinction here is between `AnyFinal` and `Any` -- we wish to treat `default` associated types opaquely for typechecking purposes. In addition to the above, the commit includes a few other minor review fixes.
2016-03-14Initial incorporation of specialization:Aaron Turon-1/+26
- Rewrites the overlap checker to instead build up a specialization graph, checking for overlap errors in the process. - Use the specialization order during impl selection. This commit does not yet handle associated types correctly, and assumes that all items are `default` and are overridden.
2016-03-14Hook `default` keyword into metadata and carry data through to typeckAaron Turon-0/+30
2016-03-14Auto merge of #30587 - oli-obk:eager_const_eval2, r=nikomatsakisbors-12/+19
typestrong const integers ~~It would be great if someone could run crater on this PR, as this has a high danger of breaking valid code~~ Crater ran. Good to go. ---- So this PR does a few things: 1. ~~const eval array values when const evaluating an array expression~~ 2. ~~const eval repeat value when const evaluating a repeat expression~~ 3. ~~const eval all struct and tuple fields when evaluating a struct/tuple expression~~ 4. remove the `ConstVal::Int` and `ConstVal::Uint` variants and replace them with a single enum (`ConstInt`) which has variants for all integral types * `usize`/`isize` are also enums with variants for 32 and 64 bit. At creation and various usage steps there are assertions in place checking if the target bitwidth matches with the chosen enum variant 5. enum discriminants (`ty::Disr`) are now `ConstInt` 6. trans has its own `Disr` type now (newtype around `u64`) This obviously can't be done without breaking changes (the ones that are noticable in stable) We could probably write lints that find those situations and error on it for a cycle or two. But then again, those situations are rare and really bugs imo anyway: ```rust let v10 = 10 as i8; let v4 = 4 as isize; assert_eq!(v10 << v4 as usize, 160 as i8); ``` stops compiling because 160 is not a valid i8 ```rust struct S<T, S> { a: T, b: u8, c: S } let s = S { a: 0xff_ff_ff_ffu32, b: 1, c: 0xaa_aa_aa_aa as i32 }; ``` stops compiling because `0xaa_aa_aa_aa` is not a valid i32 ---- cc @eddyb @pnkfelix related: https://github.com/rust-lang/rfcs/issues/1071
2016-03-14rustbuildOliver Schneider-0/+1
2016-03-10Auto merge of #32121 - GuillaumeGomez:help_e0514, r=cmrbors-8/+10
Add help for E0514 I fixed #30622. r? @arielb1
2016-03-10typestrong constant integersOliver Schneider-12/+18
2016-03-09Auto merge of #31710 - eddyb:reify, r=nikomatsakisbors-7/+10
Distinguish fn item types to allow reification from nothing to fn pointers. The first commit is a rebase of #26284, except for files that have moved since. This is a [breaking-change], due to: * each FFI function has a distinct type, like all other functions currently do * all generic parameters on functions are recorded in their item types, e.g.: `size_of::<u8>` & `size_of::<i8>`'s types differ despite their identical signature. * function items are zero-sized, which will stop transmutes from working on them The first two cases are handled in most cases with the new coerce-unify logic, which will combine incompatible function item types into function pointers, at the outer-most level of if-else chains, match arms and array literals. The last case is specially handled during type-checking such that transmutes from a function item type to a pointer or integer type will continue to work for another release cycle, but are being linted against. To get rid of warnings and ensure your code will continue to compile, cast to a pointer before transmuting.
2016-03-09Track fn type and lifetime parameters in TyFnDef.Eduard Burtescu-5/+7
2016-03-09Split TyBareFn into TyFnDef and TyFnPtr.Eli Friedman-7/+8
There's a lot of stuff wrong with the representation of these types: TyFnDef doesn't actually uniquely identify a function, TyFnPtr is used to represent method calls, TyFnDef in the sub-expression of a cast isn't correctly reified, and probably some other stuff I haven't discovered yet. Splitting them seems like the right first step, though.
2016-03-08Add help for E0514ggomez-8/+10
2016-03-06Add method `visibility` to `CrateStore`Jeffrey Seyfried-0/+9
2016-03-03Rename middle::ty::ctxt to TyCtxtJeffrey Seyfried-70/+70
2016-03-03Auto merge of #31824 - jseyfried:privacy_in_resolve, r=nikomatsakisbors-5/+2
This PR privacy checks paths as they are resolved instead of in `librustc_privacy` (fixes #12334 and fixes #31779). This removes the need for the `LastPrivate` system introduced in PR #9735, the limitations of which cause #31779. This PR also reports privacy violations in paths to intra- and inter-crate items the same way -- it always reports the first inaccessible segment of the path. Since it fixes #31779, this is a [breaking-change]. For example, the following code would break: ```rust mod foo { pub use foo::bar::S; mod bar { // `bar` should be private to `foo` pub struct S; } } impl foo::S { fn f() {} } fn main() { foo::bar::S::f(); // This is now a privacy error } ``` r? @alexcrichton
2016-03-02Move span into `StructField`Vadim Petrochenkov-2/+2
+ some cleanup in rustdoc
2016-03-02Use numeric field `Name`s ("0", "1" etc) for positional fieldsVadim Petrochenkov-7/+10
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-1/+0
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866