Commit Graph

311 Commits

Author SHA1 Message Date
Martin Lindhe
ece9a57d1b fix some typos 2017-11-21 15:33:45 +01:00
Niko Matsakis
09b44bbe77 IndexVec: add '_ to make clear where borrowing is happening 2017-11-16 05:57:45 -05:00
Niko Matsakis
524e23ae2e make RegionVid implement Idx and use IndexVec 2017-11-16 05:57:44 -05:00
bors
785643a5eb Auto merge of #45668 - nikomatsakis:nll-free-region, r=arielb1
extend NLL with preliminary support for free regions on functions

This PR extends https://github.com/rust-lang/rust/pull/45538 with support for free regions. This is pretty preliminary and will no doubt want to change in various ways, particularly as we add support for closures, but it's enough to get the basic idea in place:

- We now create specific regions to represent each named lifetime declared on the function.
- Region values can contain references to these regions (represented for now as a `BTreeSet<RegionIndex>`).
- If we wind up trying to infer that `'a: 'b` must hold, but no such relationship was declared, we report an error.

It also does a number of drive-by refactorings.

r? @arielb1

cc @spastorino
2017-11-06 23:30:57 +00:00
Santiago Pastorino
f9bc8e7c4f Make DEBUG_FORMAT = custom work
Fixes #45763, ht by @durka
2017-11-04 19:10:44 -03:00
Niko Matsakis
3db1a95a3f add/fix various comments to BitMatrix
Notably, the (hitherto unused) `less_than` method was not at all what it
purported to be. It in fact computes the opposite.
2017-11-02 04:40:49 -04:00
Paul Daniel Faria
97692afda9 newindex_type macro: make index private by default and allow pub through config 2017-11-01 21:25:37 -04:00
Paul Daniel Faria
bf1198eb1f newtype_index: Support simpler serializable override, custom derive, and fix mir_opt tests 2017-11-01 20:12:53 -04:00
Paul Daniel Faria
b46e42fe2a Clean up macro argument matches so they satisfy tidy checks 2017-11-01 20:12:10 -04:00
Paul Daniel Faria
4e496de26d Add derive and doc comment capabilities to newtype_index macro 2017-11-01 20:12:10 -04:00
Niko Matsakis
f27eb1e684 change region display to '_#Nr, update the newtype_index! macro
The macro now takes a format string. It no longer defaults to using the
type name. Didn't seem worth going through contortions to maintain.  I
also changed most of the debug formats to be `foo[N]` instead of `fooN`.
2017-10-31 12:41:40 -04:00
Niko Matsakis
7523c7368c introduce liveness constraints into NLL code
And do a bunch of gratuitious refactoring that I did not bother to
separate into nice commits.
2017-10-31 12:41:38 -04:00
Michael Woerister
54818b3e99 Update some comments about StableHasher. 2017-10-26 11:10:07 +02:00
Michael Woerister
89909c76a3 Fix 32 vs 64 bit platform instability in StableHasher. 2017-10-25 16:49:55 +02:00
bors
c0956ff265 Auto merge of #45319 - michaelwoerister:use-128bit-siphash, r=nikomatsakis
incr.comp.: Use 128bit SipHash for fingerprinting

This PR switches incr. comp. result fingerprinting from 128 bit BLAKE2 to 128 bit SipHash. When we started using BLAKE2 for fingerprinting, the 128 bit version of SipHash was still experimental. Now that it isn't anymore we should be able to get a nice performance boost without significantly increasing collision probability.

~~I'm going to start a try-build for this, so we can gauge the performance impact before merging (hence the `WIP` in the title).~~

EDIT: Performance improvements look as expected. Tests seem to be passing.

Fixes #41215.
2017-10-20 07:50:18 +00:00
Santiago Pastorino
b8f981a149 Generate FirstStatementIndex using newtype_index macro 2017-10-17 12:06:20 -03:00
Michael Woerister
10e289e191 Make debuginfo::UniqueTypeId use 128 bit hash. 2017-10-16 14:44:40 +02:00
Michael Woerister
74ebad4b63 Use SipHasher128 in StableHasher. 2017-10-16 14:44:40 +02:00
Michael Woerister
25014b5379 rustc_data_structures: Add implementation of 128 bit SipHash. 2017-10-16 14:44:40 +02:00
kennytm
82f2c28bc8 Rollup merge of #45110 - Nashenas88:master, r=arielb1
Improve newtype_index macro to handle description and constants consistently
2017-10-13 23:37:53 +08:00
Paul Faria
97fe353ce6 Split lines longer than 100 columns 2017-10-11 20:06:24 -04:00
Paul Faria
9423bee6d3 Move const qualifier from brackets to constant values and remove comma from after identifier 2017-10-11 20:01:55 -04:00
kennytm
23a99f4e0e
Rollup merge of #44775 - MaloJaffre:debug-struct, r=sfackler
Refactor to use `debug_struct` in several Debug impls

