modify leak-check to track only outgoing edges from placeholders

Also, update the affected tests. This seems strictly better but it is
actually more permissive than I initially intended. In particular it
accepts this

```
forall<'a, 'b> {
  exists<'intersection> {
    'a: 'intersection,
    'b: 'intersection,
  }
}
```

and I'm not sure I want to accept that. It implies that we have a
`'empty` in the new universe intoduced by the `forall`.
This commit is contained in:
Niko Matsakis 2020-05-18 09:43:36 +00:00
parent 1a4e2b6f9c
commit bcc0a9c8eb
30 changed files with 222 additions and 204 deletions

View file

@ -17,7 +17,7 @@ impl<T> Trait for fn(&T) {
fn f() {
let a: fn(_) = |_: &u8| {};
a.f(); //~ ERROR no method named `f`
a.f(); //~ ERROR implementation of `Trait` is not general enough
}
fn main() {}

View file

@ -1,17 +1,16 @@
error[E0599]: no method named `f` found for fn pointer `fn(&u8)` in the current scope
error: implementation of `Trait` is not general enough
--> $DIR/issue-57362-1.rs:20:7
|
LL | a.f();
| ^ method not found in `fn(&u8)`
LL | / trait Trait {
LL | | fn f(self);
LL | | }
| |_- trait `Trait` defined here
...
LL | a.f();
| ^ implementation of `Trait` is not general enough
|
= note: `a` is a function, perhaps you wish to call it
= help: items from traits can only be used if the trait is implemented and in scope
note: `Trait` defines an item `f`, perhaps you need to implement it
--> $DIR/issue-57362-1.rs:8:1
|
LL | trait Trait {
| ^^^^^^^^^^^
= note: `Trait` would have to be implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0`...
= note: ...but `Trait` is actually implemented for the type `for<'r> fn(&'r u8)`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.

View file

@ -19,7 +19,9 @@ impl<'a> X for fn(&'a ()) {
}
fn g() {
let x = <fn (&())>::make_g(); //~ ERROR no function or associated item
let x = <fn (&())>::make_g();
//~^ ERROR implementation of `X` is not general enough
//~| ERROR implementation of `X` is not general enough
}
fn main() {}

View file

@ -1,16 +1,33 @@
error[E0599]: no function or associated item named `make_g` found for fn pointer `for<'r> fn(&'r ())` in the current scope
--> $DIR/issue-57362-2.rs:22:25
error: implementation of `X` is not general enough
--> $DIR/issue-57362-2.rs:22:13
|
LL | let x = <fn (&())>::make_g();
| ^^^^^^ function or associated item not found in `for<'r> fn(&'r ())`
LL | / trait X {
LL | | type G;
LL | | fn make_g() -> Self::G;
LL | | }
| |_- trait `X` defined here
...
LL | let x = <fn (&())>::make_g();
| ^^^^^^^^^^^^^^^^^^ implementation of `X` is not general enough
|
= help: items from traits can only be used if the trait is implemented and in scope
note: `X` defines an item `make_g`, perhaps you need to implement it
--> $DIR/issue-57362-2.rs:8:1
|
LL | trait X {
| ^^^^^^^
= note: `X` would have to be implemented for the type `for<'r> fn(&'r ())`
= note: ...but `X` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`
error: aborting due to previous error
error: implementation of `X` is not general enough
--> $DIR/issue-57362-2.rs:22:13
|
LL | / trait X {
LL | | type G;
LL | | fn make_g() -> Self::G;
| | ----------------------- due to a where-clause on `X::make_g`...
LL | | }
| |_- trait `X` defined here
...
LL | let x = <fn (&())>::make_g();
| ^^^^^^^^^^^^^^^^^^ doesn't satisfy where-clause
|
= note: ...`X` would have to be implemented for the type `for<'r> fn(&'r ())`
= note: ...but `X` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0599`.