about summary refs log tree commit diff
path: root/src/librustc_data_structures
AgeCommit message (Collapse)AuthorLines
2017-05-04fallout from NonZero/Unique/Shared changesAlexis Beingessner-2/+2
2017-05-03factor variances into a proper queryNiko Matsakis-0/+14
There are now two queries: crate and item. The crate one computes the variance of all items in the crate; it is sort of an implementation detail, and not meant to be used. The item one reads from the crate one, synthesizing correct deps in lieu of the red-green algorithm. At the same time, remove the `variance_computed` flag, which was a horrible hack used to force invariance early on (e.g. when type-checking constants). This is only needed because of trait applications, and traits are always invariant anyway. Therefore, we now change to take advantage of the query system: - When asked to compute variances for a trait, just return a vector saying 'all invariant'. - Remove the corresponding "inferreds" from traits, and tweak the constraint generation code to understand that traits are always inferred.
2017-05-03make transitive relation use a hash mapNiko Matsakis-27/+42
2017-05-02Rollup merge of #41693 - est31:anon_params_removal, r=eddybCorey Farwell-1/+1
Removal pass for anonymous parameters Removes occurences of anonymous parameters from the rustc codebase, as they are to be deprecated. See issue #41686 and RFC 1685. r? @frewsxcv
2017-05-02Removal pass for anonymous parametersest31-1/+1
Removes occurences of anonymous parameters from the rustc codebase, as they are to be deprecated. See issue #41686 and RFC 1685.
2017-04-30intern CodeExtentsNiko Matsakis-0/+21
Make a `CodeExtent<'tcx>` be something allocated in an arena instead of an index into the `RegionMaps`.
2017-04-22Haiku: fix initial platform supportJessica Hamilton-0/+1
2017-04-13Auto merge of #40570 - nikomatsakis:inference-subtype-through-obligation, ↵bors-18/+35
r=arielb1 Handle subtyping in inference through obligations We currently store subtyping relations in the `TypeVariables` structure as a kind of special case. This branch uses normal obligations to propagate subtyping, thus converting our inference variables into normal fallback. It also does a few other things: - Removes the (unstable, outdated) support for custom type inference fallback. - It's not clear how we want this to work, but we know that we don't want it to work the way it currently does. - The existing support was also just getting in my way. - Fixes #30225, which was caused by the trait caching code pretending type variables were normal unification variables, when indeed they were not (but now are). There is one fishy part of these changes: when computing the LUB/GLB of a "bivariant" type parameter, I currently return the `a` value. Bivariant type parameters are only allowed in a very particular situation, where the type parameter is only used as an associated type output, like this: ```rust pub struct Foo<A, B> where A: Fn() -> B { data: A } ``` In principle, if one had `T=Foo<A, &'a u32>` and `U=Foo<A, &'b u32>` and (e.g.) `A: for<'a> Fn() -> &'a u32`, then I think that computing the LUB of `T` and `U` might do the wrong thing. Probably the right behavior is just to create a fresh type variable. However, that particular example would not compile (because the where-clause is illegal; `'a` does not appear in any input type). I was not able to make an example that *would* compile and demonstrate this shortcoming, and handling the LUB/GLB was mildly inconvenient, so I left it as is. I am considering whether to revisit this or what. I have started a crater run to test the impact of these changes.
2017-04-12ICH: Replace old, transitive metadata hashing with direct hashing approach.Michael Woerister-8/+34
Instead of collecting all potential inputs to some metadata entry and hashing those, we directly hash the values we are storing in metadata. This is more accurate and doesn't suffer from quadratic blow-up when many entries have the same dependencies.
2017-04-12ICH: Hash everything that gets encoded into crate metadata.Michael Woerister-0/+52
2017-04-11add some comments and `debug!` calls to "obligation forest"Niko Matsakis-18/+35
2017-04-09Move away from the ad-hoc NoDrop unionsSimonas Kazlauskas-29/+9
2017-04-06Introduce HashStable trait and base ICH implementations on it.Michael Woerister-1/+193
This initial commit provides implementations for HIR, MIR, and everything that also needs to be supported for those two.
2017-03-30Auto merge of #40524 - alexcrichton:update-bootstrap, r=alexcrichtonbors-1/+0
rustbuild: Update bootstrap compiler Now that we've also updated cargo's release process this commit also changes the download location of Cargo from Cargos archives back to the static.r-l.o archives. This should ensure that the Cargo download is the exact Cargo paired with the rustc that we release.
2017-03-29rustbuild: Update bootstrap compilerAlex Crichton-1/+0
Now that we've also updated cargo's release process this commit also changes the download location of Cargo from Cargos archives back to the static.r-l.o archives. This should ensure that the Cargo download is the exact Cargo paired with the rustc that we release.
2017-03-27Fix various useless derefs and slicingsOliver Schneider-10/+10
2017-03-23Remove internal liblogAlex Crichton-1/+1
This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
2017-03-22Add resize() method to IndexVec.Michael Woerister-0/+7
2017-03-17Stabilize rc_raw feature, closes #37197Aaron Turon-3/+1
2017-03-10Add extra methods to IndexVec and implement TypeFoldable for itJames Miller-0/+24
Adds `get`/`get_mut` accessors and `drain`/`drain_enumerated` iterators to IndexVec. Implements TypeFoldable for IndexVec.
2017-02-28move the `FreeRegionMap` into `TypeckTables`Niko Matsakis-2/+32
2017-02-13Auto merge of #39456 - nagisa:mir-switchint-everywhere, r=nikomatsakisbors-0/+4
[MIR] SwitchInt Everywhere Something I've been meaning to do for a very long while. This PR essentially gets rid of 3 kinds of conditional branching and only keeps the most general one - `SwitchInt`. Primary benefits are such that dealing with MIR now does not involve dealing with 3 different ways to do conditional control flow. On the other hand, constructing a `SwitchInt` currently requires more code than what previously was necessary to build an equivalent `If` terminator. Something trivially "fixable" with some constructor methods somewhere (MIR needs stuff like that badly in general). Some timings (tl;dr: slightly faster^1 (unexpected), but also uses slightly more memory at peak (expected)): ^1: Not sure if the speed benefits are because of LLVM liking the generated code better or the compiler itself getting compiled better. Either way, its a net benefit. The CORE and SYNTAX timings done for compilation without optimisation. ``` AFTER: Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 31.50 secs Finished release [optimized] target(s) in 31.42 secs Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 439.56 secs Finished release [optimized] target(s) in 435.15 secs CORE: 99% (24.81 real, 0.13 kernel, 24.57 user); 358536k resident CORE: 99% (24.56 real, 0.15 kernel, 24.36 user); 359168k resident SYNTAX: 99% (49.98 real, 0.48 kernel, 49.42 user); 653416k resident SYNTAX: 99% (50.07 real, 0.58 kernel, 49.43 user); 653604k resident BEFORE: Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 31.84 secs Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 451.17 secs CORE: 99% (24.66 real, 0.20 kernel, 24.38 user); 351096k resident CORE: 99% (24.36 real, 0.17 kernel, 24.18 user); 352284k resident SYNTAX: 99% (52.24 real, 0.56 kernel, 51.66 user); 645544k resident SYNTAX: 99% (51.55 real, 0.48 kernel, 50.99 user); 646428k resident ``` cc @nikomatsakis @eddyb
2017-02-10Allow rustc data structures compile to androidMarco A L Barbosa-1/+1
flock structure is defined in asm*/fcntl.h. This file on android is generated from the linux kernel source, so they are the same.
2017-02-10SwitchInt over SwitchSimonas Kazlauskas-0/+4
This removes another special case of Switch by replacing it with the more general SwitchInt. While this is more clunky currently, there’s no reason we can’t make it nice (and efficient) to use.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-4/+1
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2017-01-29Remove dead recursive partial eq implest31-9/+1
Its nowhere used (if it had been used used, the rust stack would have overflown due to the recursion). Its presence was confusing for mrustc.
2017-01-15Auto merge of #38610 - djzin:master, r=sfacklerbors-2/+12
Implementation of plan in issue #27787 for btree_range Still some ergonomics to be worked on, the ::<str,_> is particularly unsightly
2017-01-14add required imports & featureDjzin-0/+2
2017-01-14update array_vec to use new rangeargumentdjzin-2/+10
2017-01-12Mark some BitVector methods with #[inline]Michael Woerister-0/+9
2017-01-10Use little-endian encoding for Blake2 hashing on all architecturesAriel Ben-Yehuda-6/+10
Like many hash functions, the blake2 hash is mathematically defined on a sequence of 64-bit words. As Rust's hash interface operates on sequences of octets, some encoding must be used to bridge that difference. The Blake2 RFC (RFC 7693) specifies that: Byte (octet) streams are interpreted as words in little-endian order, with the least-significant byte first. So use that encoding consistently. Fixes #38891.
2017-01-08Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrcbors-1/+1
Remove not(stage0) from deny(warnings) Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2017-01-03Add drain method to AccumulateVec/ArrayVecAndrew Cann-1/+126
You can now call .drain(..) on SmallVec, AccumulateVec and ArrayVec
2016-12-30Fix rebase fallout and compilation fixesest31-2/+6
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2016-12-18Auto merge of #38051 - sanxiyn:unused-type-alias-3, r=eddybbors-2/+0
Warn unused type aliases, reimplemented Reimplementation of #37631. Fix #37455.
2016-12-18Auto merge of #37429 - camlorn:univariant_layout_optimization, r=eddybbors-0/+6
struct field reordering and optimization This is work in progress. The goal is to divorce the order of fields in source code from the order of fields in the LLVM IR, then optimize structs (and tuples/enum variants)by always ordering fields from least to most aligned. It does not work yet. I intend to check compiler memory usage as a benchmark, and a crater run will probably be required. I don't know enough of the compiler to complete this work unaided. If you see places that still need updating, please mention them. The only one I know of currently is debuginfo, which I'm putting off intentionally until a bit later. r? @eddyb
2016-12-16flock needs repr(C)Austin Hicks-0/+6
2016-12-15Use StableHasher everywhereAriel Ben-Yehuda-0/+179
The standard implementations of Hasher have architecture-dependent results when hashing integers. This causes problems when the hashes are stored within metadata - metadata written by one host architecture can't be read by another. To fix that, implement an architecture-independent StableHasher and use it in all places an architecture-independent hasher is needed. Fixes #38177.
2016-12-15Warn unused type aliasesSeo Sanghyeon-2/+0
2016-12-12Do not generate '@' character in symbol names.Vadzim Dambrouski-0/+2
MSP430 assembler does not like '@' character in symbol names, so we should only use alphanumerics when we generate a new name. Fixes #38116
2016-11-22Use SmallVec for TypeWalker's stack.Nicholas Nethercote-0/+12
The change also adds the missing `SmallVec::truncate` method.
2016-11-18Don't clone in UnificationTable::probe().Nicholas Nethercote-1/+1
This speeds up compilation of rustc-benchmarks/inflate-0.1.0 by 1%.
2016-11-13Make names of types used in LLVM IR stable.Michael Woerister-0/+65
Before this PR, type names could depend on the cratenum being used for a given crate and also on the source location of closures. Both are undesirable for incremental compilation where we cache LLVM IR and don't want it to depend on formatting or in which order crates are loaded.
2016-11-12Rollup merge of #37551 - Mark-Simulacrum:upgrade-accvec, r=eddybEduard-Mihai Burtescu-16/+495
Replace syntax's SmallVector with AccumulateVec This adds a new type to data_structures, `SmallVec`, which wraps `AccumulateVec` with support for re-allocating onto the heap (`SmallVec::reserve`). `SmallVec` is then used to replace the implementation of `SmallVector` in libsyntax. r? @eddyb Fixes #37371. Using `SmallVec` instead of libsyntax's `SmallVector` will provide the `N = 2/4` case easily (just needs a few more `Array` impls). cc @nnethercote, probably interested in this area
2016-11-12Rollup merge of #37535 - Havvy:graph, r=eddybEduard-Mihai Burtescu-19/+126
Graph Changes General cleanup and adding a few methods that I want to use in Clippy. Need somebody to bikeshed names.
2016-11-11Change implementation of syntax::util::SmallVector to use ↵Mark-Simulacrum-16/+495
data_structures::SmallVec.
2016-11-08Replace FnvHasher use with FxHasher.Nicholas Nethercote-8/+9
This speeds up compilation by 3--6% across most of rustc-benchmarks.
2016-11-08Add FxHasher, a faster alternative to FnvHasher.Nicholas Nethercote-0/+115
2016-11-03Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddybbors-0/+15
A way to remove otherwise unused locals from MIR There is a certain amount of desire for a pass which cleans up the provably unused variables (no assignments or reads). There has been an implementation of such pass by @scottcarr, and another (two!) implementations by me in my own dataflow efforts. PR like https://github.com/rust-lang/rust/pull/35916 proves that this pass is useful even on its own, which is why I cherry-picked it out from my dataflow effort. @nikomatsakis previously expressed concerns over this pass not seeming to be very cheap to run and therefore unsuitable for regular cleanup duties. Turns out, regular cleanup of local declarations is not at all necessary, at least now, because majority of passes simply do not (or should not) care about them. That’s why it is viable to only run this pass once (perhaps a few more times in the future?) per function, right before translation. r? @eddyb or @nikomatsakis