]> git.lizzy.rs Git - rust.git/commit
make HR algorithms account for region subtyping
authorNiko Matsakis <niko@alum.mit.edu>
Wed, 20 Apr 2016 23:51:56 +0000 (19:51 -0400)
committerNiko Matsakis <niko@alum.mit.edu>
Tue, 31 May 2016 23:41:25 +0000 (19:41 -0400)
commit11984340bfe93be311eeea9881ae2d1fb8fb0ddb
tree5c882ed87fb41ddb4735bb4eb2207e497fd5d8f6
parentaecce2ba6eba5fbadb2e5aaf9eb29a30acea086d
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.
src/librustc/diagnostics.rs
src/librustc/infer/error_reporting.rs
src/librustc/infer/higher_ranked/mod.rs
src/librustc/infer/mod.rs
src/librustc/infer/region_inference/mod.rs
src/librustc/traits/project.rs
src/librustc/traits/select.rs
src/librustc_typeck/check/compare_method.rs
src/test/compile-fail/hr-subtype.rs [new file with mode: 0644]
src/test/compile-fail/regions-close-over-type-parameter-1.rs
src/test/run-pass/coherence-subtyping.rs