Also use `pad` and derive `Debug` for `Edge`.

Fixes #44771.
2017-10-10 22:43:57 +08:00
Malo Jaffré
679457ad2a Refactor to use debug_struct in several Debug impls
Fixes #44771.
2017-10-09 20:09:08 +02:00
Paul Faria
35545b36cf Improve newtype_index macro to handle description and constants consistently 2017-10-08 15:20:28 -04:00
Santiago Pastorino
271a492cb2 Generate ScopeId using newtype_index macro 2017-10-04 23:51:43 -03:00
Santiago Pastorino
b5a5556dd4 Generate DepNodeIndexNew using newtype_index macro 2017-10-04 23:51:43 -03:00
Santiago Pastorino
3502bec032 Make newtype_index get debug_name using reflection 2017-10-04 23:50:53 -03:00
Santiago Pastorino
9af7426b47 Make newtype_index macro use full path to resolve constants 2017-10-04 23:50:53 -03:00
Santiago Pastorino
3d230af80b Move newtype_index to rustc_data_structures 2017-10-04 23:50:53 -03:00
Esteban Küber
ddee9fbc99 Point at parameter type on E0301
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-24 11:50:09 -07:00
Michael Woerister
9798a88e9e incr.comp.: Add some comments. 2017-09-20 11:34:28 +02:00
Michael Woerister
3b75a3dfea incr.comp.: Make sure traits_in_scope results are hashed in a stable way. 2017-09-20 11:21:25 +02:00
Michael Woerister
74d6b850fd incr.comp.: Fix rebase fallout. 2017-09-18 12:14:52 +02:00
Michael Woerister
67c84e05e7 incr.comp.: Use StableHash impls instead of functions for hashing most maps. 2017-09-18 11:27:10 +02:00
Michael Woerister
e3f913167c Fix issues uncovered by rebasing:
- 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-18 11:25:34 +02:00
Michael Woerister
3cc3ae22bd incr.comp.: Move result fingerprinting to DepGraph::with_task().
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-18 11:25:34 +02:00
Michael Woerister
e6c9a53d1a incr.comp.: Compute hashes of all query results. 2017-09-18 11:23:08 +02:00
Alex Crichton
a7817dd52c rustc: Preallocate when building the dep graph
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-14 21:28:55 -07:00
John Kåre Alsaker
efc7d46188 Analyse storage liveness and preserve it during generator transformation 2017-09-13 23:28:10 +02:00
Alex Burka
d516434981 stabilize mem::discriminant (closes #24263) 2017-09-02 01:59:54 -04:00
bors
6f82dea299 Auto merge of #44059 - oli-obk:ok_suggestion, r=nikomatsakis
Suggest `Ok(())` when encountering `Result::<(), E>::Ok()`
2017-08-29 06:18:23 +00:00
Oliver Schneider
0b72497307
Suggest Ok(()) when encountering Ok() 2017-08-28 14:13:14 +02:00
John Kåre Alsaker
d29af37999 Merge branch 'master' of https://github.com/rust-lang/rust into gen 2017-08-28 02:41:16 +02:00
Tamir Duberstein
b3f50caee0
*: remove crate_{name,type} attributes
Fixes #41701.
2017-08-25 16:18:21 -04:00
Alex Crichton
b31998ec93 Merge remote-tracking branch 'origin/master' into gen 2017-08-21 10:41:56 -07:00
Vadim Petrochenkov
de4dbe5789 rustc: Remove some dead code 2017-08-19 13:27:16 +03:00
Alex Crichton
4b5f330c70 Merge remote-tracking branch 'origin/master' into gen 2017-08-17 13:23:20 -07:00
Corey Farwell
a4387d54dc Rollup merge of #43891 - Fourchaux:master, r=steveklabnik
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-17 10:44:07 -04:00
Alex Crichton
5f4a99fa8b Merge remote-tracking branch 'origin/master' into gen 2017-08-16 11:33:10 -07:00
Alex Crichton
1210ebff43 Merge remote-tracking branch 'origin/master' into gen 2017-08-16 10:03:47 -07:00
Felix S. Klock II
018784afc9 MIR based borrow check (opt-in).
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-16 16:08:28 +02:00
Felix S. Klock II
9b8b8c6aeb Move DataFlowState::{each_bit,interpret_set} method definitions to parent module.
Refactored `each_bit`, which traverses a `IdxSet`, so that the bulk of
its implementation lives in `rustc_data_structures`.
2017-08-16 15:53:27 +02:00
Zack M. Davis
1b6c9605e4 use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
Fourchaux
c7104be1a3 Fix typos & us spellings 2017-08-15 21:56:30 +02:00
Alex Crichton
1413253a41 Merge remote-tracking branch 'origin/master' into gen 2017-08-14 19:36:13 -07:00
bors
0d12553320 Auto merge of #43740 - michaelwoerister:local-id-in-typecktables, r=arielb1
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-14 14:15:06 +00:00
bors
bffc973da8 Auto merge of #43794 - Eijebong:fix_typos, r=lukaramu,steveklanik,imperio
Fix some typos

I wrote a really naive script and found those typos in the documentation.
2017-08-12 05:52:19 +00:00
Michael Woerister
783ccc443b Make TypeckTables::type_dependent_defs use ItemLocalId instead of NodeId. 2017-08-11 12:11:38 +02:00
Bastien Orivel
47cb3c5bc2 Fix some typos 2017-08-11 00:16:18 +02:00
Alex Crichton
b8aa595e6d Merge remote-tracking branch 'origin/master' into gen 2017-08-10 14:05:58 -07:00
bors
d21ec9b4ef Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1
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-10 08:53:22 +00:00
Alex Crichton
f72724eeb4 Fix iterator over indexed sets 2017-08-09 14:02:45 -07:00
Alex Crichton
352577f4bb Initial pass review comments 2017-08-09 13:56:19 -07:00
Alex Crichton
c25ddf21f1 Merge remote-tracking branch 'origin/master' into gen 2017-08-09 11:44:21 -07:00
bors
2bb6d3dd89 Auto merge of #43713 - arielb1:legacy-dataflow, r=eddyb
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-07 15:42:35 +00:00
Ariel Ben-Yehuda
4e3a0b636f 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).

