]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/relate_tys/issue-48071.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / nll / relate_tys / issue-48071.rs
CommitLineData
8faf50e0
XL
1// Regression test for #48071. This test used to ICE because -- in
2// the leak-check -- it would pass since we knew that the return type
3// was `'static`, and hence `'static: 'a` was legal even for a
4// placeholder region, but in NLL land it would fail because we had
5// rewritten `'static` to a region variable.
6//
60c5eb7d 7// check-pass
8faf50e0 8
8faf50e0
XL
9trait Foo {
10 fn foo(&self) { }
11}
12
13impl Foo for () {
14}
15
16type MakeFooFn = for<'a> fn(&'a u8) -> Box<dyn Foo + 'a>;
17
18fn make_foo(x: &u8) -> Box<dyn Foo + 'static> {
19 Box::new(())
20}
21
22fn main() {
23 let x: MakeFooFn = make_foo as MakeFooFn;
24}