]> git.lizzy.rs Git - rust.git/blob - tests/ui/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / higher-rank-trait-bounds / hrtb-binder-levels-in-object-types.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(unused_variables)]
4 // Test that we handle binder levels in object types correctly.
5 // Initially, the reference to `'tcx` in the object type
6 // `&Typer<'tcx>` was getting an incorrect binder level, yielding
7 // weird compilation ICEs and so forth.
8
9 // pretty-expanded FIXME #23616
10
11 trait Typer<'tcx> {
12     fn method(&self, data: &'tcx isize) -> &'tcx isize { data }
13 }
14
15 struct Tcx<'tcx> {
16     fields: &'tcx isize
17 }
18
19 impl<'tcx> Typer<'tcx> for Tcx<'tcx> {
20 }
21
22 fn g<'tcx>(typer: &dyn Typer<'tcx>) {
23 }
24
25 fn check_static_type<'x>(tcx: &Tcx<'x>) {
26     g(tcx)
27 }
28
29 fn main() { }