]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/hrtb-binder-levels-in-object-types.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[rust.git] / src / test / run-pass / hrtb-binder-levels-in-object-types.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Test that we handle binder levels in object types correctly.
12 // Initially, the reference to `'tcx` in the object type
13 // `&Typer<'tcx>` was getting an incorrect binder level, yielding
14 // weird compilation ICEs and so forth.
15
16 // pretty-expanded FIXME #23616
17
18 trait Typer<'tcx> {
19     fn method(&self, data: &'tcx int) -> &'tcx int { data }
20 }
21
22 struct Tcx<'tcx> {
23     fields: &'tcx int
24 }
25
26 impl<'tcx> Typer<'tcx> for Tcx<'tcx> {
27 }
28
29 fn g<'tcx>(typer: &Typer<'tcx>) {
30 }
31
32 fn check_static_type<'x>(tcx: &Tcx<'x>) {
33     g(tcx)
34 }
35
36 fn main() { }