Commit Graph

135 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu 961fe5479f rustc: use indexmap instead of a plain vector for upvars. 2019-06-01 19:17:22 +03:00
Eduard-Mihai Burtescu 26e61dd826 rustc: replace Res in hir::Upvar with only Local/Upvar data. 2019-06-01 19:01:09 +03:00
Eduard-Mihai Burtescu 8d9f4a128c rustc: rename all occurences of "freevar" to "upvar". 2019-05-05 18:49:32 +03:00
Eduard-Mihai Burtescu 125dc60dab rustc: replace uses of with_freevars with the freevars query. 2019-05-05 18:48:42 +03:00
ljedrz 3b99a48c4d HirIdify hir::Def 2019-04-14 09:30:02 +02:00
Eduard-Mihai Burtescu 01fa283d6f rustc: remove fmt::{Debug,Display} from ty::TyKind. 2019-03-15 09:26:13 +02:00
ljedrz cd06038b54 HirIdification: replace NodeId method calls 2019-03-07 09:22:43 +01:00
ljedrz 50b8bc8c8c hir: remove NodeId from Pat and FieldPat 2019-03-02 07:48:52 +01:00
bors ea43c3c688 Auto merge of #58561 - ljedrz:HirIdify_some_nodes, r=Zoxc
Remove NodeId from some HIR nodes

The next iteration of https://github.com/rust-lang/rust/pull/57578.

Removes `NodeId` from:

- [x] `Lifetime`
- [x] `Ty`
- [x] `GenericParam`
- [x] `WhereClause`
- [x] `WhereEqPredicate`
- [x] `MacroDef`
- [x] `Block`
- [x] `Expr`

r? @Zoxc
2019-02-26 06:13:27 +00:00
Mazdak Farrokhzad e8ce56f126 librustc_typeck: deny(elided_lifetimes_in_paths) 2019-02-25 09:13:22 +01:00
ljedrz d7ced1dd5a hir: remove NodeId from Expr 2019-02-24 17:09:37 +01:00
Mazdak Farrokhzad a84c93324c
Rollup merge of #58300 - taiki-e:librustc_typeck-2018, r=petrochenkov
librustc_typeck => 2018

Transitions `librustc_typeck` to Rust 2018; cc #58099

TODO: elided_lifetimes_in_paths

