Commit Graph

59298 Commits

Author SHA1 Message Date
Florian Diebold b10bbde335 Fix SVH tests some more 2016-11-29 13:04:27 +01:00
Florian Diebold f0ce5bb66b Split nested_visit_mode function off from nested_visit_map
... and make the latter mandatory to implement.
2016-11-29 13:04:27 +01:00
Florian Diebold 725cffb1d5 Address remaining review comments 2016-11-29 13:04:27 +01:00
Florian Diebold d5a501d312 Fix remaining SVH tests 2016-11-29 13:04:27 +01:00
Florian Diebold d0ae2c8142 Refactor inlined items some more
They don't implement FnLikeNode anymore, instead are handled differently
further up in the call tree. Also, keep less information (just def ids
for the args).
2016-11-29 13:04:27 +01:00
Niko Matsakis dd1491cfbe WIP: update tests to pass -- not complete 2016-11-29 13:04:27 +01:00
Niko Matsakis 688946d671 restructure `CollectItem` dep-node to separate fn sigs from bodies
Setup two tasks, one of which only processes the signatures, in order to
isolate the typeck entries for signatures from those for bodies.

Fixes #36078
Fixes #37720
2016-11-29 13:04:27 +01:00
Florian Diebold f75c8a98dd Add make tidy fixes 2016-11-29 13:04:27 +01:00
Florian Diebold 23a8c7d4d9 Remove unused import 2016-11-29 13:04:27 +01:00
Florian Diebold 8d5ca62dcd Fix some comments 2016-11-29 13:04:27 +01:00
Florian Diebold 78b54c07e5 Make hello_world test work again
This used to work with the rustc_clean attribute, but doesn't anymore
since my rebase; but I don't know enough about the type checking to find
out what's wrong. The dep graph looks like this:

ItemSignature(xxxx) -> CollectItem(xxxx)
CollectItem(xxxx) -> ItemSignature(xxxx)
ItemSignature(xxxx) -> TypeckItemBody(yyyy)
HirBody(xxxx) -> CollectItem(xxxx)

The cycle between CollectItem and ItemSignature looks wrong, and my
guess is the CollectItem -> ItemSignature edge shouldn't be there, but
I'm not sure how to prevent it.
2016-11-29 13:04:27 +01:00
Florian Diebold 7b021298d9 Fix new tests 2016-11-29 13:04:27 +01:00
Florian Diebold fb968d225a rustc_typeck: Make CollectItemTypesVisitor descend into bodies as well 2016-11-29 13:04:27 +01:00
Florian Diebold c91037b964 Fix cross-crate associated constant evaluation 2016-11-29 13:04:27 +01:00
Florian Diebold 936dbbce37 Give function bodies their own dep graph node 2016-11-29 13:04:27 +01:00
Florian Diebold 16eedd2a78 Save bodies of functions for inlining into other crates
This is quite hacky and I hope to refactor it a bit, but at least it
seems to work.
2016-11-29 13:04:27 +01:00
Florian Diebold 1ac338c2a7 rustc_driver: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 0389cc6bcd rustc_passes: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 37e75411dd rustc_plugin: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 2b790f75c5 rustc_plugin: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 441e099195 rustc_metadata: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 0cdd1d4bc1 rustc_privacy: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold dd6a57ce2a rustc_trans: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 8f63b416af rustc_trans: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 2f6976ede9 rustc_incremental: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 490c23f054 rustc_incremental: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold b7a6cf8f10 rustc_typeck: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 8c8257a8c6 rustc_borrowck: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 8f6bb85b98 rustc_mir: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold 8e754736dc rustc_const_eval: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold f55482e7c9 rustc: replace body exprs by their ids 2016-11-29 13:04:27 +01:00
Florian Diebold 069a2442b8 Add exprs map to crate, collect item blocks there 2016-11-29 13:04:27 +01:00
Jeffrey Seyfried c871637e43 Remove `resolver.record_resolution()`. 2016-11-29 04:47:47 +00:00
bors 5de15be5ec Auto merge of #38046 - rkruppe:fix-32bit-rustbuild, r=alexcrichton
Fix rustbuild on 32 bit Linux

This is cherry-picked from #37817 which seems to be stalled and currently needs to be rebased anyway.

r? @alexcrichton (who authored this change)
2016-11-28 21:44:44 -06:00
Esteban Küber 4226930ddf Show `Trait` instead of `<Struct as Trait>` in E0323
For a given file

```
trait Foo {
    fn bar(&self);
}

pub struct FooConstForMethod;

impl Foo for FooConstForMethod {
    const bar: u64 = 1;
}
```

show