Fixes #43704.
2017-08-07 16:00:31 +03:00
Matt Brubeck
daa764461d Remove unused fnv hash code 2017-08-02 10:42:12 -07:00
Isaac van Bakel
400075d9d9 Fixed all unnecessary muts in language core 2017-08-01 23:01:24 +01:00
Alex Crichton
dd371a2069 rustc: Inline bitwise modification operators
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-31 18:39:25 -07:00
John Kåre Alsaker
d861982ca6 Generator literal support 2017-07-28 15:46:23 +02:00
bors
ddaab61101 Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturon
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-26 23:40:48 +00:00
Mark Simulacrum
959ebd6785 Rollup merge of #43480 - dhduvall:sparc-blake2b, r=eddyb
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-26 06:15:09 -06:00
Mark Simulacrum
b5b7266b78 Rollup merge of #42959 - SimonSapin:nonzero-checked, r=sfackler
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-26 06:15:01 -06:00
Danek Duvall
f0fda53cc1 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-25 14:32:08 -07:00
Alex Crichton
daeb6077c8 std: Stabilize manually_drop feature
Stabilizes

* `core::mem::ManuallyDrop`
* `std::mem::ManuallyDrop`
* `ManuallyDrop::new`
* `ManuallyDrop::into_inner`
* `ManuallyDrop::drop`
* `Deref for ManuallyDrop`
* `DerefMut for ManuallyDrop`

Closes #40673
2017-07-25 07:09:31 -07:00
Alex Crichton
9010567dcc Bump master to 1.21.0
This commit bumps the master branch's version to 1.21.0 and also updates the
bootstrap compiler from the freshly minted beta release.
2017-07-25 07:03:19 -07:00
Bruce Mitchener
539df8121b Fix some doc/comment typos. 2017-07-23 22:48:01 +07:00
Simon Sapin
13d17adf60 Use checked NonZero constructor in obligation forest NodeIndex
… to remove an `unsafe` block.
2017-07-22 20:38:40 +02:00
Simon Sapin
a4edae95ad Add conversions from references to NonZero pointers, Unique, and Shared 2017-07-22 20:38:40 +02:00
Simon Sapin
0a08ad0443 Rename {NonZero,Shared,Unique}::new to new_unchecked 2017-07-22 20:38:16 +02:00
Sean McArthur
74b2d69358 remove associated_consts feature gate 2017-07-06 11:52:25 -07:00
Steven Fackler
0a9c13624d Revert "Stabilize RangeArgument"
This reverts commit 143206d54d.
2017-06-30 08:34:53 -10:00
Steven Fackler
143206d54d Stabilize RangeArgument
Move it and Bound to core::ops while we're at it.