r? @Centril
2019-02-12 04:42:21 +01:00
Taiki Endo fe276239b3 librustc_typeck => 2018 2019-02-08 22:30:58 +09:00
ljedrz 6da9129b36 typeck: partially HirIdify 2019-02-05 20:34:06 +01:00
Blitzerr 15d8e8fb2b [Cleanup] This is the first in the series of removals of with_freevars usage.
Currently, there are many places in rustc, where we use
with_freevars to iterate over freevars of a closure. The
problem with this is the argument to with_freevars is a
NodeId and this will get in the way of our eventual goal
of solving for issue (#53488), sub-issue (#56905)
2019-01-08 17:57:22 -08:00
Blitzerr 7853b780fc Some more refactoring.
Change the key of UpvarListMap from DefId to ast::NodeId
2019-01-08 17:57:22 -08:00
Blitzerr 410b52958d Creating the vector using with_capacity to avoid re-allocation later on (#56905) 2019-01-08 17:57:22 -08:00
Blitzerr 47db51eece Issue 56905
Adding a map to TypeckTables to get the list of all the Upvars
given a closureID. This is help us get rid of the recurring
pattern in the codebase of iterating over the free vars
using with_freevars.
2019-01-08 17:57:22 -08:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
John Kåre Alsaker a70babed03 Use a function to access the Hir map to be able to turn it into a query later 2018-12-06 17:24:36 +01:00
Blitzerr 6779bb485c capture_disjoint_fields(rust-lang#53488)
Refactoring out the HirId of the UpvarId in another struct.
2018-11-14 21:18:48 -08:00
Blitzerr 1ca505a30a capture_disjoint_fields(rust-lang#53488)
Just running RustFmt on upvar.rs
2018-11-14 08:53:02 -08:00
Felix S. Klock II a75f7810a7 AST-borrowck: add separate mem category for thread-locals, as they are not quite rvalues
(and of course they are not quite statics either).

Namely, they *do* have a restricted region (like rvalues), but they
also cannot be moved out of (like statics).
2018-10-17 16:31:22 +02:00
ljedrz 3527276dba A few cleanups and minor improvements to typeck 2018-09-27 10:17:37 +02:00
varkor 6f637da50c Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error} 2018-08-22 16:07:44 +01:00
csmoe 6a16b38198 ExprKind 2018-07-16 15:09:16 +02:00
Esteban Küber 8ddf9a3360 Accept `TyError` in `analyze_closure` to avoid ICE 2018-06-22 15:35:52 -07:00
Niko Matsakis 8a624b737a change `PointerKind::Implicit` to a note
`PointerKind` is included in `LoanPath` and hence forms part of the
equality check; this led to having two unequal paths that both
represent `*x`, depending on whether the `*` was inserted
automatically or explicitly. Bad mojo. The `note` field, in contrast,
is intended more-or-less primarily for this purpose of adding extra
data.
2018-05-31 10:17:51 -04:00
John Kåre Alsaker 710b4ad2a5 Store the GeneratorInterior in the new GeneratorSubsts 2018-05-08 16:21:58 +02:00
John Kåre Alsaker 0edc8f4270 Store generator movability outside GeneratorInterior 2018-05-08 16:21:58 +02:00
Nicholas Nethercote 7cf142f78b Avoid many `cmt` allocations.
`cmt` is a ref-counted wrapper around `cmt_` The use of refcounting
keeps `cmt` handling simple, but a lot of `cmt` instances are very
short-lived, and heap-allocating the short-lived ones takes up time.

This patch changes things in the following ways.

- Most of the functions that produced `cmt` instances now produce `cmt_`
  instances. The `Rc::new` calls that occurred within those functions
  now occur at their call sites (but only when necessary, which isn't
  that often).

- Many of the functions that took `cmt` arguments now take `&cmt_`
  arguments. This includes all the methods in the `Delegate` trait.

As a result, the vast majority of the heap allocations are avoided. In
an extreme case, the number of calls to malloc in tuple-stress drops
from 9.9M to 7.9M, a drop of 20%. And the compile times for many runs of
coercions, deep-vector, and tuple-stress drop by 1--2%.
2018-05-03 22:14:35 +10:00
Niko Matsakis f71de45b23 use subtyping when we create a closure instead of for upvar types
We used to make the upvar types in the closure `==` but that was
stronger than we needed. Subtyping suffices, since we are copying the
upvar value into the closure field. This in turn allows us to infer
smaller lifetimes in captured values in some cases (like the example
here), avoiding errors.
2018-03-21 05:40:59 -04:00
John Kåre Alsaker ccf0d8399e Adds support for immovable generators. Move checking of invalid borrows across suspension points to borrowck. Fixes #44197, #45259 and #45093. 2018-01-23 05:10:38 +01:00
Niko Matsakis 54f4f396d9 convert the `closure_kinds` map to just store the origin information
The closure kinds themselves are now completely found in the `ClosureSubsts`.
2017-11-18 07:47:37 -05:00
Niko Matsakis 2dff9a49e5 stop using the `closure_kinds` query / table for anything
Closure Kind is now extracted from the closure substs exclusively.
2017-11-18 07:47:37 -05:00
Niko Matsakis 3349e7bb45 thread the closure-kind through in the closure substs
Similar to how freshen handled things, but "always happening"; we can
thus remove the corresponding code from `freshen`.
2017-11-18 07:47:36 -05:00
Niko Matsakis 1d96819dc0 upvar.rs: rustfmt 2017-11-18 07:47:36 -05:00
Niko Matsakis eab5b263e8 flatten the arguments to `analyze_closure`
They were oddly tupled.
2017-11-18 07:47:35 -05:00
bors 02eed2e9a5 Auto merge of #46004 - michaelwoerister:cached-mir-wip-3, r=nikomatsakis
incr.comp.: Implement query result cache and use it to cache type checking tables.

This is a spike implementation of caching more than LLVM IR and object files when doing incremental compilation. At the moment, only the `typeck_tables_of` query is cached but MIR and borrow-check will follow shortly. The feature is activated by running with `-Zincremental-queries` in addition to `-Zincremental`, it is not yet active by default.

r? @nikomatsakis
2017-11-17 10:12:21 +00:00
Michael Woerister 24e54ddefa Introduce LocalDefId which provides a type-level guarantee that the DefId is from the local crate. 2017-11-16 14:04:01 +01:00
Niko Matsakis 629efae761 look for the note on the guarantor, not the root cmt
This was causing upvar inference to fail for all cases where the move
was from a projection, not the root variable.
2017-11-08 05:29:03 -05:00
Douglas Campos 2bde6949f9 bring TyCtxt into scope 2017-09-14 21:26:06 -04:00
Eduard-Mihai Burtescu da0a47a081 Use NodeId/HirId instead of DefId for local variables. 2017-09-08 22:00:59 +03:00
Eduard-Mihai Burtescu 8bdfd8a003 rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree. 2017-09-01 23:27:48 +03:00
Alex Crichton 1413253a41 Merge remote-tracking branch 'origin/master' into gen 2017-08-14 19:36:13 -07:00
Michael Woerister 1f54df1101 Encapsulate sub-table access in TypeckTables and validate keys on each access. 2017-08-11 12:17:07 +02:00
Michael Woerister 4dcc3a4aae Use DefIndex instead of NodeId in UpvarId. 2017-08-11 12:11:38 +02:00
Michael Woerister 454533f5d9 Use ItemLocalId as key for closure_tys and closure_kinds in TypeckTables. 2017-08-11 12:11:38 +02:00
Michael Woerister 7f2423eede Use ItemLocalId as key for node_types, node_substs, and adjustments in TypeckTables. 2017-08-11 12:11:38 +02:00
Alex Crichton 9285a61413 Remove `IsGenerator` in favor of a boolean
No need to be mixed!
2017-07-28 13:24:28 -07:00