```
error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo`
```

instead of

```
error[E0323]: item `bar` is an associated const, which doesn't match its trait `<FooConstForMethod as Foo>`
```
2016-11-28 17:59:24 -08:00
Mark-Simulacrum 8b82fd7a94 Remove allocation in push_type_params 2016-11-28 18:09:15 -07:00
Mark-Simulacrum a79c80d0b0 Adds TyCtxt::require_lang_item(LangItem) to simplify lang item requires.
Replaces instances of tcx.lang_items.require(..) with fatal unwrap with
this method.
2016-11-28 18:09:15 -07:00
Mark-Simulacrum 9b803ec421 Remove auto_traits from PartitionedBounds 2016-11-28 18:09:15 -07:00
Mark-Simulacrum bb35d50cad Refactor TyTrait to contain a interned ExistentialPredicate slice.
Renames TyTrait to TyDynamic.
2016-11-28 18:09:13 -07:00
Jeffrey Seyfried 8fe525dd1c Simplify `binding.module()`. 2016-11-29 00:18:41 +00:00
Jeffrey Seyfried 7bccc9d769 Clean up formatting. 2016-11-29 00:18:40 +00:00
Jeffrey Seyfried e9e178a581 Refactor away `ResolveResult`. 2016-11-29 00:18:39 +00:00
Jeffrey Seyfried af2d89c7f6 Refactor path resoloution. 2016-11-29 00:18:34 +00:00
Jeffrey Seyfried cb9f14e987 Use `Def::Err` to signal that an error has already been reported where possible. 2016-11-28 23:30:03 +00:00
Ariel Ben-Yehuda 5c0eb6ecb7 evaluate obligations in LIFO order during closure projection
This is an annoying gotcha with the projection cache's handling of
nested obligations.

Nested projection obligations enter the issue in this case:
```
DEBUG:rustc::traits::project: AssociatedTypeNormalizer: depth=3
normalized
<std::iter::Map<std::ops::Range<i32>,
[closure@not-a-recursion-error.rs:5:30: 5:53]> as
std::iter::IntoIterator>::Item to _#7t with 12 add'l obligations
```

Here the normalization result is the result of the nested impl
`<[closure@not-a-recursion-error.rs:5:30: 5:53] as FnMut(i32)>::Output`,
which is an additional obligation that is a part of "add'l obligations".

By itself, this is proper behaviour - the additional obligation is
returned, and the RFC 447 rules ensure that it is processed before the
output `#_7t` is used in any way.

However, the projection cache breaks this - it caches the
`<std::iter::Map<std::ops::Range<i32>,[closure@not-a-recursion-error.rs:5:30:
5:53]> as std::iter::IntoIterator>::Item = #_7t` resolution. Now
everybody else that attempts to look up the projection will just get
`#_7t` *without* any additional obligations. This obviously causes all
sorts of trouble (here a spurious `EvaluatedToAmbig` results in
specializations not being discarded
[here](9ca50bd4d5/src/librustc/traits/select.rs (L1705))).

The compiler works even with this projection cache gotcha because in most
cases during "one-pass evaluation". we tend to process obligations in LIFO
order - after an obligation is added to the cache, we process its nested
obligations before we do anything else (and if we have a cycle, we handle
it specifically) - which makes sure the inference variables are resolved
before they are used.

That "LIFO" order That was not done when projecting out of a closure, so
let's just fix that for the time being.

Fixes #38033.
2016-11-29 01:09:30 +02:00
Niko Matsakis 72fbf9f0fe fixup test cases 2016-11-28 17:06:10 -05:00
Mikhail Modin 67a24c2e18 add hint to fix error for immutable ref in arg 2016-11-29 00:32:34 +03:00
bors 1c448574bc Auto merge of #37791 - petrochenkov:where, r=nikomatsakis
Support `?Sized` in where clauses

Implemented as described in https://github.com/rust-lang/rust/issues/20503#issuecomment-258677026 - `?Trait` bounds are moved on type parameter definitions when possible, reported as errors otherwise.
(It'd be nice to unify bounds and where clauses in HIR, but this is mostly blocked by rustdoc now - it needs to render bounds in pleasant way and the best way to do it so far is to mirror what was written in source code.)

Fixes https://github.com/rust-lang/rust/issues/20503
r? @nikomatsakis
2016-11-28 15:15:17 -06:00
Robin Kruppe 6e35cc94de Remove unused functions from rustc_llvm 2016-11-28 21:59:26 +01:00
Robin Kruppe 85dc08e525 Don't assume llvm::StringRef is null terminated
StringRefs have a length and their contents are not usually null-terminated.
The solution is to either copy the string data (in rustc_llvm::diagnostic) or take the size into account (in LLVMRustPrintPasses).
I couldn't trigger a bug caused by this (apparently all the strings returned in practice are actually null-terminated) but this is more correct and more future-proof.
2016-11-28 17:33:13 +01:00