summary refs log tree commit diff
path: root/src/librustc_data_structures
AgeCommit message (Collapse)AuthorLines
2017-10-04Generate ScopeId using newtype_index macroSantiago Pastorino-1/+2
2017-10-04Generate DepNodeIndexNew using newtype_index macroSantiago Pastorino-0/+7
2017-10-04Make newtype_index get debug_name using reflectionSantiago Pastorino-0/+4
2017-10-04Make newtype_index macro use full path to resolve constantsSantiago Pastorino-3/+3
2017-10-04Move newtype_index to rustc_data_structuresSantiago Pastorino-0/+25
2017-09-24Point at parameter type on E0301Esteban Küber-4/+4
On "the parameter type `T` may not live long enough" error, point to the parameter type suggesting lifetime bindings: ``` error[E0310]: the parameter type `T` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | 27 | struct Foo<T> { | - help: consider adding an explicit lifetime bound `T: 'static`... 28 | foo: &'static T | ^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | 28 | foo: &'static T | ^^^^^^^^^^^^^^^ ```
2017-09-20incr.comp.: Add some comments.Michael Woerister-1/+3
2017-09-20incr.comp.: Make sure traits_in_scope results are hashed in a stable way.Michael Woerister-0/+32
2017-09-18incr.comp.: Fix rebase fallout.Michael Woerister-0/+8
2017-09-18incr.comp.: Use StableHash impls instead of functions for hashing most maps.Michael Woerister-8/+42
2017-09-18Fix issues uncovered by rebasing:Michael Woerister-22/+65
- Don't hash traits in scope as part of HIR hashing any more. - Some queries returned DefIndexes from other crates. - Provide a generic way of stably hashing maps (not used everywhere yet).
2017-09-18incr.comp.: Move result fingerprinting to DepGraph::with_task().Michael Woerister-3/+25
This makes sure that we don't introduce strange cases where we have nodes outside the query system that could break red/green tracking and it will allow to keep red/green neatly encapsulated within the DepGraph implementation.
2017-09-18incr.comp.: Compute hashes of all query results.Michael Woerister-1/+27
2017-09-14rustc: Preallocate when building the dep graphAlex Crichton-0/+14
This commit alters the `query` function in the dep graph module to preallocate memory using `with_capacity` instead of relying on automatic growth. Discovered in #44576 it was found that for the syntex_syntax clean incremental benchmark the peak memory usage was found when the dep graph was being saved, particularly the `DepGraphQuery` data structure itself. PRs like #44142 which add more queries end up just making this much larger! I didn't see an immediately obvious way to reduce the size of the `DepGraphQuery` object, but it turns out that `with_capacity` helps quite a bit! Locally 831 MB was used [before] this commit, and 770 MB is in use at the peak of the compiler [after] this commit. That's a nice 7.5% improvement! This won't quite make up for the losses in #44142 but I figured it's a good start. [before]: https://gist.github.com/alexcrichton/2d2b9c7a65503761925c5a0bcfeb0d1e [before]: https://gist.github.com/alexcrichton/6da51f2a6184bfb81694cc44f06deb5b
2017-09-13Analyse storage liveness and preserve it during generator transformationJohn Kåre Alsaker-1/+10
2017-09-02stabilize mem::discriminant (closes #24263)Alex Burka-1/+0
2017-08-29Auto merge of #44059 - oli-obk:ok_suggestion, r=nikomatsakisbors-10/+10
Suggest `Ok(())` when encountering `Result::<(), E>::Ok()`
2017-08-28Suggest `Ok(())` when encountering `Ok()`Oliver Schneider-10/+10
2017-08-28Merge branch 'master' of https://github.com/rust-lang/rust into genJohn Kåre Alsaker-3/+0
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-643/+6
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-643/+6
2017-08-17Merge remote-tracking branch 'origin/master' into genAlex Crichton-3/+3
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-3/+3
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-0/+64
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-32/+32
2017-08-16MIR based borrow check (opt-in).Felix S. Klock II-0/+30
One can either use `-Z borrowck-mir` or add the `#[rustc_mir_borrowck]` attribute to opt into MIR based borrow checking. Note that regardless of whether one opts in or not, AST-based borrow check will still run as well. The errors emitted from AST-based borrow check will include a "(Ast)" suffix in their error message, while the errors emitted from MIR-based borrow check will include a "(Mir)" suffix. post-rebase: removed check for intra-statement mutual conflict; replaced with assertion checking that at most one borrow is generated per statement. post-rebase: removed dead code: `IdxSet::pairs` and supporting stuff.
2017-08-16Move `DataFlowState::{each_bit,interpret_set}` method definitions to parent ↵Felix S. Klock II-0/+34
module. Refactored `each_bit`, which traverses a `IdxSet`, so that the bulk of its implementation lives in `rustc_data_structures`.
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-32/+32
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-3/+3
2017-08-14Merge remote-tracking branch 'origin/master' into genAlex Crichton-1/+11
2017-08-14Auto merge of #43740 - michaelwoerister:local-id-in-typecktables, r=arielb1bors-0/+10
Use hir::ItemLocalId as keys in TypeckTables. This PR makes `TypeckTables` use `ItemLocalId` instead of `NodeId` as key. This is needed for incremental compilation -- for stable hashing and for being able to persist and reload these tables. The PR implements the most important part of https://github.com/rust-lang/rust/issues/40303. Some notes on the implementation: * The PR adds the `HirId` to HIR nodes where needed (`Expr`, `Local`, `Block`, `Pat`) which obviates the need to store a `NodeId -> HirId` mapping in crate metadata. Thanks @eddyb for the suggestion! In the future the `HirId` should completely replace the `NodeId` in HIR nodes. * Before something is read or stored in one of the various `TypeckTables` subtables, the entry's key is validated via the new `TypeckTables::validate_hir_id()` method. This makes sure that we are not mixing information from different items in a single table. That last part could be made a bit nicer by either (a) new-typing the table-key and making `validate_hir_id()` the only way to convert a `HirId` to the new-typed key, or (b) just encapsulate sub-table access a little better. This PR, however, contents itself with not making things significantly worse. Also, there's quite a bit of switching around between `NodeId`, `HirId`, and `DefIndex`. These conversions are cheap except for `HirId -> NodeId`, so if the valued reviewer finds such an instance in a performance critical place, please let me know. Ideally we convert more and more code from `NodeId` to `HirId` in the future so that there are no more `NodeId`s after HIR lowering anywhere. Then the amount of switching should be minimal again. r? @eddyb, maybe?
2017-08-12Auto merge of #43794 - Eijebong:fix_typos, r=lukaramu,steveklanik,imperiobors-1/+1
Fix some typos I wrote a really naive script and found those typos in the documentation.
2017-08-11Make TypeckTables::type_dependent_defs use ItemLocalId instead of NodeId.Michael Woerister-0/+10
2017-08-11Fix some typosBastien Orivel-1/+1
2017-08-10Merge remote-tracking branch 'origin/master' into genAlex Crichton-3/+3
2017-08-10Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1bors-3/+3
Fixed mutable vars being marked used when they weren't #### NB : bootstrapping is slow on my machine, even with `keep-stage` - fixes for occurances in the current codebase are <s>in the pipeline</s> done. This PR is being put up for review of the fix of the issue. Fixes #43526, Fixes #30280, Fixes #25049 ### Issue Whenever the compiler detected a mutable deref being used mutably, it marked an associated value as being used mutably as well. In the case of derefencing local variables which were mutable references, this incorrectly marked the reference itself being used mutably, instead of its contents - with the consequence of making the following code emit no warnings ``` fn do_thing<T>(mut arg : &mut T) { ... // don't touch arg - just deref it to access the T } ``` ### Fix Make dereferences not be counted as a mutable use, but only when they're on borrows on local variables. #### Why not on things other than local variables? * Whenever you capture a variable in a closure, it gets turned into a hidden reference - when you use it in the closure, it gets dereferenced. If the closure uses the variable mutably, that is actually a mutable use of the thing being dereffed to, so it has to be counted. * If you deref a mutable `Box` to access the contents mutably, you are using the `Box` mutably - so it has to be counted.
2017-08-09Fix iterator over indexed setsAlex Crichton-3/+3
2017-08-09Initial pass review commentsAlex Crichton-0/+39
2017-08-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-67/+81
2017-08-07Auto merge of #43713 - arielb1:legacy-dataflow, r=eddybbors-0/+79
rustc::middle::dataflow - visit the CFG in RPO We used to propagate bits in node-id order, which sometimes caused an excessive number of iterations, especially when macros were present. As everyone knows, visiting the CFG in RPO bounds the number of iterators by 1 plus the depth of the most deeply nested loop (times the height of the lattice, which is 1). I have no idea how this affects borrowck perf in the non-worst-case, so it's probably a good idea to not roll this up so we can see the effects. Fixes #43704. r? @eddyb
2017-08-07rustc::middle::dataflow - visit the CFG in RPOAriel Ben-Yehuda-0/+79
We used to propagate bits in node-id order, which sometimes caused an excessive number of iterations, especially when macros were present. As everyone knows, visiting the CFG in RPO bounds the number of iterators by 1 plus the depth of the most deeply nested loop (times the height of the lattice, which is 1). Fixes #43704.
2017-08-02Remove unused fnv hash codeMatt Brubeck-67/+0
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-3/+3
2017-07-31rustc: Inline bitwise modification operatorsAlex Crichton-0/+2
These need to be inlined across crates to avoid showing up as one-instruction functions in profiles! In the benchmark from #43578 this decreased the translation item collection step from 30s to 23s, and looks like it also allowed vectorization elsewhere of the operations!
2017-07-28Generator literal supportJohn Kåre Alsaker-1/+18
2017-07-26Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturonbors-1/+0
Stabilize more APIs for the 1.20.0 release In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
2017-07-26Rollup merge of #43480 - dhduvall:sparc-blake2b, r=eddybMark Simulacrum-0/+1
Constrain the layout of Blake2bCtx for proper SPARC compilation On SPARC, optimization fuel ends up emitting incorrect load and store instructions for the transmute() call in blake2b_compress(). If we force Blake2bCtx to be repr(C), the problem disappears. Fixes #43346
2017-07-26Rollup merge of #42959 - SimonSapin:nonzero-checked, r=sfacklerMark Simulacrum-2/+2
Make the "main" constructors of NonZero/Shared/Unique return Option Per discussion in https://github.com/rust-lang/rust/issues/27730#issuecomment-303939441. This is a breaking change to unstable APIs. The old behavior is still available under the name `new_unchecked`. Note that only that one can be `const fn`, since `if` is currently not allowed in constant contexts. In the case of `NonZero` this requires adding a new `is_zero` method to the `Zeroable` trait. I mildly dislike this, but it’s not much worse than having a `Zeroable` trait in the first place. `Zeroable` and `NonZero` are both unstable, this can be reworked later.
2017-07-25Constrain the layout of Blake2bCtx for proper SPARC compilationDanek Duvall-0/+1
On SPARC, optimization fuel ends up emitting incorrect load and store instructions for the transmute() call in blake2b_compress(). If we force Blake2bCtx to be repr(C), the problem disappears. Fixes #43346