Skip to content

Commit f9e14af

Browse files
committed
Don't just check params
1 parent c2da210 commit f9e14af

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

compiler/rustc_typeck/src/check/wfcheck.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ fn check_gat_where_clauses(
301301
sig.output().visit_with(&mut visitor);
302302
let mut wf_tys = FxHashSet::default();
303303
wf_tys.extend(sig.inputs());
304-
// FIXME: normalize and add normalized inputs?
305304

306305
for (region, region_idx) in &visitor.regions {
307306
for (ty, ty_idx) in &visitor.types {
@@ -423,12 +422,9 @@ impl<'tcx> TypeVisitor<'tcx> for GATSubstCollector<'tcx> {
423422
GenericArgKind::Lifetime(lt) => {
424423
self.regions.insert((lt, idx));
425424
}
426-
GenericArgKind::Type(t) => match t.kind() {
427-
ty::Param(_) => {
428-
self.types.insert((t, idx));
429-
}
430-
_ => {}
431-
},
425+
GenericArgKind::Type(t) => {
426+
self.types.insert((t, idx));
427+
}
432428
_ => {}
433429
}
434430
}

src/test/ui/generic-associated-types/self-outlives-lint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ trait Deserializer4 {
5454

5555
struct Wrap<T>(T);
5656

57-
// Even though we might theoretically want `D: 'x`, because we pass `Wrap<T>` and
58-
// we see `&'z Wrap<T>`, we are conservative and only add bounds for direct params
57+
// We pass `Wrap<T>` and we see `&'z Wrap<T>`, so we require `D: 'x`
5958
trait Des {
6059
type Out<'x, D>;
60+
//~^ Missing required bounds
6161
fn des<'z, T>(&self, data: &'z Wrap<T>) -> Self::Out<'z, Wrap<T>>;
6262
}
6363
/*

src/test/ui/generic-associated-types/self-outlives-lint.stderr

+9-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ LL | type Out<'x, 'y>;
3030
| |
3131
| help: add the required where clauses: `where U: 'y, T: 'x`
3232

33+
error: Missing required bounds on Out
34+
--> $DIR/self-outlives-lint.rs:59:5
35+
|
36+
LL | type Out<'x, D>;
37+
| ^^^^^^^^^^^^^^^-
38+
| |
39+
| help: add the required where clauses: `where D: 'x`
40+
3341
error: Missing required bounds on Out
3442
--> $DIR/self-outlives-lint.rs:75:5
3543
|
@@ -46,5 +54,5 @@ LL | type Out<'x, D>;
4654
| |
4755
| help: add the required where clauses: `where D: 'x`
4856

49-
error: aborting due to 6 previous errors
57+
error: aborting due to 7 previous errors
5058

0 commit comments

Comments
 (0)