]> git.proxmox.com Git - rustc.git/blame - src/test/ui/rfc-2093-infer-outlives/explicit-impl.rs
New upstream version 1.27.2+dfsg1
[rustc.git] / src / test / ui / rfc-2093-infer-outlives / explicit-impl.rs
CommitLineData
1a4d82fc 1// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
223e47cc
LB
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
83c7162d 11// ignore-tidy-linelength
c34b1796 12
83c7162d 13// Needs an explicit where clause stating outlives condition. (RFC 2093)
c34b1796 14
83c7162d
XL
15trait MakeRef<'a> {
16 type Type;
17}
c34b1796 18
83c7162d
XL
19impl<'a, T> MakeRef<'a> for Vec<T>
20 where T: 'a
21{
22 type Type = &'a T;
23}
c34b1796 24
83c7162d
XL
25// Type T needs to outlive lifetime 'a, as stated in impl.
26struct Foo<'a, T> {
27 foo: <Vec<T> as MakeRef<'a>>::Type //~ Error the parameter type `T` may not live long enough [E0309]
223e47cc 28}
c34b1796 29
83c7162d 30fn main() { }