]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #100382 - jackh726:gat-self-outlives-input, r=compiler-errors
authorMatthias Krüger <matthias.krueger@famsik.de>
Tue, 23 Aug 2022 04:55:23 +0000 (06:55 +0200)
committerGitHub <noreply@github.com>
Tue, 23 Aug 2022 04:55:23 +0000 (06:55 +0200)
commite568cb45fefd580cb22f3ae0ed45f8598ba7cda1
treef881e39272d65e2f54b48ed9f58329e6a12d9818
parent8818b00b634ee48e7617d9beb48c4d7bc6967f06
parente087871915a46943db670b3e16bd12f25a1d11a2
Rollup merge of #100382 - jackh726:gat-self-outlives-input, r=compiler-errors

Make the GATS self outlives error take into GATs in the inputs

Before, the reasoning was that outlives should factor in to the outlives error, because that value is produced and inputs aren't. However, this is potentially confusing, and we can just require this for now and relax it later if we need. GATs in where clauses still don't count for the self outlives error, and I've added a test for that.

This now errors:
```rust
trait Input {
    type Item<'a>;
    //~^ missing required
    fn takes_item<'a>(&'a self, item: Self::Item<'a>);
}
```

I've also added a test that this does not:
```rust
trait WhereClause {
    type Item<'a>;
    fn takes_item<'a>(&'a self) where Self::Item<'a>: ;
}
```

r? ``@compiler-errors``
compiler/rustc_typeck/src/check/wfcheck.rs