Closes #30877
2017-06-24 19:20:57 -07:00
Alex Crichton
be7ebdd512 Bump version and stage0 compiler 2017-06-19 22:25:05 -07:00
bors
28cc0c5a7b Auto merge of #42593 - ibabushkin:on-demand-external-source, r=eddyb
Implement lazy loading of external crates' sources. Fixes #38875

Fixes #38875. This is a follow-up to #42507. When a (now correctly translated) span from an external crate is referenced in a error, warning or info message, we still don't have the source code being referenced.
Since stuffing the source in the serialized metadata of an rlib is extremely wasteful, the following scheme has been implemented:

* File maps now contain a source hash that gets serialized as well.
* When a span is rendered in a message, the source hash in the corresponding file map(s) is used to try and load the source from the corresponding file on disk. If the file is not found or the hashes don't match, the failed attempt is recorded (and not retried).
* The machinery fetching source lines from file maps is augmented to use the lazily loaded external source as a secondary fallback for file maps belonging to external crates.

This required a small change to the expected stderr of one UI test (it now renders a span, where previously was none).

Further work can be done based on this - some of the machinery previously used to hide external spans is possibly obsolete and the hashing code can be reused in different places as well.

r? @eddyb
2017-06-18 10:41:05 +00:00
Corey Farwell
999f3ad60d Rollup merge of #42656 - VBChunguk:struct-field-attributes, r=nikomatsakis
Remove struct_field_attributes feature gate

Part of #41681. ~This PR only removes the feature gate; this *does not* update any documentations.~ This PR removes the feature gate and the corresponding chapter of the Unstable Book.

I'm not very sure about the changes I made though... Just followed the stabilization guideline.

r? @nikomatsakis
2017-06-16 00:32:45 -04:00
Wonwoo Choi
79f173ad21 Remove struct_field_attributes feature gate 2017-06-15 02:24:05 +09:00
Murarth
eadda7665e Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
Inokentiy Babushkin
afe841587d
External spans: fixed unit tests and addressed review. 2017-06-11 16:45:51 +02:00
Inokentiy Babushkin
70fa1fbea7
Added a StableHasherResult impl for u128. 2017-06-10 12:21:24 +02:00
Michael Woerister
7fc84907dc ICH: Add some HashStable implementations. 2017-06-06 13:50:13 +02:00
Ariel Ben-Yehuda
ee982d4355 fix translation of MSVC funclets that loop to their own start 2017-05-28 12:00:03 +03:00
Vadim Petrochenkov
73c73e4a95 Stabilize unions with Copy fields and no destructor 2017-05-27 00:52:20 +03:00
Alex Crichton
ab54f4b226 rustc: Remove #![unstable] annotation
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-11 16:03:05 -07:00
Michael Woerister
6a5e2a5a9e incr.comp.: Hash more pieces of crate metadata to detect changes there. 2017-05-08 12:31:26 +02:00
Joshua Sheard
db8be04e49 Fix definitions of ULONG_PTR 2017-05-06 15:46:16 +01:00
Corey Farwell
26e067b058 Rollup merge of #41734 - nikomatsakis:incr-comp-refactor-variance, r=pnkfelix
Refactor variance and remove last `[pub]` map

This PR refactors variance to work in a more red-green friendly way. Because red-green doesn't exist yet, it has to be a bit hacky. The basic idea is this:

- We compute a big map with the variance for all items in the crate; when you request variances for a particular item, we read it from the crate
- We now hard-code that traits are invariant (which they are, for deep reasons, not gonna' change)
- When building constraints, we compute the transitive closure of all things within the crate that depend on what using `TransitiveRelation`
    - this lets us gin up the correct dependencies when requesting variance of a single item

Ah damn, just remembered, one TODO:

- [x] Update the variance README -- ah, I guess the README updates I did are sufficient

r? @michaelwoerister
2017-05-05 17:35:29 -04:00
Alexis Beingessner
4ff583b116 fallout from NonZero/Unique/Shared changes 2017-05-04 23:54:54 -04:00
Niko Matsakis
4824a199ca factor variances into a proper query
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-03 16:42:07 -04:00