Commit Graph

53760 Commits

Author SHA1 Message Date
Niko Matsakis
d3d2fc51f7 some new tests 2016-05-31 19:59:34 -04:00
Niko Matsakis
72b97070ff do not use fresh regions in return type
This test was abusing #32330; cleanup the code some.
2016-05-31 19:59:34 -04:00
Niko Matsakis
136a83ad4d fallout in tests
in some cases we give more specific messages or fewer
duplicates, now that we have cache and make fewer region variables
2016-05-31 19:59:33 -04:00
Niko Matsakis
ad97f296d3 add FIXME to fulfill 2016-05-31 19:59:33 -04:00
Niko Matsakis
38995c9029 consult cache in projection 2016-05-31 19:59:33 -04:00
Niko Matsakis
6751d68f25 cleanup imports for cache 2016-05-31 19:59:03 -04:00
Niko Matsakis
5368432538 thread vtable-closure obligations to result
the vtable.nested obligations were being dropped on the floor.
2016-05-31 19:58:44 -04:00
Niko Matsakis
24d4f10ab2 change to use higher_ranked_match
also, consolidate the return type into from a tuple into a struct
`Progress`
2016-05-31 19:58:44 -04:00
Niko Matsakis
21eb36608e create but do not use a projection cache 2016-05-31 19:44:43 -04:00
Niko Matsakis
d042ce2ed3 add a snapshottable hashmap 2016-05-31 19:44:05 -04:00
Niko Matsakis
5cff88f2a0 add a higher-ranked match routine
Currently, when projecting out of a higher-ranked where-clause, we
instantiate all higher-ranked regions with lifetime variables. This is
unnecessary since the language rules ought to guarantee (modulo #32330)
that each of those higher-ranked regions is equated with some regions
from the input types. This routine figures out what those regions are
and just uses them. Also, since #32330 is not fully fixed, it detects
when we may have unconstrained variables and indicates that in its
return value.
2016-05-31 19:44:05 -04:00
Niko Matsakis
b40529c5a9 projection predicates can be copy 2016-05-31 19:44:05 -04:00
Niko Matsakis
9ef768c811 add trailing comma 2016-05-31 19:44:04 -04:00
Niko Matsakis
de6c52d5ea make region-param-def encoding more DRY
we used to have two separate routines, one in tyencode/tydecode, and one
in encode/decode.
2016-05-31 19:44:04 -04:00
Niko Matsakis
8770d0f34a remove VerifyRegSubReg and cleanup region infer
We used to make region->region edges part of the verify set, but this
change stores them like other edges, as a full-fledged constraint.
Besides making the code somewhat cleaner, this allows them to be more
easily dropped as part of `pop_skolemized`. This change also refactors
the code a bit to remove some intermediate data structures that are no
longer particular useful (e.g., VarValue).
2016-05-31 19:43:38 -04:00
Niko Matsakis
cacbb2147f add trailing comma 2016-05-31 19:43:38 -04:00
Niko Matsakis
7cf63a2a72 more debug dumping in trans 2016-05-31 19:43:38 -04:00
Niko Matsakis
d3afbd6c4d more debug dumping in traits 2016-05-31 19:43:38 -04:00
Niko Matsakis
eaf13b2f01 better debug dumping with inference variables 2016-05-31 19:42:59 -04:00
Niko Matsakis
75543c08c7 simplify HR subtyping back to what we did before
A lot of the refactors, however, seem helpful, so leave those in,
particularly since we may want to make this change in the future.
2016-05-31 19:42:22 -04:00
Niko Matsakis
52b2db1cca warn if leak-check relies on LBRs that will change
When we do a "HR subtype" check, we replace all late-bound regions (LBR)
in the subtype with fresh variables, and skolemize the late-bound
regions in the supertype. If those skolemized regions from the supertype
wind up being super-regions (directly or indirectly) of either

- another skolemized region; or,
- some region that pre-exists the HR subtype check
  - e.g., a region variable that is not one of those created
    to represent bound regions in the subtype

then the subtype check fails.

What will change when we fix #32330 is that some of the LBR in the
subtype may become early-bound. In that case, they would no longer be in
the "permitted set" of variables that can be related to a skolemized
type.

So the foundation for this warning is to collect variables that we found
to be related to a skolemized type. For each of them, we have a
`BoundRegion` which carries a `Issue32330` flag. We check whether any of
those flags indicate that this variable was created from a lifetime
that will change from late- to early-bound. If so, we issue a warning
indicating that the results of compilation may change.

This is imperfect, since there are other kinds of code that will not
compile once #32330 is fixed. However, it fixes the errors observed in
practice on crater runs.
2016-05-31 19:41:25 -04:00
Niko Matsakis
08034eb1a5 add Issue32330 warning marker to bound regions
This indicates whether this `BoundRegion` will change from late to early
bound when issue 32330 is fixed. It also indicates the function on
which the lifetime is declared.
2016-05-31 19:41:25 -04:00
Niko Matsakis
11984340bf make HR algorithms account for region subtyping
Currently, we consider region subtyping a failure
if a skolemized lifetime is relatable to any
other lifetime in any way at all. But a more precise
formulation is to say that a skolemized lifetime:

- must not have any *incoming* edges in the region graph
- only has *outgoing* edges to nodes that are `'static`

To enforce the latter requirement, we add edges from `'static -> 'x` for
each lifetime '`x' reachable from a skolemized region.

We now have to add a new `pop_skolemized` routine to do cleanup.
Whereas before if there were *any* edges relating to a skolemized
region, we would return `Err` and hence rollback the transaction, we now
tolerate some edges and return `Ok`. Therefore, the `pop_skolemized`
routine runs and cleans up those edges.
2016-05-31 19:41:25 -04:00
Niko Matsakis
aecce2ba6e add flag for ReSkolemized 2016-05-31 19:12:35 -04:00
bors
298730e703 Auto merge of #33960 - tbu-:pr_ref_clone_overflow, r=Aatch
Prevent the borrow counter from overflowing in `Ref::clone`

Fixes #33880.
2016-05-30 23:09:00 -07:00
bors
a967611d8f Auto merge of #33968 - srinivasreddy:slice.rs, r=Manishearth
Correct grammar; and remove redundant comment
2016-05-30 16:34:34 -07:00
bors
b522b25a41 Auto merge of #33909 - michaelwoerister:frame-pointer-fix, r=nikomatsakis
Emit "no-frame-pointer-elim" attribute for closures, shims, and glue.

This will hopefully let `perf` give better backtraces.
r? @nikomatsakis
2016-05-30 11:01:55 -07:00
Srinivas Reddy Thatiparthy
87bc04f45c Correct grammar; and remove redundant comment 2016-05-30 22:38:07 +05:30
bors
f3bfa313ec Auto merge of #33965 - Manishearth:rollup, r=Manishearth
Rollup of 5 pull requests

- Successful merges: #33867, #33926, #33942, #33958, #33964
- Failed merges:
2016-05-30 08:13:08 -07:00
Manish Goregaokar
26c209897f Rollup merge of #33964 - Ms2ger:refcell-resolutions, r=Manishearth
Move driver::Resolutions::def_map out of its RefCell.
2016-05-30 20:35:47 +05:30
Manish Goregaokar
5ef7c43a76 Rollup merge of #33958 - kennytm:patch-1, r=GuillaumeGomez
Use Path::is_dir() in fs::read_dir()'s example.

Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
2016-05-30 20:35:47 +05:30
Manish Goregaokar
066fc8d9a6 Rollup merge of #33942 - srinivasreddy:rustfmt_llvm_folder, r=nrc
run rustfmt on librustc_llvm folder
2016-05-30 20:35:46 +05:30
Manish Goregaokar
2b5724f0c4 Rollup merge of #33926 - jseyfried:fix_derive_span, r=nrc
Fix the span of generated `#[derive_*]` attributes

Fixes #33571.
r? @nrc
2016-05-30 20:35:46 +05:30
Manish Goregaokar
653ce3e525 Rollup merge of #33867 - oli-obk:rustdoc_variant_types, r=GuillaumeGomez
print enum variant fields in docs

Right now we are repeating enum variants at the top, because the fields aren't shown with the actual docs. It's very annoying to have to scroll up and down to have both docs and field info. For struct variants we already list the fields.

enum docs look like this after this PR:

![screenshot from 2016-05-25 14-02-42](https://cloud.githubusercontent.com/assets/332036/15539231/84b018cc-2281-11e6-9666-1063655931f4.png)

There are degenerate cases for enum tuple variants with lots of fields:

![screenshot from 2016-05-25 14-01-00](https://cloud.githubusercontent.com/assets/332036/15539260/91e537ca-2281-11e6-8bf1-a3d6b2e78f65.png)

I was thinking that we could move the docs below the variant (slightly indented) or list the variant fields vertically instead of horizontally

r? @steveklabnik
2016-05-30 20:35:46 +05:30
Oliver Schneider
b0c7033042
print enum variant fields in docs 2016-05-30 16:11:53 +02:00
Ms2ger
989a3034db Move driver::Resolutions::def_map out of its RefCell. 2016-05-30 15:17:16 +02:00
bors
5da602bda3 Auto merge of #33959 - Manishearth:rollup, r=Manishearth
Rollup of 8 pull requests

- Successful merges: #33793, #33893, #33912, #33913, #33914, #33917, #33937, #33938
- Failed merges:
2016-05-30 02:54:00 -07:00
Manish Goregaokar
9d2ec40b74 Rollup merge of #33938 - srinivasreddy:rustfmt_libunwind, r=Manishearth
run rustfmt on libunwind
2016-05-30 15:19:01 +05:30
Manish Goregaokar
21dc6c2678 Rollup merge of #33937 - srinivasreddy:rustfmt_librand, r=GuillaumeGomez
run rustfmt on librand folder
2016-05-30 15:19:01 +05:30
Manish Goregaokar
0072e6b9e3 Rollup merge of #33917 - srinivasreddy:rustfmt_liballoc, r=GuillaumeGomez
rustfmt liballoc folder
2016-05-30 15:19:00 +05:30
Manish Goregaokar
c41e9d9f40 Rollup merge of #33914 - GuillaumeGomez:improve_err_expl, r=GuillaumeGomez
Improve err expl

r? @steveklabnik
2016-05-30 15:19:00 +05:30
Manish Goregaokar
6c6dcc9539 Rollup merge of #33913 - GuillaumeGomez:improve_e0133, r=GuillaumeGomez
Improve E0133 error explanation

r? @steveklabnik
2016-05-30 15:19:00 +05:30
Manish Goregaokar
11549f0206 Rollup merge of #33912 - GuillaumeGomez:improve_E0132, r=steveklabnik
Improve E0132 error explanation

r? @steveklabnik
2016-05-30 15:19:00 +05:30
Manish Goregaokar
400b9b3242 Rollup merge of #33893 - Ophirr33:docs_string_split_fix, r=GuillaumeGomez
Added examples/docs to split in str.rs

Added documentation clarifying the behavior of split when used with the empty string and contiguous separators. Addresses issue [33882](https://github.com/rust-lang/rust/issues/33882). This is my first time contributing to rust, so forgive me if I'm skipping any of the contribution steps.
Fixes #33882
2016-05-30 15:19:00 +05:30
Manish Goregaokar
10e1e6a7a2 Rollup merge of #33793 - GuillaumeGomez:compile_fail, r=GuillaumeGomez
Fix compile_fail tag

Fixes #33780

r? @steveklabnik
2016-05-30 15:18:59 +05:30
kennytm
048f37254c Use Path::is_dir() in fs::read_dir()'s example.
Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
2016-05-30 17:12:01 +08:00
Tobias Bucher
ef60c7cd49 Prevent the borrow counter from overflowing in Ref::clone
Fixes #33880.
2016-05-30 09:53:09 +02:00
bors
bf9c60c9a6 Auto merge of #33929 - petrochenkov:pathir, r=eddyb
Separate bindings from other patterns in HIR

Now when name resolution is done on AST, we can avoid dumping everything that looks like an identifier into `PatKind::Ident` in HIR.
`hir::PatKind::Ident` is removed, fresh bindings are now called `hir::PatKind::Binding`, everything else goes to `hir::PatKind::Path`.

I intend to do something with `PatKind::Path`/`PatKind::QPath` as well using resolution results, but it requires some audit and maybe some deeper refactoring of relevant resolution/type checking code to do it properly.
I'm submitting this part of the patch earlier to notify interested parties that I'm working on this.

cc @jseyfried
r? @eddyb
2016-05-29 21:28:50 -07:00
bors
6e00b55568 Auto merge of #33860 - doomrobo:fix-grammar-verification, r=nagisa
antlr grammar verification script now compiles under latest nightly

This is kind of a moving target, since none of libsyntax is stable, but at least this compiles for the time being.
2016-05-29 16:43:09 -07:00
Guillaume Gomez
31b9060ede Improve E0161 error explanation 2016-05-29 21:39:55 +02:00