about summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2018-12-26Store `Ident` rather than just `Name` in HIR types `Item` and `ForeignItem`.Alexander Regueiro-1/+1
2018-12-25Remove licensesMark Rousskov-170/+0
2018-12-12Remove `Session::sysroot()`.Nicholas Nethercote-1/+1
Instead of maybe storing its own sysroot and maybe deferring to the one in `Session::opts`, just clone the latter when necessary so one is always directly available. This removes the need for the getter.
2018-12-08Auto merge of #56616 - estebank:issue-56539, r=davidtwcobors-2/+2
Encode `TraitAlias` as if they were `Trait` Fix #56539.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-4/+4
2018-12-07Encode `TraitAlias` as if they were `Trait`Esteban Küber-2/+2
2018-12-06Use a function to access the Hir map to be able to turn it into a query laterJohn Kåre Alsaker-52/+52
2018-12-04cleanup: remove static lifetimes from constsljedrz-1/+1
2018-11-30proc_macro: move to a dependency of libtest.Eduard-Mihai Burtescu-1/+0
2018-11-30proc_macro: introduce a "bridge" between clients (proc macros) and servers ↵Eduard-Mihai Burtescu-57/+44
(compiler front-ends).
2018-11-27remove uses of feature gateMark Mansi-1/+0
2018-11-21rustc: remove {FxHash,Node,DefId,HirId,ItemLocal}{Map,Set} "constructor" fns.Eduard-Mihai Burtescu-1/+1
2018-11-15Rollup merge of #55778 - nnethercote:LrcPreds, r=eddybPietro Albini-3/+3
Wrap some query results in `Lrc`. So that the frequent clones in `try_get` are cheaper.
2018-11-14Use `Mmap` to open the rmeta file.Nicholas Nethercote-4/+28
Because those files are quite large, contribute significantly to peak memory usage, but only a small fraction of the data is ever read.
2018-11-14Wrap some query results in `Lrc`.Nicholas Nethercote-3/+3
So that the frequent clones in `try_get` are cheaper. Fixes #54274.
2018-11-12Use type safe `VariantIdx` instead of `usize` everywhereOliver Scherer-5/+6
2018-11-11std: Delete the `alloc_system` crateAlex Crichton-14/+9
This commit deletes the `alloc_system` crate from the standard distribution. This unstable crate is no longer needed in the modern stable global allocator world, but rather its functionality is folded directly into the standard library. The standard library was already the only stable location to access this crate, and as a result this should not affect any stable code.
2018-11-11rustc: Clean up allocator injection logicAlex Crichton-96/+17
This commit cleans up allocator injection logic found in the compiler around selecting the global allocator. It turns out that now that jemalloc is gone the compiler never actually injects anything! This means that basically everything around loading crates here and there can be easily pruned. This also removes the `exe_allocation_crate` option from custom target specs as it's no longer used by the compiler anywhere.
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-1/+1
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-1/+1
2018-11-04Auto merge of #55349 - bjorn3:rustc_mir_collect_and_partition_mono_items, ↵bors-5/+31
r=oli-obk Move collect_and_partition_mono_items to rustc_mir Most of the logic of it is inside rustc_mir anyway. Also removes the single function crate rustc_metadata_utils. Based on #55225
2018-11-03Remove rustc_metadata_utils, which contains only one functionbjorn3-5/+31
2018-10-31Make `-Z ls` list the actual filename of external dependenciesAidan Hobson Sayers-1/+1
2018-10-26Auto merge of #54626 - alexcrichton:dwarf-generics, r=michaelwoeristerbors-24/+18
rustc: Tweak filenames encoded into metadata This commit is a fix for #54408 where on nightly right now whenever generics are inlined the path name listed for the inlined function's debuginfo is a relative path to the cwd, which surely doesn't exist! Previously on beta/stable the debuginfo mentioned an absolute path which still didn't exist, but more predictably didn't exist. The change between stable/nightly is that nightly is now compiled with `--remap-path-prefix` to give a deterministic prefix to all rustc-generated paths in debuginfo. By using `--remap-path-prefix` the previous logic would recognize that the cwd was remapped, causing the original relative path name of the standard library to get emitted. If `--remap-path-prefix` *wasn't* passed in then the logic would create an absolute path name and then create a new source file entry. The fix in this commit is to apply the "recreate the source file entry with an absolute path" logic a bit more aggresively. If the source file's name was remapped then we don't touch it, but otherwise we always take the working dir (which may have been remapped) and then join it to the file to ensure that we process all relative file names as well. The end result is that the standard library should have an absolute path for all file names in debuginfo (using our `--remap-path-prefix` argument) as it does on stable after this patch. Closes #54408
2018-10-23fix typos in various placesMatthias Krüger-1/+1
2018-10-20Auto merge of #55014 - ljedrz:lazyboye_unwraps, r=matthewjasperbors-1/+1
Prefer unwrap_or_else to unwrap_or in case of function calls/allocations The contents of `unwrap_or` are evaluated eagerly, so it's not a good pick in case of function calls and allocations. This PR also changes a few `unwrap_or`s with `unwrap_or_default`. An added bonus is that in some cases this change also reveals if the object it's called on is an `Option` or a `Result` (based on whether the closure takes an argument).
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-2/+2
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-11/+11
2018-10-19Prefer unwrap_or_else to unwrap_or in case of function calls/allocationsljedrz-1/+1
2018-10-03Only promote calls to `#[rustc_promotable]` const fnsOliver Schneider-16/+2
2018-09-30Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrumbors-1/+1
Bump to 1.31.0 and bootstrap from 1.30 beta Closes #54594.
2018-09-28Auto merge of #54338 - orium:fix-macro-inc-comp, r=nrcbors-6/+12
Use full name to identify a macro in a `FileName`. Before this two macros with same name would be indistinguishable inside a `FileName`. This caused a bug in incremental compilation (see #53097) since two different macros would map out to the same `StableFilemapId`. Fixes #53097. r? @nrc
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-1/+1
2018-09-27rustc: Tweak filenames encoded into metadataAlex Crichton-24/+18
This commit is a fix for #54408 where on nightly right now whenever generics are inlined the path name listed for the inlined function's debuginfo is a relative path to the cwd, which surely doesn't exist! Previously on beta/stable the debuginfo mentioned an absolute path which still didn't exist, but more predictably didn't exist. The change between stable/nightly is that nightly is now compiled with `--remap-path-prefix` to give a deterministic prefix to all rustc-generated paths in debuginfo. By using `--remap-path-prefix` the previous logic would recognize that the cwd was remapped, causing the original relative path name of the standard library to get emitted. If `--remap-path-prefix` *wasn't* passed in then the logic would create an absolute path name and then create a new source file entry. The fix in this commit is to apply the "recreate the source file entry with an absolute path" logic a bit more aggresively. If the source file's name was remapped then we don't touch it, but otherwise we always take the working dir (which may have been remapped) and then join it to the file to ensure that we process all relative file names as well. The end result is that the standard library should have an absolute path for all file names in debuginfo (using our `--remap-path-prefix` argument) as it does on stable after this patch. Closes #54408
2018-09-25Auto merge of #53693 - scottmcm:marker-trait-attribute, r=nikomatsakisbors-0/+4
Support an explicit annotation for marker traits From the tracking issue for rust-lang/rfcs#1268: > It seems obvious that we should make a `#[marker]` annotation. ~ https://github.com/rust-lang/rust/issues/29864#issuecomment-368959441 This PR allows you to put `#[marker]` on a trait, at which point: - [x] The trait must not have any items ~~All of the trait's items must have defaults~~ - [x] Any impl of the trait must be empty (not override any items) - [x] But impls of the trait are allowed to overlap r? @nikomatsakis
2018-09-22avoid loading constructor attributes in AdtDef decodingAriel Ben-Yehuda-2/+6
During metadata loading, the AdtDefs for every ADT in the universe need to be loaded (for example, for coherence of builtin traits). For that, the attributes of the AdtDef need to be loaded too. The attributes of a struct are duplicated between 2 def ids - the constructor def-id, and the "type" def id. Loading attributes for both def-ids, which was done in #53721, slowed the compilation of small crates by 2-3%. This PR makes sure we only load the attributes for the "type" def-id, avoiding the slowdown.
2018-09-22Auto merge of #54265 - arielb1:civilize-proc-macros, r=alexcrichtonbors-24/+53
avoid leaking host details in proc macro metadata decoding proc macro crates are essentially implemented as dynamic libraries using a dlopen-based ABI. They are also Rust crates, so they have 2 worlds - the "host" world in which they are defined, and the "target" world in which they are used. For all the "target" world knows, the proc macro crate might not even be implemented in Rust, so leaks of details from the host to the target must be avoided for correctness. Because the "host" DefId space is different from the "target" DefId space, any leak involving a DefId will have a nonsensical or out-of-bounds DefKey, and will cause all sorts of crashes. This PR fixes all leaks I have found in `decoder`. In particular, #54059 was caused by host native libraries leaking into the target, which feels like it might even be a correctness issue if it doesn't cause an ICE. Fixes #54059
2018-09-20Rollup merge of #53470 - bjorn3:warn_metadata_errors, r=alexcrichtonkennytm-1/+1
Warn about metadata loader errors Output when writing corrupting to libcore.rlib ``` warning: no metadata found: failed to read rlib metadata in '/Users/bjorn/Documents/rust_fork/build/x86_64-apple-darwin/stage1-std/x86_64-apple-darwin/release/deps/libcore-857d662d379c5d0c.rlib': File too small to be an archive error[E0463]: can't find crate for `core` error: aborting due to previous error ``` Fixes #53381
2018-09-19Add an is_marker flag to TraitDefScott McMurray-0/+4
2018-09-19Use full name to identify a macro in a `FileName`.Diogo Sousa-6/+12
Before this two macros with same name would be indistinguishable inside a `FileName`. This caused a bug in incremental compilation (see #53097) since two different macros would map out to the same `StableFilemapId`. Fixes #53097.
2018-09-18Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.Nicholas Nethercote-2/+2
Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
2018-09-15avoid leaking host details in proc macro metadata decodingAriel Ben-Yehuda-24/+53
proc macro crates are essentially implemented as dynamic libraries using a dlopen-based ABI. They are also Rust crates, so they have 2 worlds - the "host" world in which they are defined, and the "target" world in which they are used. For all the "target" world knows, the proc macro crate might not even be implemented in Rust, so leaks of details from the host to the target must be avoided for correctness. Because the "host" DefId space is different from the "target" DefId space, any leak involving a DefId will have a nonsensical or out-of-bounds DefKey, and will cause all sorts of crashes. This PR fixes all leaks I have found in `decoder`. In particular, #54059 was caused by host native libraries leaking into the target, which feels like it might even be a correctness issue if it doesn't cause an ICE. Fixes #54059
2018-09-15rustc_resolve: always include core, std and meta in the extern prelude.Eduard-Mihai Burtescu-20/+61
2018-09-15rustc: add unstable support for --extern crate_name without a path.Eduard-Mihai Burtescu-2/+8
2018-09-14Rollup merge of #54095 - kenta7777:kenta7777#53719, r=davidtwcokennytm-1/+1
Rename all mentions of `nil` to `unit` Fixes #53719. Renamed keywords nil to unit.
2018-09-12Warn about metadata loader errorsbjorn3-1/+1
2018-09-11stabalize infer outlives requirements (RFC 2093).toidiu-1/+0
Co-authored-by: nikomatsakis
2018-09-11renamed emit_nil to emit_unitkenta7777-1/+1
2018-09-11Revert "renamed emit_nil to emit_unit"kenta7777-1/+1
This reverts commit d02a5ffaed9c395ae62ee12d0f4e04946c62edb1.
2018-09-10renamed emit_nil to emit_unitkenta7777-1/+1