about summary refs log tree commit diff
path: root/src/librustc/middle
AgeCommit message (Collapse)AuthorLines
2017-08-30rustc: Remove the `used_unsafe` field on TyCtxtAlex Crichton-5/+50
Now that lint levels are available for the entire compilation, this can be an entirely local lint in `effect.rs`
2017-08-30Auto merge of #43932 - eddyb:const-scoping, r=nikomatsakisbors-26/+50
Forward-compatibly deny drops in constants if they *could* actually run. This is part of #40036, specifically the checks for user-defined destructor invocations on locals which *may not* have been moved away, the motivating example being: ```rust const FOO: i32 = (HasDrop {...}, 0).1; ``` The evaluation of constant MIR will continue to create `'static` slots for more locals than is necessary (if `Storage{Live,Dead}` statements are ignored), but it shouldn't be misusable. r? @nikomatsakis
2017-08-30Make fields of `Span` privateVadim Petrochenkov-1/+1
2017-08-28rustc: use rvalue scope semantics for constant initializers.Eduard-Mihai Burtescu-26/+50
2017-08-25Clean up YieldFinderJohn Kåre Alsaker-3/+8
2017-08-25Merge remote-tracking branch 'origin/master' into genAlex Crichton-14/+21
2017-08-24Avoid looking at `closure_kinds` for generatorsAlex Crichton-7/+6
2017-08-24Auto merge of #43532 - petrochenkov:pgargs, r=nikomatsakisbors-13/+10
Desugar parenthesized generic arguments in HIR Fixes ICE in https://github.com/rust-lang/rust/issues/43431 and maybe some other similar issues. r? @eddyb
2017-08-22Auto merge of #44008 - RalfJung:staged1, r=alexcrichtonbors-1/+11
Make sure crates not opting in to staged_api don't use staged_api This also fixes the problem that with `-Zforce-unstable-if-unmarked` set, crates could not use `#[deprecated]`. If you prefer, I can instead submit another version which just fixes this problem, but still allows the staged API attributes for all crates when `-Zforce-unstable-if-unmarked` is set. I have prepared that at <https://github.com/RalfJung/rust/tree/staged2>. As yet another alternative, @alexcrichton suggested to turn this error into a lint, but that seems to be much more work, so is it worth it? Cc @alexcrichton #43975
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-0/+1
2017-08-22Auto merge of #43690 - scalexm:issue-28229, r=nikomatsakisbors-0/+1
Generate builtin impls for `Clone` This fixes a long-standing ICE and limitation where some builtin types implement `Copy` but not `Clone` (whereas `Clone` is a super trait of `Copy`). However, this PR has a few side-effects: * `Clone` is now marked as a lang item. * `[T; N]` is now `Clone` if `T: Clone` (currently, only if `T: Copy` and for `N <= 32`). * `fn foo<'a>() where &'a mut (): Clone { }` won't compile anymore because of how bounds for builtin traits are handled (e.g. same thing currently if you replace `Clone` by `Copy` in this example). Of course this function is unusable anyway, an error would pop as soon as it is called. Hence, I'm wondering wether this PR would need an RFC... Also, cc-ing @nikomatsakis, @arielb1. Related issues: #28229, #24000.
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-1/+1
2017-08-20Make sure crates not opting in to staged_api don't use staged_apiRalf Jung-1/+11
2017-08-19Desugar parenthesized generic arguments in HIRVadim Petrochenkov-13/+10
2017-08-17rustc: Rename NodeLocal to NodeBindingAlex Crichton-1/+1
2017-08-17Merge remote-tracking branch 'origin/master' into genAlex Crichton-3/+3
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-1/+1
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-16Stabilize rvalue promotion to 'static.Eduard-Mihai Burtescu-2/+2
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-19/+11
2017-08-16Auto merge of #43850 - GuillaumeGomez:unused-variable-lint, r=arielb1bors-3/+7
Add a note to unused variables Fixes #26720.
2017-08-16Add a note to unused variablesGuillaume Gomez-3/+7
2017-08-16Auto merge of #43710 - zackmdavis:field_init_shorthand_power_slam, ↵bors-2/+2
r=Mark-Simulacrum use field init shorthand EVERYWHERE Like #43008 (f668999), but [(lacking reasons to be more timid)](https://github.com/rust-lang/rust/pull/43008#issuecomment-312463564) _much more aggressive_. r? @Mark-Simulacrum
2017-08-16Auto merge of #43651 - petrochenkov:foreign-life, r=eddybbors-14/+2
Fix ICE with elided lifetimes in return type of foreign functions cc https://github.com/rust-lang/rust/issues/43567 This is for a preliminary crater/cargobomb run. Lifetime elision in foreign functions now works exactly like in other functions or function-like entities. If the breakage is significant, I'll have to partially revert https://github.com/rust-lang/rust/pull/43543 (all the stuff that was required for dealing with late bound lifetimes in this position). r? @eddyb
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-1/+1
2017-08-14Fix merge conflicts with `gen` branchAlex Crichton-2/+2
2017-08-14Merge remote-tracking branch 'origin/master' into genAlex Crichton-47/+77
2017-08-14Auto merge of #43740 - michaelwoerister:local-id-in-typecktables, r=arielb1bors-46/+67
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-14Remove dummy lang itemsscalexm-3/+0
2017-08-14Make `Clone` a lang item and generate builtin impls.scalexm-0/+4
Fixes #28229. Fixes #24000.
2017-08-14Mark closures return via impl-trait as reachable.Michael Woerister-0/+3
2017-08-14Fix some merge fallout.Michael Woerister-2/+0
2017-08-12Check #[thread_local] statics correctly in the compiler.Eduard-Mihai Burtescu-1/+7
2017-08-11Improve validation of TypeckTables keys.Michael Woerister-4/+3
2017-08-11Encapsulate sub-table access in TypeckTables and validate keys on each access.Michael Woerister-19/+13
2017-08-11Use DefIndex instead of NodeId in UpvarId.Michael Woerister-11/+17
2017-08-11Use ItemLocalId as key for closure_tys and closure_kinds in TypeckTables.Michael Woerister-1/+4
2017-08-11Use ItemLocalId as key for TypeckTables::pat_binding_modes.Michael Woerister-4/+16
2017-08-11Use ItemLocalId as key for node_types, node_substs, and adjustments in ↵Michael Woerister-13/+19
TypeckTables.
2017-08-11Make TypeckTables::type_dependent_defs use ItemLocalId instead of NodeId.Michael Woerister-16/+19
2017-08-11Please tidyJohn Kåre Alsaker-1/+3
2017-08-11Implement a cache for looking up yieldsJohn Kåre Alsaker-17/+45
2017-08-10Merge remote-tracking branch 'origin/master' into genAlex Crichton-45/+49
2017-08-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-85/+129
2017-08-09rustc: Rearchitect lints to be emitted more eagerlyAlex Crichton-45/+49
In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite.
2017-08-07Auto merge of #43713 - arielb1:legacy-dataflow, r=eddybbors-4/+13
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-4/+13
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-06Auto merge of #43397 - GuillaumeGomez:unused-union-field, r=petrochenkovbors-3/+28
Don't warn on unused field on union Fixes #43393.
2017-08-06Handle type aliases as wellGuillaume Gomez-3/+6
2017-08-06Fix union unused fields checkGuillaume Gomez-14/+11